Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER > Class Template Reference

Data-free accessor over an abstract feature universe of N features (the fst4 CLI's --features N entry; the companion of criterion_extern_value.hpp in its data-free mode). More...

#include <data_accessor_universe.hpp>

Inheritance diagram for FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >:
FST::Clonable_Impl< Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >, Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >, CLONE_INHERIT, CLONE_WEAK_SHARING, CLONE_INHERIT > FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER > FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER > FST::Data_Accessor< DATATYPE, IDXTYPE > FST::Clonable

Public Types

typedef Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER > DASM
 the immediate base class, aliased for brevity
typedef DASM::DAS DAS
 inherited: the Data_Accessor_Splitting base, used for its CLASSSIZES/enum_split/getSplittingDepth() machinery
typedef Clonable_Impl< Data_Accessor_Universe, DASM, CLONE_INHERIT, CLONE_WEAK_SHARING, CLONE_INHERIT > parent_impl
typedef std::shared_ptr< Data_Scaler< DATATYPE > > PScaler
 accepted for constructor-signature compatibility only; this accessor is data-free and never uses a scaler
typedef DASM::PSplitters PSplitters
Public Types inherited from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >
typedef Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER > DAS
 the immediate base class, aliased for brevity in derived classes
typedef std::shared_ptr< Data_Scaler< DATATYPE > > PScaler
 shared pointer to the scaler applied to loaded data
typedef DAS::PPattern PPattern
 inherited from Data_Accessor: raw pointer to one read-only feature vector
typedef DAS::PSplitters PSplitters
Public Types inherited from FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER >
typedef std::shared_ptr< Data_Splitter< INTERVALCONTAINER, IDXTYPE > > PSplitter
 shared pointer to one Data_Splitter (one nested splitting level)
typedef std::shared_ptr< std::vector< PSplitter > > PSplitters
 shared pointer to the ordered list of splitters, one per nested splitting depth (depth 0 = outermost)
typedef const DATATYPE * PPattern
Public Types inherited from FST::Data_Accessor< DATATYPE, IDXTYPE >
typedef const DATATYPE * PPattern
 one data sample: a raw pointer to its (read-only) feature vector, getNoOfFeatures() entries long

Public Member Functions

 Data_Accessor_Universe (const unsigned int n_features, const PSplitters _dsp, const PScaler _dsc)
 Constructs the accessor over an abstract universe of n_features features; _dsp and _dsc are accepted for structural compatibility with the other Data_Accessor_Splitting_Mem descendants but are never exercised.
virtual void initialize () override
 no file to read: announces the universe and sets up the degenerate shape (N features, 0 classes) Writes a one-line summary of the universe on standard output through syncout::print(), and throws fst_error if the universe is empty or if it is called on a sharing clone.
virtual bool getFirstSplit () override
 enters the single split; always true
virtual bool getNextSplit () override
 always false: the single split is the only one
virtual unsigned int getNoOfSplits () const override
 always 1
virtual std::ostream & print (std::ostream &os) const override
 writes the splitter stack's print() output (or "Data_Accessor_Splitting()" if the stack is empty) to os
Public Member Functions inherited from FST::Clonable_Impl< Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >, Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >, CLONE_INHERIT, CLONE_WEAK_SHARING, CLONE_INHERIT >
Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER > * clone () const override
 dispatches to the DEEP_KIND mechanism (default CLONE_DEEP: Derived's copy-constructor)
Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER > * sharing_clone () const override
 dispatches to the SHARING_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER > * stateless_clone () const override
 dispatches to the STATELESS_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
Public Member Functions inherited from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >
 Data_Accessor_Splitting_Mem (const std::string _filename, const PSplitters _dsp, const PScaler _dsc)
void set_scaler_fit_train (const bool b)
 Switches on per-split scaling: the scaler learns its transform on the current depth-0 split's TRAIN part only and applies it to ALL data, refreshed on every depth-0 split change.
bool get_scaler_fit_train () const
 see set_scaler_fit_train()
void scale_sample_inplace (DATATYPE *sample) const
 Applies the learned per-feature transform to sample, a caller-owned vector of getNoOfFeatures() values, in place.
virtual bool getFirstBlock (const DataPart ofwhat, PPattern &firstpattern, IDXTYPE &patterns, const unsigned int loopdepth=0) override
 returns pointer to first consecutive block of data of requested DataPart type in the current split (access iteration)
virtual bool getNextBlock (const DataPart ofwhat, PPattern &firstpattern, IDXTYPE &patterns, const unsigned int loopdepth=0) override
 returns pointer to next consecutive block of data of requested DataPart type in the current split (access iteration)
Data_Accessor_Splitting_Mem * clone () const override
Data_Accessor_Splitting_Mem * stateless_clone () const override
Public Member Functions inherited from FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER >
 Data_Accessor_Splitting (const PSplitters _dsp)
 Constructs an (uninitialized) accessor bound to the splitter stack _dsp; concrete subclasses must still call initialize() once dimensionality/class sizes are known.
virtual unsigned int getNoOfClasses () const override
 returns number of classes
virtual unsigned int getNoOfFeatures () const override
 returns data dimensionality
virtual IDXTYPE getClassSize (const unsigned int c) const override
 returns size (number of samples in) of class c
virtual IDXTYPE getClassSizeSum () const override
 returns summed size (number of samples in) of all classes, i.e., no. of all patterns in data
virtual void setClass (const int c) override
 sets active class -> from now on only data from class c will be considered
virtual int getClass () const override
 returns active class
void setSplittingDepth (const unsigned int depth)
 Selects the nested splitting level (0 = outermost/depth-0 splitter, 1 = the next-nested level, etc.) that subsequent getFirstSplit()/getNextSplit()/getFirstBlock()/getNextBlock() calls operate on.
unsigned int getSplittingDepth () const
 the nested splitting level last set via setSplittingDepth()
virtual unsigned int getSplitIndex () const override
 data access iteration (to support, e.g., loops in cross-validation)
virtual IDXTYPE getNoOfBlocks (const DataPart ofwhat) const override
virtual IDXTYPE getBlockIndex (const unsigned int loopdepth=0) const override
 returns index of the current consecutive block of data of requested DataPart type in the current split (access iteration)
virtual IDXTYPE getNoOfPatterns (const DataPart ofwhat) const override
 returns number of patterns in all consecutive blocks of data of requested DataPart type in the current split (access iteration)
virtual void substitute (const DataPart source, const DataPart target) override
 enables change of meaning of DataPart types, for use in specialized data access scenarios like in bias predicting wrappers
virtual void resubstitute () override
 resets standard DataPart types' meaning
Public Member Functions inherited from FST::Data_Accessor< DATATYPE, IDXTYPE >
Block_Range blocks (const DataPart ofwhat)
 RAII block range over the current split - prefer over the deprecated getFirstBlock()/getNextBlock() cursor.
Public Member Functions inherited from FST::Clonable
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

Protected Member Functions

 Data_Accessor_Universe (const Data_Accessor_Universe &dau, int x)
virtual void initial_data_read () override
 no-op: there is no data to read (the overridden initialize() never calls it)
virtual void initial_file_prepare () override
 no-op: there is no file to open
virtual unsigned int file_getNoOfClasses () const override
 the degenerate shape: 0 classes (no data)
virtual unsigned int file_getNoOfFeatures () const override
 the universe size _n
virtual IDXTYPE file_getClassSize (unsigned int) const override
 the degenerate shape: no class has any samples
Protected Member Functions inherited from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >
 Data_Accessor_Splitting_Mem (const Data_Accessor_Splitting_Mem &damt, int)
 weak (referencing) copy-constructor to be used in sharing_clone()
void initial_data_scaling ()
void per_split_data_scaling ()
 re-learns the scaler transform on the current depth-0 TRAIN part and re-scales the whole working buffer from the pristine data (scaler_fit_train mode only)
Protected Member Functions inherited from FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER >
 Data_Accessor_Splitting (const Data_Accessor_Splitting &da)
 "Strong" (1:1, deep) copy constructor: stateless_clone()s every splitter and re-assign()s it to this instance's own (deep-copied via splits) interval lists.
void initialize (const unsigned int _features, const CLASSSIZES &_classes)
DataPart mappedDataPart (const DataPart ofwhat) const
 looks up ofwhat's current remapping target (mappedTRAIN/mappedTEST/mappedTRAINTEST/mappedALL); NONE maps to itself
virtual bool getFirstBlock (const DataPart ofwhat, DATAINTERVAL &tmp, const unsigned int loopdepth=0)
 returns Data_Interval record representing the first consecutive block of data of requested DataPart type in the current split (access iteration)
virtual bool getNextBlock (const DataPart ofwhat, DATAINTERVAL &tmp, const unsigned int loopdepth=0)
 returns Data_Interval record representing the next consecutive block of data of requested DataPart type in the current split (access iteration)
bool is_initialized () const
void assert_splits (const int splitting_check=-1) const
 DEBUG-only: asserts the internal structures (dsp, splits, enum_split, enum_block, tt_phase, classes) are non-empty, consistently sized, and every splits entry has its train/test/reduced interval lists allocated; a no-op in release builds.
Protected Member Functions inherited from FST::Clonable
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)

Protected Attributes

friend parent_impl
unsigned int _n
 the universe size — the accessor's only substance
Protected Attributes inherited from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >
PScaler dsc
std::vector< PScaler > feature_scalers
std::string filename
IDXTYPE datasize
 total number of DATATYPE values held in data/data_raw (sum over classes of class size * features)
std::shared_ptr< DATATYPE > data
std::shared_ptr< DATATYPE > data_raw
 pristine (unscaled) data as loaded; allocated in scaler_fit_train mode only; shared across clones, never mutated after load
bool scaler_fit_train
 per-split scaling mode switch (see set_scaler_fit_train())
std::vector< IDXTYPE > _class_offset
 class start indexes (offsets) in whatever random-access data representation
Protected Attributes inherited from FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER >
CLASSSIZES classes
 pattern count per class, as passed to initialize()
unsigned int features
 data dimensionality, as passed to initialize()
DataPart mappedTRAIN
 current remapping target of TRAIN (see substitute()/resubstitute()); defaults to TRAIN
DataPart mappedTEST
 current remapping target of TEST (see substitute()/resubstitute()); defaults to TEST
DataPart mappedTRAINTEST
 current remapping target of TRAINTEST (see substitute()/resubstitute()); defaults to TRAINTEST
DataPart mappedALL
 current remapping target of ALL (see substitute()/resubstitute()); defaults to ALL
PSplitters dsp
 the splitter stack this accessor was constructed with, one Data_Splitter per nested splitting depth
std::vector< std::vector< DataSplit > > splits
 one set of splitters per each splitting depth and class
std::vector< IDXTYPE > enum_split
 current split.. 0~none
std::vector< std::vector< IDXTYPE > > enum_block
 current block loop.. 0~none
std::vector< std::vector< DataPart > > tt_phase
 in current block loop.. for DataPart==TRAINTEST indicates which half is being delivered: TRAIN, then TEST once the train blocks run out, NONE when the loop is finished
unsigned int splitting_depth
 the nested splitting level the get*Split()/get*Block() calls currently refer to; set via setSplittingDepth()
int active_class
 denotes from which class the get*Train* get*Validate* get*Test* methods return patterns, to be set using setClass()
bool _initialize_called
 set true by initialize(); read by is_initialized()

Additional Inherited Members

Protected Types inherited from FST::Data_Accessor_Splitting< DATATYPE, IDXTYPE, INTERVALCONTAINER >
typedef std::vector< unsigned int > CLASSSIZES
 per-class pattern counts, indexed by class index; the format initialize() takes
typedef const Data_Interval< IDXTYPE > * DATAINTERVAL
typedef std::shared_ptr< INTERVALCONTAINER > PIntervaller

Detailed Description

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
class FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >

Data-free accessor over an abstract feature universe of N features (the fst4 CLI's --features N entry; the companion of criterion_extern_value.hpp in its data-free mode).

There is no data file, no samples and no classes — the accessor's ONLY substance is the universe size N, which defines the subset dimensionality the searches optimize over. Everything else is the minimal honest degenerate case: 0 classes, 0 samples, and a trivial split protocol that yields exactly ONE (empty) split so the pipeline's split-iteration contract holds. Intended for --criterion extern-value --extern-no-data, where the external tool answers index-only VALUE requests from its own logic and never reads data; every data-touching component (classifiers, scalers, real splitters, validation) is refused upstream by the CLI's validity rules — this class deliberately implements NO way to read patterns, so a component that slipped through fails loudly rather than computing on fabricated data.

Derives from Data_Accessor_Splitting_Mem so the CLI's concrete-side plumbing (initialize()/setSplittingDepth()) is unchanged, but overrides initialize() and the split protocol wholesale: the base machinery is built around per-class sample intervals, and riding it with zero classes would trip its (correct) debug assertions. The constructor still takes the splitter/scaler arguments for structural compatibility — they are never exercised.

Member Typedef Documentation

◆ parent_impl

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
typedef Clonable_Impl<Data_Accessor_Universe,DASM,CLONE_INHERIT,CLONE_WEAK_SHARING,CLONE_INHERIT> FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::parent_impl

parent_impl implements sharing_clone() via the weak copy-constructor; clone/stateless_clone throw in DASM.

◆ PSplitters

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
typedef DASM::PSplitters FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::PSplitters

accepted for constructor-signature compatibility only; this accessor is data-free and never uses a splitter

Constructor & Destructor Documentation

◆ Data_Accessor_Universe()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::Data_Accessor_Universe ( const Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER > & dau,
int x )
inlineprotected

weak (referencing) copy-constructor to be used in sharing_clone(); there is no data to share — only the universe size transfers (the criterion clones assert its shape)

Member Function Documentation

◆ file_getClassSize()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual IDXTYPE FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::file_getClassSize ( unsigned int ) const
inlineoverrideprotectedvirtual

the degenerate shape: no class has any samples

Implements FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ file_getNoOfClasses()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual unsigned int FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::file_getNoOfClasses ( ) const
inlineoverrideprotectedvirtual

the degenerate shape: 0 classes (no data)

Implements FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ file_getNoOfFeatures()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual unsigned int FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::file_getNoOfFeatures ( ) const
inlineoverrideprotectedvirtual

◆ getFirstSplit()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual bool FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::getFirstSplit ( )
inlineoverridevirtual

enters the single split; always true

Reimplemented from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ getNextSplit()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual bool FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::getNextSplit ( )
inlineoverridevirtual

always false: the single split is the only one

Reimplemented from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ getNoOfSplits()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual unsigned int FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::getNoOfSplits ( ) const
inlineoverridevirtual

◆ initial_data_read()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual void FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::initial_data_read ( )
inlineoverrideprotectedvirtual

no-op: there is no data to read (the overridden initialize() never calls it)

Implements FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ initial_file_prepare()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual void FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::initial_file_prepare ( )
inlineoverrideprotectedvirtual

◆ initialize()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual void FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::initialize ( )
inlineoverridevirtual

no file to read: announces the universe and sets up the degenerate shape (N features, 0 classes) Writes a one-line summary of the universe on standard output through syncout::print(), and throws fst_error if the universe is empty or if it is called on a sharing clone.

Reimplemented from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

◆ print()

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
virtual std::ostream & FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::print ( std::ostream & os) const
inlineoverridevirtual

writes the splitter stack's print() output (or "Data_Accessor_Splitting()" if the stack is empty) to os

Reimplemented from FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALCONTAINER >.

Member Data Documentation

◆ parent_impl

template<typename DATATYPE, typename IDXTYPE, class INTERVALCONTAINER>
friend FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALCONTAINER >::parent_impl
protected

grants Clonable_Impl access to the weak copy-constructor


The documentation for this class was generated from the following file:
Copyright © 2000–present ÚTIA, Institute of Information Theory and Automation of the Czech Academy of Sciences · Contacts · This site sets no cookies and uses no analytics.