aGrUM
0.13.2

The base class for estimating parameters of CPTsThe class should be used as follows: first, to speedup computations, you should consider computing all the parameters you need in one pass. More...
#include <paramEstimator.h>
Public Member Functions  
Constructors / Destructors  
template<typename RowFilter >  
ParamEstimator (const RowFilter &filter, const std::vector< Size > &var_modalities, Apriori< IdSetAlloc, CountAlloc > &apriori, const ScoreInternalApriori< IdSetAlloc, CountAlloc > &score_internal_apriori)  
default constructor More...  
virtual ParamEstimator< IdSetAlloc, CountAlloc > *  copyFactory () const =0 
virtual copy factory More...  
virtual  ~ParamEstimator () 
destructor More...  
Accessors / Modifiers  
Idx  addNodeSet (Idx var) 
add a new CPT with a single variable to be estimated More...  
Idx  addNodeSet (Idx var, const std::vector< Idx > &conditioning_ids) 
add a new target variable plus some conditioning vars More...  
void  clear () 
clears all the data structures from memory More...  
virtual const std::vector< double, CountAlloc > &  parameters (Idx nodeset_index)=0 
returns the CPT's parameters corresponding to a given nodeset More...  
void  setParameters (Idx nodeset_index, Potential< double > &pot) 
sets the CPT's parameters corresponding to a given nodeset More...  
template<typename GUM_SCALAR >  
void  setParameters (Idx nodeset_index, Potential< GUM_SCALAR > &pot) 
sets the CPT's parameters corresponding to a given nodeset More...  
void  setRange (Size min_range, Size max_range) 
sets the range of records taken into account by the counter More...  
Protected Attributes  
Apriori< IdSetAlloc, CountAlloc > *  _apriori 
the a priori used by the score More...  
ScoreInternalApriori< IdSetAlloc, CountAlloc > *  _score_internal_apriori 
the score that was use for structure learning (used for its apriori) More...  
std::vector< bool >  _is_normalized 
indicate whether we have already normalized the parameters More...  
Protected Member Functions  
const std::vector< double, CountAlloc > &  _getAllApriori (Idx index) 
returns the apriori vector for a given (conditioned) target set More...  
const std::vector< double, CountAlloc > &  _getConditioningApriori (Idx index) 
returns the apriori vector for a conditioning set More...  
void  _insertScoreApriori () 
if needed insert the score apriori into the countings More...  
ParamEstimator (const ParamEstimator< IdSetAlloc, CountAlloc > &)  
copy constructor More...  
ParamEstimator (ParamEstimator< IdSetAlloc, CountAlloc > &&)  
move constructor More...  
The base class for estimating parameters of CPTs
The class should be used as follows: first, to speedup computations, you should consider computing all the parameters you need in one pass.
To do so, use the appropriate addNodeSet methods. These will compute everything you need. The addNodeSet methods where you do not specify a set of conditioning nodes assume that this set is empty. Once the computations have been performed, use methods _getAllCounts and _getConditioningCounts to retrieve the parameters of interest.
Definition at line 69 of file paramEstimator.h.
gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::ParamEstimator  (  const RowFilter &  filter, 
const std::vector< Size > &  var_modalities,  
Apriori< IdSetAlloc, CountAlloc > &  apriori,  
const ScoreInternalApriori< IdSetAlloc, CountAlloc > &  score_internal_apriori  
) 
default constructor
filter  the row filter that will be used to read the database 
var_modalities  the domain sizes of the variables in the database 
apriori  the a priori that is taken into account in the score/countings 
score_internal_apriori  The score internal apriori. 

virtual 
destructor

protected 
copy constructor

protected 
move constructor

protectedinherited 
perform the computation of the countings

protected 
returns the apriori vector for a given (conditioned) target set
This method returns the observation countings for the set of variables whose index was returned by method addNodeSet. If the set was conditioned, the countings correspond to the target variables and the conditioning variables. If you wish to get only the countings for the conditioning variables, prefer using method _getConditioningApriori.

protectedinherited 
returns the counting vector for a given (conditioned) target set
This method returns the observtion countings for the set of variables whose index was returned by method addNodeSet or addNodeSet. If the set was conditioned, the countings correspond to the target variables and the conditioning variables. If you wish to get only the countings for the conditioning variables, prefer using method countConditioning.

protectednoexceptinherited 
returns the set of target + conditioning nodes
conditioning nodes are always the first ones in the vector and targets are the last ones

protectednoexceptinherited 
returns all the sets of target + cond nodes, and their counting indices
conditioning nodes are always the first ones in the vector and targets are the last ones

protected 
returns the apriori vector for a conditioning set

