Darwin
1.10(beta)
|
Implements a class for accumulating conditional first- and second-order sufficient statistics. More...
Public Member Functions | |
drwnCondSuffStats (int n=1, int k=2, drwnPairSuffStatsType pairStats=DRWN_PSS_FULL) | |
construct a sufficient statistic object of dimensionality n with k conditional states | |
drwnCondSuffStats (const drwnCondSuffStats &condStats) | |
copy constructor | |
void | clear () |
clear the conditional sufficient statistics | |
void | clear (int n, int k, drwnPairSuffStatsType pairStats=DRWN_PSS_FULL) |
clear the conditional sufficient statistics and re-initialize to dimensionality n with k conditional states | |
int | size () const |
return the number of dimensions | |
int | states () const |
return the number of conditional states | |
double | count () const |
return the total weight of samples accumulated | |
double | count (int k) const |
return the weight of samples accumulated for the k-th state | |
drwnSuffStats const & | suffStats (int k) const |
return the sufficient statistics for the k-th state | |
const char * | type () const |
returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
drwnCondSuffStats * | clone () const |
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
bool | save (drwnXMLNode &xml) const |
write object to XML node (see also write) | |
bool | load (drwnXMLNode &xml) |
read object from XML node (see also read) | |
void | accumulate (const vector< double > &x, int y) |
add a single sample to the sufficient statistics for state y | |
void | accumulate (const vector< double > &x, int y, double w) |
add a single weighted sample to the sufficient statistics for state y | |
void | accumulate (const vector< vector< double > > &x, int y, double w=1.0) |
add a number of samples to the sufficient statistics for state y | |
void | accumulate (const vector< vector< double > > &x, const vector< int > &y) |
add a number of samples to the sufficient statistics for states y | |
void | accumulate (const vector< vector< double > > &x, const vector< int > &y, const vector< double > &w) |
add a number of weighted samples to the sufficient statistics for states y | |
void | accumulate (const drwnSuffStats &stats, int y, double w=1.0) |
add previously accumulated sufficient statistics to the sufficient statistics for state y | |
void | subtract (const vector< double > &x, int y) |
remove a single sample from the sufficient statistics for state y | |
void | subtract (const vector< double > &x, int y, double w) |
remove a single weighted sample from the sufficient statistics for state y | |
void | subtract (const vector< vector< double > > &x, int y, double w=1.0) |
remove a number of samples from the sufficient statistics for state y | |
void | subtract (const vector< vector< double > > &x, const vector< int > &y) |
remove a number of samples from the sufficient statistics for states y | |
void | subtract (const vector< vector< double > > &x, const vector< int > &y, const vector< double > &w) |
remove a number of weighted samples from the sufficient statistics for states y | |
void | subtract (const drwnSuffStats &stats, int y, double w=1.0) |
remove previously accumulated sufficient statistics from the sufficient statistics for state y | |
void | redistribute (int y, int k) |
redistribute the counts from state y to state k | |
const drwnSuffStats & | operator[] (unsigned k) const |
copy constructor | |
![]() | |
bool | write (const char *filename) const |
write object to file (calls save) | |
bool | read (const char *filename) |
read object from file (calls load) | |
void | dump () const |
print object's current state to standard output (for debugging) | |
Implements a class for accumulating conditional first- and second-order sufficient statistics.
Calling the function accumulate
member function will perform the following updates
count
= count + sum
= sum + sum2
= sum2 + Calling the function subtract
member function will perform the following updates
count
= count - sum
= sum - sum2
= sum2 - count
must remain non-negative.