#include <ConditionalStatsCollector.h>
Inheritance diagram for PLearn::ConditionalStatsCollector:
Public Types | |
typedef Object | inherited |
Public Member Functions | |
ConditionalStatsCollector () | |
void | setBinMappingsAndCondvar (const TVec< RealMapping > &the_ranges, int the_condvar) |
Sets the ranges of interest for each variable, and the index of the conditioning variable. Ranges for a given variable should not overlap. | |
void | forget () |
clears all statistics, allowing to restart collecting them | |
void | update (const Vec &v, real weight=1.0) |
Updates the counts for an observation v. | |
PLEARN_DECLARE_OBJECT (ConditionalStatsCollector) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Transforms a shallow copy into a deep copy. | |
Public Attributes | |
int | condvar |
index of conditioning variable | |
TVec< RealMapping > | ranges |
ranges[k] must contain bin-mappings for variable k, which maps it to an integer ( 0 to mappings[k].size()-1 ) | |
TVec< TMat< double > > | counts |
counts[k](i,j) is the number of times the variable k fell in range i while variable condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | sums |
sums[k](i,j) contains the (possibly weighted) sum of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | sums_condvar |
sums_condvar[k](i,j) contains the (possibly weighted) sum of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | sumsquares |
sumsquares[k](i,j) contains the (possibly weighted) sum of squares of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | sumsquares_condvar |
sumsquares_condvar[k](i,j) contains the (possibly weighted) sum of squares of condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | minima |
minima[k](i,j) contains the min of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | minima_condvar |
minima_condvar[k](i,j) contains the min of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | maxima |
maxima[k](i,j) contains the max of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
TVec< TMat< double > > | maxima_condvar |
maxima_condvar[k](i,j) contains the max of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. | |
Protected Member Functions | |
int | findrange (int varindex, real val) const |
Returns the first index of the range containing the given value for that variable Returns ranges[varindex].length() if val==missing Returns -1 if no range containing val was found. | |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Member Functions | |
void | build_ () |
This does the actual building. |
|
Reimplemented from PLearn::Object. Definition at line 57 of file ConditionalStatsCollector.h. Referenced by ConditionalStatsCollector(). |
|
Definition at line 49 of file ConditionalStatsCollector.cc. References inherited. |
|
Should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object. Reimplemented from PLearn::Object. Definition at line 130 of file ConditionalStatsCollector.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::Object. Definition at line 123 of file ConditionalStatsCollector.cc. References counts, forget(), and PLearn::TVec< TMat< double > >::size(). Referenced by build(). |
|
Declares this class' options.
Reimplemented from PLearn::Object. Definition at line 56 of file ConditionalStatsCollector.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
Returns the first index of the range containing the given value for that variable Returns ranges[varindex].length() if val==missing Returns -1 if no range containing val was found.
Definition at line 156 of file ConditionalStatsCollector.cc. References PLearn::is_missing(), PLearn::RealMapping::length(), PLearn::RealMapping::map(), ranges, and val. Referenced by update(). |
|
clears all statistics, allowing to restart collecting them
Definition at line 136 of file ConditionalStatsCollector.cc. References counts, maxima, maxima_condvar, minima, minima_condvar, PLearn::TVec< TMat< double > >::resize(), sums, sums_condvar, sumsquares, and sumsquares_condvar. Referenced by build_(), and setBinMappingsAndCondvar(). |
|
Transforms a shallow copy into a deep copy.
Definition at line 262 of file ConditionalStatsCollector.cc. References counts, PLearn::deepCopyField(), maxima, maxima_condvar, minima, minima_condvar, ranges, sums, sums_condvar, sumsquares, and sumsquares_condvar. |
|
|
|
Sets the ranges of interest for each variable, and the index of the conditioning variable. Ranges for a given variable should not overlap.
Definition at line 149 of file ConditionalStatsCollector.cc. |
|
Updates the counts for an observation v.
Definition at line 184 of file ConditionalStatsCollector.cc. References condvar, counts, PLearn::TVec< TMat< double > >::fill(), findrange(), PLearn::is_missing(), k, PLearn::TVec< TMat< double > >::length(), PLearn::TVec< T >::length(), PLearn::TVec< RealMapping >::length(), maxima, maxima_condvar, minima, minima_condvar, PLERROR, PLWARNING, ranges, PLearn::TVec< TMat< double > >::resize(), PLearn::square(), sums, sums_condvar, sumsquares, sumsquares_condvar, val, and PLearn::Vec. |
|
index of conditioning variable
Definition at line 74 of file ConditionalStatsCollector.h. Referenced by setBinMappingsAndCondvar(), and update(). |
|
counts[k](i,j) is the number of times the variable k fell in range i while variable condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences. Actually counts is the "number of times" only when update is called without a weight. Otherwise it's really the sum of the sample weights. Definition at line 83 of file ConditionalStatsCollector.h. Referenced by build_(), forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
maxima[k](i,j) contains the max of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 111 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
maxima_condvar[k](i,j) contains the max of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 115 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
minima[k](i,j) contains the min of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 103 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
minima_condvar[k](i,j) contains the min of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 107 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
ranges[k] must contain bin-mappings for variable k, which maps it to an integer ( 0 to mappings[k].size()-1 )
Definition at line 77 of file ConditionalStatsCollector.h. Referenced by findrange(), makeDeepCopyFromShallowCopy(), setBinMappingsAndCondvar(), and update(). |
|
sums[k](i,j) contains the (possibly weighted) sum of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 87 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
sums_condvar[k](i,j) contains the (possibly weighted) sum of variable condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 91 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
sumsquares[k](i,j) contains the (possibly weighted) sum of squares of variable k's values that fell in range i while condvar was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 95 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |
|
sumsquares_condvar[k](i,j) contains the (possibly weighted) sum of squares of condvar's values that fell in range i while variable k was in range j counts[k] has one more row and column than there are mapping ranges: the last ones counting "MISSING_VALUE" occurences.
Definition at line 99 of file ConditionalStatsCollector.h. Referenced by forget(), makeDeepCopyFromShallowCopy(), and update(). |