Implements train/test data splitting: first 50% of original data for training, second 50% for testing, each (data)class split separately.
More...
|
|
| Data_Splitter_5050 (const Data_Splitter_5050 &dsp) |
| | copies configuration (this splitter is parameterless, so there is nothing else to copy)
|
| virtual IDXTYPE | getNoOfSplits () const override |
| virtual std::ostream & | print (std::ostream &os) const override |
| | writes a human-readable identification of the splitter and its configuration; base default writes nothing
|
| Data_Splitter< INTERVALCONTAINER, IDXTYPE > * | clone () const override |
| | dispatches to the DEEP_KIND mechanism (default CLONE_DEEP: Derived's copy-constructor)
|
| Data_Splitter< INTERVALCONTAINER, IDXTYPE > * | sharing_clone () const override |
| | dispatches to the SHARING_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
|
| Data_Splitter< INTERVALCONTAINER, IDXTYPE > * | stateless_clone () const override |
| | dispatches to the STATELESS_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
|
|
| Data_Splitter (const Data_Splitter &dsp) |
| | Deep-copies every class's TClassSplitter (own train/test interval lists, not shared with dsp).
|
|
void | assign (const unsigned int _clsidx, const PIntervaller _train, const PIntervaller _test) |
| | Registers class _clsidx's train/test interval lists (growing csplit as needed); the caller retains ownership via the shared pointers.
|
|
void | set_n (const unsigned int _clsidx, const IDXTYPE _n) |
| | Sets class _clsidx's pattern count, which getNoOfSplits() and the concrete prepare*/splitClass* hooks size their splits against (growing csplit as needed).
|
|
IDXTYPE | get_n (const unsigned int _clsidx) const |
| | the pattern count previously set for class _clsidx via set_n()
|
| bool | makeFirstSplit () |
| | Produces the first split: prepareFirstSplit(), then splitClassFirst() per class, then finishSplit().
|
| bool | makeNextSplit () |
| | Produces the next split: prepareNextSplit(), then splitClassNext() per class, then finishSplit().
|
| Data_Splitter * | clone () const override |
| Data_Splitter * | sharing_clone () const override |
| bool | is_clone () const |
|
bool | is_sharing () const |
| | true if this instance is a sharing_clone() result (referencing, not owning, the source's structures)
|
|
bool | is_sharing_clone () const |
| | true if this instance is BOTH a clone and sharing – i.e. specifically a sharing_clone() result, not a clone()/stateless_clone() one
|
|
| virtual const char * | splitter_name () const override |
| | class name, used in error messages
|
| virtual bool | prepareNextSplit () override |
| | advance split-sequence state; false = no more splits
|
| virtual void | splitClassFirst (typename TCC::ClassIterator c, const unsigned int) override |
| | write first-split train/test intervals of class cidx (c is that class's entry in csplit)
|
|
void | assert_csplit () const |
| | DEBUG-only: asserts csplit is non-empty and every class has n>0 and non-null train/test lists.
|
| virtual bool | prepareFirstSplit () |
| | set up split-sequence state; false = no split can be made
|
| virtual void | splitClassNext (ClassIterator c, const unsigned int cidx) |
| | write next-split train/test intervals of class cidx (a single-split splitter never gets here, since its prepareNextSplit() returns false)
|
| virtual void | finishSplit () |
| | post-loop state update shared by first/next split
|
|
void | set_cloned (const bool cloned=true) |
| | marks/unmarks this instance as a clone; call from clone()/stateless_clone() overrides (Clonable_Impl does this automatically)
|
|
void | set_sharing (const bool sharing=true) |
| | marks/unmarks this instance as sharing (see is_sharing())
|
|
void | set_sharing_cloned (const bool cloned=true, const bool sharing=true) |
| | sets both flags at once; call from sharing_clone() overrides (Clonable_Impl does this automatically)
|
template<class INTERVALCONTAINER, typename IDXTYPE>
class FST::Data_Splitter_5050< INTERVALCONTAINER, IDXTYPE >
Implements train/test data splitting: first 50% of original data for training, second 50% for testing, each (data)class split separately.
Yields exactly one split. A class of odd size gives the extra sample to the TEST part (the train size is the size divided by two, rounded down).
- Warning
- The split is by position, not at random: it depends entirely on the order the samples happen to have in the file. Data sorted by anything that correlates with the class – or with a feature – produces two systematically different halves and a misleading accuracy estimate. Use Data_Splitter_RandomRandom or a cross-validation splitter when the ordering is not known to be arbitrary.
- Examples
- demo10.cpp, and demo52t.cpp.