Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::ConditionalStatsCollector Class Reference

#include <ConditionalStatsCollector.h>

Inheritance diagram for PLearn::ConditionalStatsCollector:

Inheritance graph
[legend]
Collaboration diagram for PLearn::ConditionalStatsCollector:

Collaboration graph
[legend]
List of all members.

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< RealMappingranges
 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.


Member Typedef Documentation

typedef Object PLearn::ConditionalStatsCollector::inherited
 

Reimplemented from PLearn::Object.

Definition at line 57 of file ConditionalStatsCollector.h.

Referenced by ConditionalStatsCollector().


Constructor & Destructor Documentation

PLearn::ConditionalStatsCollector::ConditionalStatsCollector  ) 
 

Definition at line 49 of file ConditionalStatsCollector.cc.

References inherited.


Member Function Documentation

void PLearn::ConditionalStatsCollector::build  )  [virtual]
 

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_().

void PLearn::ConditionalStatsCollector::build_  )  [private]
 

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().

void PLearn::ConditionalStatsCollector::declareOptions OptionList ol  )  [static, protected]
 

Declares this class' options.

Reimplemented from PLearn::Object.

Definition at line 56 of file ConditionalStatsCollector.cc.

References PLearn::declareOption(), and PLearn::OptionList.

int PLearn::ConditionalStatsCollector::findrange int  varindex,
real  val
const [protected]
 

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().

void PLearn::ConditionalStatsCollector::forget  ) 
 

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().

void PLearn::ConditionalStatsCollector::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

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.

PLearn::ConditionalStatsCollector::PLEARN_DECLARE_OBJECT ConditionalStatsCollector   ) 
 

void PLearn::ConditionalStatsCollector::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.

Definition at line 149 of file ConditionalStatsCollector.cc.

References condvar, forget(), and ranges.

void PLearn::ConditionalStatsCollector::update const Vec v,
real  weight = 1.0
 

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.


Member Data Documentation

int PLearn::ConditionalStatsCollector::condvar
 

index of conditioning variable

Definition at line 74 of file ConditionalStatsCollector.h.

Referenced by setBinMappingsAndCondvar(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

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().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 111 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 115 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 103 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 107 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec<RealMapping> PLearn::ConditionalStatsCollector::ranges
 

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().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 87 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 91 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 95 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().

TVec< TMat<double> > PLearn::ConditionalStatsCollector::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.

Definition at line 99 of file ConditionalStatsCollector.h.

Referenced by forget(), makeDeepCopyFromShallowCopy(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:49 2004 for PLearn by doxygen 1.3.7