DiSMEC++
dismec::init::MultiPosMeanInitializer< Sparse > Class Template Reference
Inheritance diagram for dismec::init::MultiPosMeanInitializer< Sparse >:
dismec::init::SubsetFeatureMeanInitializer dismec::init::WeightsInitializer dismec::stats::Tracked

Public Member Functions

 MultiPosMeanInitializer (std::shared_ptr< const DatasetBase > data, const DenseRealVector &mean_of_all, std::shared_ptr< const GenericFeatureMatrix > local_features, int max_pos, real_t pos, real_t neg)
 
void get_initial_weight (label_id_t label_id, Eigen::Ref< DenseRealVector > target, objective::Objective &objective) override
 Generate an initial vector for the given label. The result should be placed in target. More...
 
- Public Member Functions inherited from dismec::init::SubsetFeatureMeanInitializer
 SubsetFeatureMeanInitializer (std::shared_ptr< const DatasetBase > data, const DenseRealVector &mean_of_all, std::shared_ptr< const GenericFeatureMatrix > local_features, real_t pos, real_t neg)
 
- Public Member Functions inherited from dismec::init::WeightsInitializer
virtual ~WeightsInitializer ()=default
 
- Public Member Functions inherited from dismec::stats::Tracked
 Tracked ()
 Default constructor, creates the internal stats::StatisticsCollection. More...
 
void register_stat (const std::string &name, std::unique_ptr< Statistics > stat)
 Registers a tracker for the statistics name. More...
 
std::shared_ptr< StatisticsCollectionget_stats () const
 Gets an ownership-sharing reference to the StatisticsCollection. More...
 

Private Types

using MatrixType = typename TypeLookup< Sparse >::MatrixType
 
using VectorType = typename TypeLookup< Sparse >::VectorType
 

Private Member Functions

void extract_sub_dataset (label_id_t label_id)
 

Private Attributes

std::vector< VectorTypem_PositiveInstances
 
int m_MaxPos
 
types::DenseRowMajor< real_tm_GramMatrix
 
DenseRealVector m_Target
 
DenseRealVector m_AlphaVector
 
Eigen::LLT< types::DenseRowMajor< real_t > > m_LLT
 
real_t m_Lambda = 0.01
 
stats::stat_id_t STAT_NUM_POS {1}
 
stats::stat_id_t STAT_LOSS_REDUCTION {2}
 

Additional Inherited Members

- Protected Member Functions inherited from dismec::init::SubsetFeatureMeanInitializer
std::pair< real_t, real_tcalculate_factors (label_id_t label_id, const Eigen::Ref< DenseRealVector > &mean_of_positives)
 
- Protected Member Functions inherited from dismec::stats::Tracked
 ~Tracked ()
 Non-virtual destructor. Declared protected, so we don't accidentally try to do a polymorphic delete. More...
 
template<class T >
void record (stat_id_t stat, T &&value)
 Record statistics. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
void declare_stat (stat_id_t index, StatisticMetaData meta)
 Declares a new statistics. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
void declare_tag (tag_id_t index, std::string name)
 Declares a new tag. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
template<class... Args>
void set_tag (tag_id_t tag, long value)
 Set value of tag. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
template<class... Args>
auto make_timer (stat_id_t id, Args... args)
 Creates a new ScopeTimer using stats::record_scope_time. More...
 
- Protected Attributes inherited from dismec::init::SubsetFeatureMeanInitializer
std::shared_ptr< const DatasetBasem_DataSet
 
std::shared_ptr< const GenericFeatureMatrixm_LocalFeatures
 
BinaryLabelVector m_LabelBuffer
 
DenseRealVector m_MeanOfAll
 
real_t m_MeanAllNormSquared
 
real_t m_PosTarget
 
real_t m_NegTarget
 
- Static Protected Attributes inherited from dismec::init::SubsetFeatureMeanInitializer
static constexpr stats::stat_id_t STAT_DURATION {0}
 

Detailed Description

template<bool Sparse>
class dismec::init::MultiPosMeanInitializer< Sparse >

Definition at line 33 of file multi_pos.cpp.

Member Typedef Documentation

◆ MatrixType

template<bool Sparse>
using dismec::init::MultiPosMeanInitializer< Sparse >::MatrixType = typename TypeLookup<Sparse>::MatrixType
private

Definition at line 34 of file multi_pos.cpp.

◆ VectorType

template<bool Sparse>
using dismec::init::MultiPosMeanInitializer< Sparse >::VectorType = typename TypeLookup<Sparse>::VectorType
private

Definition at line 35 of file multi_pos.cpp.

Constructor & Destructor Documentation

◆ MultiPosMeanInitializer()

template<bool b>
MultiPosMeanInitializer::MultiPosMeanInitializer ( std::shared_ptr< const DatasetBase data,
const DenseRealVector mean_of_all,
std::shared_ptr< const GenericFeatureMatrix local_features,
int  max_pos,
real_t  pos,
real_t  neg 
)

Member Function Documentation

◆ extract_sub_dataset()

template<bool Sparse>
void MultiPosMeanInitializer::extract_sub_dataset ( label_id_t  label_id)
private

Definition at line 180 of file multi_pos.cpp.

◆ get_initial_weight()

template<bool Sparse>
void MultiPosMeanInitializer::get_initial_weight ( label_id_t  label_id,
Eigen::Ref< DenseRealVector target,
objective::Objective objective 
)
overridevirtual

Generate an initial vector for the given label. The result should be placed in target.

Implements dismec::init::WeightsInitializer.

Definition at line 94 of file multi_pos.cpp.

References anonymous_namespace{sparsify.cpp}::STAT_DURATION.

Member Data Documentation

◆ m_AlphaVector

template<bool Sparse>
DenseRealVector dismec::init::MultiPosMeanInitializer< Sparse >::m_AlphaVector
private

Definition at line 51 of file multi_pos.cpp.

◆ m_GramMatrix

template<bool Sparse>
types::DenseRowMajor<real_t> dismec::init::MultiPosMeanInitializer< Sparse >::m_GramMatrix
private

Definition at line 49 of file multi_pos.cpp.

◆ m_Lambda

template<bool Sparse>
real_t dismec::init::MultiPosMeanInitializer< Sparse >::m_Lambda = 0.01
private

Definition at line 54 of file multi_pos.cpp.

◆ m_LLT

template<bool Sparse>
Eigen::LLT<types::DenseRowMajor<real_t> > dismec::init::MultiPosMeanInitializer< Sparse >::m_LLT
private

Definition at line 52 of file multi_pos.cpp.

◆ m_MaxPos

template<bool Sparse>
int dismec::init::MultiPosMeanInitializer< Sparse >::m_MaxPos
private

◆ m_PositiveInstances

template<bool Sparse>
std::vector<VectorType> dismec::init::MultiPosMeanInitializer< Sparse >::m_PositiveInstances
private

◆ m_Target

template<bool Sparse>
DenseRealVector dismec::init::MultiPosMeanInitializer< Sparse >::m_Target
private

Definition at line 50 of file multi_pos.cpp.

◆ STAT_LOSS_REDUCTION

template<bool Sparse>
stats::stat_id_t dismec::init::MultiPosMeanInitializer< Sparse >::STAT_LOSS_REDUCTION {2}
private

◆ STAT_NUM_POS

template<bool Sparse>
stats::stat_id_t dismec::init::MultiPosMeanInitializer< Sparse >::STAT_NUM_POS {1}
private

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