forpy  2
forpy::IDataProvider Class Reference

A data provider for the training of one tree. More...

#include <idataprovider.h>

Inheritance diagram for forpy::IDataProvider:
forpy::FastDProv

Public Member Functions

virtual ~IDataProvider ()
 
virtual Data< VecCMapget_feature (const size_t &) const
 Get the data for one feature from all samples, contiguously in memory (stride 1). More...
 
virtual Data< MatCRefget_annotations () const
 Get the full annotation data (must have inner stride 1). More...
 
virtual void set_annotations (const DataStore< Mat > &new_annotations) VIRTUAL_VOID
 Replace the annotations. More...
 
virtual std::shared_ptr< const std::vector< float > > get_weights () const VIRTUAL_PTR
 Get a pointer to the sample weights. More...
 
size_t get_feat_vec_dim () const
 Get the feature vector dimension. More...
 
size_t get_annot_vec_dim () const
 Get the annotation vector dimension. More...
 

Public Attributes

virtual std::vector< std::shared_ptr< IDataProvider > > virtual create_tree_providers(usage_map_t &usage_map) VIRTUAL(std bool operator== (const IDataProvider &rhs) const VIRTUAL(bool)
 Creates the data providers for each tree from the specified usage map. More...
 

Protected Member Functions

 IDataProvider (const size_t &feature_dimension, const size_t &annotation_dimension)
 Standard constructor to use for inheriting classes. More...
 
 IDataProvider ()
 Constructor solely for deserialization. More...
 

Protected Attributes

size_t feat_vec_dim
 The dimension of one feature vector. More...
 
size_t annot_vec_dim
 The dimension of one annotation vector. More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const uint &)
 

Friends

class cereal::access
 

Detailed Description

A data provider for the training of one tree.

Definition at line 22 of file idataprovider.h.

Constructor & Destructor Documentation

◆ ~IDataProvider()

virtual forpy::IDataProvider::~IDataProvider ( )
inlinevirtual

Definition at line 24 of file idataprovider.h.

◆ IDataProvider() [1/2]

forpy::IDataProvider::IDataProvider ( const size_t &  feature_dimension,
const size_t &  annotation_dimension 
)
explicitprotected

Standard constructor to use for inheriting classes.

◆ IDataProvider() [2/2]

forpy::IDataProvider::IDataProvider ( )
inlineprotected

Constructor solely for deserialization.

Definition at line 114 of file idataprovider.h.

Member Function Documentation

◆ get_annot_vec_dim()

size_t forpy::IDataProvider::get_annot_vec_dim ( ) const
inline

Get the annotation vector dimension.

Definition at line 82 of file idataprovider.h.

◆ get_annotations()

virtual Data<MatCRef> forpy::IDataProvider::get_annotations ( ) const
inlinevirtual

Get the full annotation data (must have inner stride 1).

Reimplemented in forpy::FastDProv.

Definition at line 49 of file idataprovider.h.

◆ get_feat_vec_dim()

size_t forpy::IDataProvider::get_feat_vec_dim ( ) const
inline

Get the feature vector dimension.

Definition at line 77 of file idataprovider.h.

◆ get_feature()

virtual Data<VecCMap> forpy::IDataProvider::get_feature ( const size_t &  ) const
inlinevirtual

Get the data for one feature from all samples, contiguously in memory (stride 1).

Reimplemented in forpy::FastDProv.

Definition at line 42 of file idataprovider.h.

◆ get_weights()

virtual std::shared_ptr<const std::vector<float> > forpy::IDataProvider::get_weights ( ) const
virtual

Get a pointer to the sample weights.

Can be a nullptr, in that case no weights were provided.

Reimplemented in forpy::FastDProv.

◆ serialize()

template<class Archive >
void forpy::IDataProvider::serialize ( Archive &  ar,
const uint  
)
inlineprivate

Definition at line 124 of file idataprovider.h.

◆ set_annotations()

virtual void forpy::IDataProvider::set_annotations ( const DataStore< Mat > &  new_annotations)
virtual

Replace the annotations.

Do not use this during ongoing training since there is no currently implemented mechanism to update the pointers to annotations in the various processing threads.

The method is currently used to store reduced class number lists for classification (see forpy::ClassificationOpt::check_annotations).

Reimplemented in forpy::FastDProv.

Friends And Related Function Documentation

◆ cereal::access

friend class cereal::access
friend

Definition at line 122 of file idataprovider.h.

Member Data Documentation

◆ annot_vec_dim

size_t forpy::IDataProvider::annot_vec_dim
protected

The dimension of one annotation vector.

Definition at line 119 of file idataprovider.h.

◆ feat_vec_dim

size_t forpy::IDataProvider::feat_vec_dim
protected

The dimension of one feature vector.

Definition at line 114 of file idataprovider.h.

◆ operator==

virtual std::vector<std::shared_ptr<IDataProvider> > virtual create_tree_providers ( usage_map_t &usage_map) VIRTUAL(std bool forpy::IDataProvider::operator==(const IDataProvider &rhs) const VIRTUAL(bool)

Creates the data providers for each tree from the specified usage map.

This brings some tricky issues concerning data ownership in: since internally this method will construct other data providers not owning their data, this must be communicated to the user who constructed this object non-owning data. Hence, the resulting data providers must keep this object alive if this method is called from Python, and all Python users of a data provider must keep it alive as long as they use it.

Parameters
usage_mapA vector with sample_id lists.

Definition at line 101 of file idataprovider.h.


The documentation for this class was generated from the following file: