forpy 2

Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
forpy::FastDProv Class Reference
Data Providers

Use the provided data plain throughout the training. More...

`#include <fastdprov.h>`

Inheritance diagram for forpy::FastDProv:

## Public Member Functions
| FastDProv (const DataStore< Mat > &data, const DataStore< Mat > &annotations, const std::shared_ptr< std::vector< float > const > &weights_store)
| Standard constructor. Takes shared ownership on data and annotations. More...
| FastDProv (const Data< MatCRef > &data, const Data< MatCRef > &annotations, const std::shared_ptr< std::vector< float > const > &weights_store)
| Non-ownership requiring constructor. More...
bool | operator== (const IDataProvider &rhs) const
std::vector< id_t > & | get_initial_sample_list ()
| forpy::IDataProvider function implementation. More...
size_t | get_n_samples () const
| forpy::IDataProvider function implementation. More...
Data< VecCMap > | get_feature (const size_t &) const
| forpy::IDataProvider function implementation. More...
Data< MatCRef > | get_annotations () const
| forpy::IDataProvider function implementation. More...
void | set_annotations (const DataStore< Mat > &new_annotation_store)
| forpy::IDataProvider function implementation. More...
std::shared_ptr< const std::vector< float > > | get_weights () const
| forpy::IDataProvider function implementation. More...
std::vector< std::shared_ptr< IDataProvider > > | create_tree_providers (usage_map_t &usage_map)
| forpy::IDataProvider function implementation. More...
Public Member Functions inherited from forpy::IDataProvider
virtual | ~IDataProvider ()
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...

## Private Member Functions
| FastDProv ()
| Constructor for deserialization. More...
| FastDProv (const Data< MatCRef > &data, const Data< MatCRef > &annotations, const std::shared_ptr< std::vector< float > const > &weights_store, std::shared_ptr< std::vector< id_t >> &training_ids)
| Constructor for creating a 'proxy' data provider for trees. More...
void | checks (const Data< MatCRef > &data, const Data< MatCRef > &annotations) const
| Perform all necessary checks before constructing an instance. More...
void | init_from_arrays ()
| Perform the initialization once the FastDProv::data and FastDProv::annotations have been set. More...

## Private Attributes
DataStore< Mat > | data_store
| Data storage. If ownership of the data can't be shared, it is copied here. More...
DataStore< Mat > | annotation_store
Data< MatCRef > | data
| A reference to the data. More...
Data< MatCRef > | annotations
| A reference to the annotations. More...
std::shared_ptr< std::vector< float > const > | weights_store
| Weight storage. More...
std::shared_ptr< std::vector< id_t > > | training_ids
size_t | annot_vec_dim
| The dimension of one annotation vector. More...
size_t | feat_vec_dim
| The dimension of one feature vector. More...

## Friends
std::ostream & | operator<< (std::ostream &stream, const FastDProv &self)

## Additional Inherited Members
Public Attributes inherited from forpy::IDataProvider
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 inherited from forpy::IDataProvider
| 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 inherited from forpy::IDataProvider
size_t | feat_vec_dim
| The dimension of one feature vector. More...
size_t | annot_vec_dim
| The dimension of one annotation vector. More...

## Detailed Description

Use the provided data plain throughout the training.

Definition at line 19 of file fastdprov.h.

## Constructor & Destructor Documentation

## ◆ FastDProv() [1/4]

forpy::FastDProv::FastDProv | ( | const DataStore< Mat > & | data,
|  | const DataStore< Mat > & | annotations,
|  | const std::shared_ptr< std::vector< float > const > & | weights_store
| ) |  |

Standard constructor. Takes shared ownership on data and annotations.

Parameters

  data | Matrix in column major order with shape (n_samples x n_features).
  annotations | Matrix in row major order with shape (n_samples x n_annots).
  weights_store | Storage for sample weights. If nullptr, weights are ignored.

## ◆ FastDProv() [2/4]

forpy::FastDProv::FastDProv | ( | const Data< MatCRef > & | data,
|  | const Data< MatCRef > & | annotations,
|  | const std::shared_ptr< std::vector< float > const > & | weights_store
| ) |  |

Non-ownership requiring constructor.

It's your job to keep the data alive as long as this object exists. I'm looking at you, Python interface!

Parameters

  data | Matrix in column major order with shape (n_samples x n_features).
  annotations | Matrix in row major order with shape (n_samples x n_annots).
  weights_store | Vector with shape (n_samples) with positive weights for each sample.

## ◆ FastDProv() [3/4]

forpy::FastDProv::FastDProv | ( |  | ) |
| inline private

Constructor for deserialization.

Definition at line 86 of file fastdprov.h.

## ◆ FastDProv() [4/4]

forpy::FastDProv::FastDProv | ( | const Data< MatCRef > & | data,
|  | const Data< MatCRef > & | annotations,
|  | const std::shared_ptr< std::vector< float > const > & | weights_store,
|  | std::shared_ptr< std::vector< id_t >> & | training_ids
| ) |  |
| private

Constructor for creating a 'proxy' data provider for trees.

This just maps the data of an existing data provider.

## Member Function Documentation

## ◆ checks()

void forpy::FastDProv::checks | ( | const Data< MatCRef > & | data,
|  | const Data< MatCRef > & | annotations
| ) |  | const
| private

Perform all necessary checks before constructing an instance.

## ◆ create_tree_providers()

std::vector<std::shared_ptr<IDataProvider> > forpy::FastDProv::create_tree_providers | ( | usage_map_t & | usage_map | ) |

forpy::IDataProvider function implementation.

## ◆ get_annotations()

Data<MatCRef> forpy::FastDProv::get_annotations | ( |  | ) | const
| inline virtual

forpy::IDataProvider function implementation.

Reimplemented from forpy::IDataProvider.

Definition at line 59 of file fastdprov.h.

## ◆ get_feature()

Data<VecCMap> forpy::FastDProv::get_feature | ( | const size_t & |  | ) | const
| virtual

forpy::IDataProvider function implementation.

Reimplemented from forpy::IDataProvider.

## ◆ get_initial_sample_list()

std::vector<id_t>& forpy::FastDProv::get_initial_sample_list | ( |  | ) |
| inline

forpy::IDataProvider function implementation.

Definition at line 53 of file fastdprov.h.

## ◆ get_n_samples()

size_t forpy::FastDProv::get_n_samples | ( |  | ) | const
| inline

forpy::IDataProvider function implementation.

Definition at line 55 of file fastdprov.h.

## ◆ get_weights()

std::shared_ptr<const std::vector<float> > forpy::FastDProv::get_weights | ( |  | ) | const
| inline virtual

forpy::IDataProvider function implementation.

Reimplemented from forpy::IDataProvider.

Definition at line 67 of file fastdprov.h.

## ◆ init_from_arrays()

void forpy::FastDProv::init_from_arrays | ( |  | ) |
| private

Perform the initialization once the FastDProv::data and FastDProv::annotations have been set.

## ◆ operator==()

bool forpy::FastDProv::operator== | ( | const IDataProvider & | rhs | ) | const

## ◆ set_annotations()

void forpy::FastDProv::set_annotations | ( | const DataStore< Mat > & | new_annotation_store | ) |
| inline virtual

forpy::IDataProvider function implementation.

Reimplemented from forpy::IDataProvider.

Definition at line 61 of file fastdprov.h.

## Friends And Related Function Documentation

## ◆ operator<<

std::ostream& operator<< | ( | std::ostream & | stream,
|  | const FastDProv & | self
| ) |  |
| friend

Definition at line 75 of file fastdprov.h.

## Member Data Documentation

## ◆ annot_vec_dim

size_t forpy::IDataProvider::annot_vec_dim
| private

The dimension of one annotation vector.

Definition at line 119 of file idataprovider.h.

## ◆ annotation_store

DataStore<Mat> forpy::FastDProv::annotation_store
| private

Data storage. If ownership of the annotations can't be shared, they are copied here.

Definition at line 111 of file fastdprov.h.

## ◆ annotations

Data<MatCRef> forpy::FastDProv::annotations
| private

A reference to the annotations.

Definition at line 115 of file fastdprov.h.

## ◆ data

Data<MatCRef> forpy::FastDProv::data
| private

A reference to the data.

Definition at line 113 of file fastdprov.h.

## ◆ data_store

DataStore<Mat> forpy::FastDProv::data_store
| private

Data storage. If ownership of the data can't be shared, it is copied here.

Definition at line 108 of file fastdprov.h.

## ◆ feat_vec_dim

size_t forpy::IDataProvider::feat_vec_dim
| private

The dimension of one feature vector.

Definition at line 114 of file idataprovider.h.

## ◆ training_ids

std::shared_ptr<std::vector<id_t> > forpy::FastDProv::training_ids
| private

A vector of the annotation indices that should be used out of the full data.

Definition at line 120 of file fastdprov.h.

## ◆ weights_store

std::shared_ptr<std::vector<float> const> forpy::FastDProv::weights_store
| private

Weight storage.

Definition at line 117 of file fastdprov.h.

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

- /Users/classner/git/forpy/include/forpy/data_providers/fastdprov.h