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

PLearn::LiftStatsCollector Class Reference

#include <LiftStatsCollector.h>

Inheritance diagram for PLearn::LiftStatsCollector:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef VecStatsCollector inherited

Public Member Functions

 LiftStatsCollector ()
virtual void forget ()
 clears all previously accumulated statistics

virtual void update (const Vec &x, real weight=1.0)
 updates the statistics when seeing x The weight applies to all elements of x

virtual void finalize ()
 This finalize override makes sure only the n_samples_to_keep samples from the matrix n_first_updates with the highest output are left.

virtual double getStat (const string &statspec)
 In addition to the regular VecStatsCollector statistics, we understand specific lift statistics (see the .cc).

 PLEARN_DECLARE_OBJECT (LiftStatsCollector)
virtual void build ()
 simply calls inherited::build() then build_()

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.


Public Attributes

real lift_fraction
int opposite_lift
string output_column
int sign_trick
int target_column
int verbosity

Protected Member Functions

real computeLift ()
 Return the LIFT statistic.

real computeLiftMax ()
 Return the LIFT_MAX statistic.


Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Protected Attributes

int count_fin
Mat n_first_updates
 Matrix storing the output and target of the samples with highest output, as well as all the other data retrieved since the last call to finalize.

bool is_finalized
 Set to true after each call to finalize().

int nstored
 Number of examples stored in the n_first_updates matrix.

int nsamples
 Number of samples seen.

int npos
 Number of positive examples that are not retained in the ones with the highest output (that is to say the ones in n_first_updates).

int n_samples_to_keep
 Number of examples to keep (nsamples * lift_fraction).

int output_column_index
 Index of the output column.


Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

typedef VecStatsCollector PLearn::LiftStatsCollector::inherited
 

Reimplemented from PLearn::VecStatsCollector.

Definition at line 57 of file LiftStatsCollector.h.

Referenced by LiftStatsCollector().


Constructor & Destructor Documentation

PLearn::LiftStatsCollector::LiftStatsCollector  ) 
 

Definition at line 53 of file LiftStatsCollector.cc.

References inherited.


Member Function Documentation

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

simply calls inherited::build() then build_()

Reimplemented from PLearn::VecStatsCollector.

Definition at line 133 of file LiftStatsCollector.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::VecStatsCollector.

Definition at line 142 of file LiftStatsCollector.cc.

References output_column, and output_column_index.

Referenced by build().

real PLearn::LiftStatsCollector::computeLift  )  [protected]
 

Return the LIFT statistic.

Definition at line 160 of file LiftStatsCollector.cc.

References PLearn::TMat< T >::column(), PLearn::endl(), finalize(), is_finalized, lift_fraction, n_first_updates, n_samples_to_keep, npos, nsamples, nstored, opposite_lift, output_column, sign_trick, PLearn::sum(), target_column, and verbosity.

Referenced by getStat().

real PLearn::LiftStatsCollector::computeLiftMax  )  [protected]
 

Return the LIFT_MAX statistic.

Definition at line 192 of file LiftStatsCollector.cc.

References PLearn::TMat< T >::column(), finalize(), is_finalized, MIN, n_first_updates, n_samples_to_keep, npos, nsamples, and PLearn::sum().

Referenced by getStat().

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

Declares this class' options.

Reimplemented from PLearn::VecStatsCollector.

Definition at line 98 of file LiftStatsCollector.cc.

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

void PLearn::LiftStatsCollector::finalize  )  [virtual]
 

This finalize override makes sure only the n_samples_to_keep samples from the matrix n_first_updates with the highest output are left.

Reimplemented from PLearn::VecStatsCollector.

Definition at line 207 of file LiftStatsCollector.cc.

References count_fin, PLearn::endl(), is_finalized, lift_fraction, n_first_updates, n_samples_to_keep, npos, nsamples, nstored, PLearn::TMat< T >::resize(), PLearn::selectAndOrder(), and verbosity.

Referenced by computeLift(), and computeLiftMax().

void PLearn::LiftStatsCollector::forget  )  [virtual]
 

clears all previously accumulated statistics

Reimplemented from PLearn::VecStatsCollector.

Definition at line 249 of file LiftStatsCollector.cc.