protectedinherited 
returns the counting vector for a conditioning set

protectednoexceptinherited 
returns the conditioning nodes (nullptr if there are no such nodes)

protectednoexceptinherited 
returns all the sets of conditioning nodes

protectednoexceptinherited 
returns all the countings performed (both targets and conditioned)
this method returns the countings of the record counter. It should be used in conjunction with methods _getConditioningNodes () and _getTargetNodes () that indicate, for each nodeset, the index of the corresponding counting in the vector returned by _getCounts ().

protected 
if needed insert the score apriori into the countings

inherited 
adds an empty set of variables to count
Idx gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::addNodeSet  (  Idx  var  ) 
add a new CPT with a single variable to be estimated
var  represents the index of the variable in the filtered rows produced by the database cell filters whose observations shall be counted 
Idx gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::addNodeSet  (  Idx  var, 
const std::vector< Idx > &  conditioning_ids  
) 
add a new target variable plus some conditioning vars
var  represents the index of the target variable in the filtered rows produced by the database cell filters 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows 

inherited 
add a new target node conditioned by another node to be counted
var1  represents the index of the target variable in the filtered rows produced by the database cell filters 
var2  represents the index of the conditioning variable in the filtered rows produced by the database cell filters 

inherited 
add a new target node conditioned by another node to be counted
vars  contains the index of the target variable (first) in the filtered rows produced by the database cell filters, and the index of the conditioning variable (second). 

inherited 
add a new target variable plus some conditioning vars
var  represents the index of the target variable in the filtered rows produced by the database cell filters 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows 

inherited 
add a target conditioned by other variables to be counted
var1  represents the index of the target variable in the filtered rows produced by the database cell filters 
var2  represents the index of the last conditioning variable in the filtered rows produced by the database cell filters 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows (minus var2, which is subsequently apended to it). 

inherited 
add a target conditioned by other variables to be counted
var1  represents the index of the target variable in the filtered rows produced by the database cell filters 
var2  represents the index of the last conditioning variable in the filtered rows produced by the database cell filters 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows (minus var2, which is subsequently apended to it). 

inherited 
add a target conditioned by other variables to be counted
vars  represents the index of the target variable (first) in the filtered rows produced by the database cell filters, and the index of the last conditioning variable (second) 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows (minus vars.second which is appended to it) 

inherited 
add a target conditioned by other variables to be counted
vars  represents the index of the target variable (first) in the filtered rows produced by the database cell filters, and the index of the last conditioning variable (second) 
conditioning_ids  the indices of the variables of the conditioning set in the filtered rows (minus vars.second which is appended to it) 
void gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::clear  (  ) 
clears all the data structures from memory

pure virtual 
virtual copy factory
Implemented in gum::learning::ParamEstimatorML< IdSetAlloc, CountAlloc >.

noexceptinherited 
returns the modalities of the variables

privatedelete 
prevent copy operator

pure virtual 
returns the CPT's parameters corresponding to a given nodeset
The vector contains the parameters of an ndimensional CPT. The distribution of the dimensions of the CPT within the vector is as follows: first, there are the conditioning nodes (in the order in which they were specified) and, then, the target node.
Implemented in gum::learning::ParamEstimatorML< IdSetAlloc, CountAlloc >.

noexceptinherited 
sets the maximum number of threads used to perform countings
void gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::setParameters  (  Idx  nodeset_index, 
Potential< double > &  pot  
) 
sets the CPT's parameters corresponding to a given nodeset
The order of the variables in the potential and in the nodeset are assumed to be identical
void gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::setParameters  (  Idx  nodeset_index, 
Potential< GUM_SCALAR > &  pot  
) 
sets the CPT's parameters corresponding to a given nodeset
The order of the variables in the potential and in the nodeset are assumed to be identical
void gum::learning::ParamEstimator< IdSetAlloc, CountAlloc >::setRange  (  Size  min_range, 
Size  max_range  
) 
sets the range of records taken into account by the counter
min_range  he number of the first record to be taken into account during learning 
max_range  the number of the record after the last one taken into account 

protectedinherited 

private 
has the a priori been computed
Definition at line 241 of file paramEstimator.h.

private 
has the score's internal apriori been inserted into the countings ?
Definition at line 244 of file paramEstimator.h.

protected 
the a priori used by the score
Definition at line 177 of file paramEstimator.h.

protectedinherited 

protectedinherited 

protected 
indicate whether we have already normalized the parameters
Definition at line 183 of file paramEstimator.h.

protectedinherited 

protectedinherited 

protected 
the score that was use for structure learning (used for its apriori)
Definition at line 180 of file paramEstimator.h.

protectedinherited 