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

Container to hold list of Data_Interval; implements nested interval reduction. More...

#include <data_intervaller.hpp>

Inheritance diagram for FST::Data_Intervaller< CONTAINER, IDXTYPE >:

Public Member Functions

 Data_Intervaller (const Data_Intervaller &tin)
Data_Interval< IDXTYPE > * getFirstBlock (const unsigned int loopdepth=0)
 positions loop loopdepth at the first interval and returns it, or nullptr if there are none
Data_Interval< IDXTYPE > * getNextBlock (const unsigned int loopdepth=0)
bool check_validity (const IDXTYPE maxidx)
 checks whether all intervals are non-overlapping, ordered ascending, and all fit to <0,maxidx> (maxidx==0 disables maxidx test)
IDXTYPE sum ()
 sums the sizes of all contained intervals, i.e. the total number of samples they cover
IDXTYPE max_idx ()
 returns the largest sample index any interval covers, i.e. the maximum of startidx+count-1 over non-empty intervals (0 if there are none)
void reduce (const std::shared_ptr< Data_Intervaller< CONTAINER, IDXTYPE > > reducer, std::shared_ptr< Data_Intervaller< CONTAINER, IDXTYPE > > target)
 Translates reducer's RELATIVE index intervals into absolute ones and stores them in target.

Private Types

typedef Data_Intervaller< CONTAINER, IDXTYPE >::iterator TCI
 this container's iterator type, used to type blockiter and the sum()/max_idx()/reduce() loop variables

Private Attributes

std::vector< TCI > blockiter
 to enable multiple independent get*Block() loops

Friends

std::ostream & operator<< (std::ostream &os, const Data_Intervaller< CONTAINER, IDXTYPE > &ia)
 Streams every contained interval as "si:<startidx>, c:<count>" lines to os.

Detailed Description

template<class CONTAINER, typename IDXTYPE>
class FST::Data_Intervaller< CONTAINER, IDXTYPE >

Container to hold list of Data_Interval; implements nested interval reduction.

Invariant
CONTAINER must be a container of Data_Interval supporting iterators, push_back(), clear()
Examples
demo10.cpp, demo52t.cpp, and demo55.cpp.

Constructor & Destructor Documentation

◆ Data_Intervaller()

template<class CONTAINER, typename IDXTYPE>
FST::Data_Intervaller< CONTAINER, IDXTYPE >::Data_Intervaller ( const Data_Intervaller< CONTAINER, IDXTYPE > & tin)

Deep-copies tin's interval list; blockiter (the active get*Block() loop cursors) is deliberately NOT copied – it holds iterators into the source container, so the copy starts with no active block loop (getFirstBlock() (re)initializes it per loopdepth).

Member Function Documentation

◆ check_validity()

template<class CONTAINER, typename IDXTYPE>
bool FST::Data_Intervaller< CONTAINER, IDXTYPE >::check_validity ( const IDXTYPE maxidx)

checks whether all intervals are non-overlapping, ordered ascending, and all fit to <0,maxidx> (maxidx==0 disables maxidx test)

Note
On failure it also writes a short diagnostic to std::cerr (through syncout::print()) saying which check failed.

◆ getNextBlock()

template<class CONTAINER, typename IDXTYPE>
Data_Interval< IDXTYPE > * FST::Data_Intervaller< CONTAINER, IDXTYPE >::getNextBlock ( const unsigned int loopdepth = 0)

advances loop loopdepth (previously started via getFirstBlock() with the same loopdepth) and returns the next interval, or nullptr once exhausted

◆ reduce()

template<class CONTAINER, typename IDXTYPE>
void FST::Data_Intervaller< CONTAINER, IDXTYPE >::reduce ( const std::shared_ptr< Data_Intervaller< CONTAINER, IDXTYPE > > reducer,
std::shared_ptr< Data_Intervaller< CONTAINER, IDXTYPE > > target )

Translates reducer's RELATIVE index intervals into absolute ones and stores them in target.

The intervals held here select a subset of the data by absolute sample index. reducer selects a further subset of THAT selection, addressing it as if the intervals here were concatenated into one contiguous run: its index 0 is this list's first sample, its index 1 the second, and so on across interval boundaries. reduce() maps every such relative interval back to the absolute indexes it actually denotes, splitting it wherever it straddles a boundary of this list, and appends the results to target.

This is what makes nested splitting work: a splitter at a deeper level enumerates positions within the enclosing level's training part without knowing where in the data that part lies.

Parameters
reducerthe relative-index selection to translate; its indexes must all be smaller than sum()
targetreceives the absolute-index result; CLEARED first, so any previous content is lost

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.