References count_fin, is_finalized, n_first_updates, npos, nsamples, nstored, and PLearn::TMat< T >::resize().

double PLearn::LiftStatsCollector::getStat const string statspec  )  [virtual]
 

In addition to the regular VecStatsCollector statistics, we understand specific lift statistics (see the .cc).

Reimplemented from PLearn::VecStatsCollector.

Definition at line 264 of file LiftStatsCollector.cc.

References computeLift(), computeLiftMax(), and PLearn::PStream::smartReadUntilNext().

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::VecStatsCollector.

Definition at line 282 of file LiftStatsCollector.cc.

References PLearn::deepCopyField(), and n_first_updates.

PLearn::LiftStatsCollector::PLEARN_DECLARE_OBJECT LiftStatsCollector   ) 
 

void PLearn::LiftStatsCollector::update const Vec x,
real  weight = 1.0
[virtual]
 

updates the statistics when seeing x The weight applies to all elements of x

Reimplemented from PLearn::VecStatsCollector.

Definition at line 291 of file LiftStatsCollector.cc.

References count_fin, PLearn::FABS(), is_finalized, PLearn::is_missing(), PLearn::TMat< T >::length(), MAX, n_first_updates, nsamples, nstored, output_column_index, PLERROR, PLWARNING, PLearn::TMat< T >::resize(), sign_trick, target_column, PLearn::Vec, and x.


Member Data Documentation

int PLearn::LiftStatsCollector::count_fin [protected]
 

Definition at line 63 of file LiftStatsCollector.h.

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

bool PLearn::LiftStatsCollector::is_finalized [protected]
 

Set to true after each call to finalize().

Definition at line 72 of file LiftStatsCollector.h.

Referenced by computeLift(), computeLiftMax(), finalize(), forget(), and update().

real PLearn::LiftStatsCollector::lift_fraction
 

Definition at line 96 of file LiftStatsCollector.h.

Referenced by computeLift(), and finalize().

Mat PLearn::LiftStatsCollector::n_first_updates [protected]
 

Matrix storing the output and target of the samples with highest output, as well as all the other data retrieved since the last call to finalize.

Definition at line 69 of file LiftStatsCollector.h.

Referenced by computeLift(), computeLiftMax(), finalize(), forget(), makeDeepCopyFromShallowCopy(), and update().

int PLearn::LiftStatsCollector::n_samples_to_keep [protected]
 

Number of examples to keep (nsamples * lift_fraction).

Definition at line 85 of file LiftStatsCollector.h.

Referenced by computeLift(), computeLiftMax(), and finalize().

int PLearn::LiftStatsCollector::npos [protected]
 

Number of positive examples that are not retained in the ones with the highest output (that is to say the ones in n_first_updates).

Definition at line 82 of file LiftStatsCollector.h.

Referenced by computeLift(), computeLiftMax(), finalize(), and forget().

int PLearn::LiftStatsCollector::nsamples [protected]
 

Number of samples seen.

Definition at line 78 of file LiftStatsCollector.h.

Referenced by computeLift(), computeLiftMax(), finalize(), forget(), and update().

int PLearn::LiftStatsCollector::nstored [protected]
 

Number of examples stored in the n_first_updates matrix.

Definition at line 75 of file LiftStatsCollector.h.

Referenced by computeLift(), finalize(), forget(), and update().

int PLearn::LiftStatsCollector::opposite_lift
 

Definition at line 97 of file LiftStatsCollector.h.

Referenced by computeLift().

string PLearn::LiftStatsCollector::output_column
 

Definition at line 98 of file LiftStatsCollector.h.

Referenced by build_(), and computeLift().

int PLearn::LiftStatsCollector::output_column_index [protected]
 

Index of the output column.

Definition at line 88 of file LiftStatsCollector.h.

Referenced by build_(), and update().

int PLearn::LiftStatsCollector::sign_trick
 

Definition at line 99 of file LiftStatsCollector.h.

Referenced by computeLift(), and update().

int PLearn::LiftStatsCollector::target_column
 

Definition at line 100 of file LiftStatsCollector.h.

Referenced by computeLift(), and update().

int PLearn::LiftStatsCollector::verbosity
 

Definition at line 101 of file LiftStatsCollector.h.

Referenced by computeLift(), and finalize().


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