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

PLearn::SharpeRatioStatsIterator Class Reference

#include <StatsIterator.h>

Inheritance diagram for PLearn::SharpeRatioStatsIterator:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual string info () const
 returns a bit more informative string about object (default returns classname())

virtual void init (int inputsize)
 Call this method once with the correct inputsize.

virtual void update (const Vec &input)
 Then iterate over the data set and call this method for each row.

virtual bool finish ()
 PLEARN_DECLARE_OBJECT (SharpeRatioStatsIterator)
virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
virtual void oldwrite (ostream &out) const
virtual void oldread (istream &in)
 DEPRECATED For backward compatibility with old saved object.


Static Protected Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Protected Attributes

Vec nnonzero
Vec meansquared
Vec mean

Private Types

typedef StatsIterator inherited

Detailed Description

Compute the Sharpe ratio = mean(profit) / stdev(profit) where profit is assumed to be the "cost" given in input. Note that the mean and stdev are only computed over the instances where profit!=0 (because these represent the actual transactions that occured).

Definition at line 217 of file StatsIterator.h.


Member Typedef Documentation

typedef StatsIterator PLearn::SharpeRatioStatsIterator::inherited [private]
 

Reimplemented from PLearn::StatsIterator.

Definition at line 219 of file StatsIterator.h.


Member Function Documentation

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

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::StatsIterator.

Definition at line 387 of file StatsIterator.cc.

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

bool PLearn::SharpeRatioStatsIterator::finish  )  [virtual]
 

Call this method when all the data has been shown (through update) If the method returns false, then a further pass through the data is required.

Implements PLearn::StatsIterator.

Definition at line 378 of file StatsIterator.cc.

References mean, meansquared, nnonzero, PLearn::sqrt(), and PLearn::squareSubtract().

virtual string PLearn::SharpeRatioStatsIterator::info  )  const [inline, virtual]
 

returns a bit more informative string about object (default returns classname())

Reimplemented from PLearn::Object.

Definition at line 227 of file StatsIterator.h.

void PLearn::SharpeRatioStatsIterator::init int  inputsize  )  [virtual]
 

Call this method once with the correct inputsize.

Implements PLearn::StatsIterator.

Definition at line 357 of file StatsIterator.cc.

References mean, meansquared, nnonzero, and PLearn::Vec.

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

Reimplemented from PLearn::StatsIterator.

Definition at line 350 of file StatsIterator.cc.

References PLearn::deepCopyField(), mean, and meansquared.

void PLearn::SharpeRatioStatsIterator::oldread istream &  in  )  [virtual]
 

DEPRECATED For backward compatibility with old saved object.

Reimplemented from PLearn::StatsIterator.

Definition at line 411 of file StatsIterator.cc.

References mean, meansquared, nnonzero, PLearn::readField(), PLearn::readFooter(), and PLearn::readHeader().

void PLearn::SharpeRatioStatsIterator::oldwrite ostream &  out  )  const [virtual]
 

Reimplemented from PLearn::StatsIterator.

Definition at line 401 of file StatsIterator.cc.

References mean, meansquared, nnonzero, PLearn::writeField(), PLearn::writeFooter(), and PLearn::writeHeader().

PLearn::SharpeRatioStatsIterator::PLEARN_DECLARE_OBJECT SharpeRatioStatsIterator   ) 
 

void PLearn::SharpeRatioStatsIterator::update const Vec input  )  [virtual]
 

Then iterate over the data set and call this method for each row.

Implements PLearn::StatsIterator.

Definition at line 366 of file StatsIterator.cc.

References PLearn::TVec< T >::length(), mean, meansquared, and nnonzero.


Member Data Documentation

Vec PLearn::SharpeRatioStatsIterator::mean [protected]
 

Definition at line 224 of file StatsIterator.h.

Referenced by finish(), init(), makeDeepCopyFromShallowCopy(), oldread(), oldwrite(), and update().

Vec PLearn::SharpeRatioStatsIterator::meansquared [protected]
 

Definition at line 223 of file StatsIterator.h.

Referenced by finish(), init(), makeDeepCopyFromShallowCopy(), oldread(), oldwrite(), and update().

Vec PLearn::SharpeRatioStatsIterator::nnonzero [protected]
 

Definition at line 222 of file StatsIterator.h.

Referenced by finish(), init(), oldread(), oldwrite(), and update().


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