PLearn 0.1
Public Member Functions | Public Attributes | Private Member Functions
PLearn::StatSpec Class Reference

The specification of a statistic to compute (as can be specified as a string in PTester) More...

#include <PTester.h>

Collaboration diagram for PLearn::StatSpec:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StatSpec ()
void init (const string &statname, PP< PLearner > learner)
string intStatName ()
string statName ()
 StatSpec ()
void init (const string &statname)
string statName ()

Public Attributes

string extstat
string intstat
 "external" stat, to be computed over splits
string setname
 "internal" stat to be computed over examples the given a train or test set of a split
int setnum
 "train" or "test1" or "test2" ...
string costname
 data set on which to compute stat: 0 :train, 1: test1, ...
int costindex
 the name of the cost we are interested in.
string intstatname
 data set on which to compute stat: 0 :train, 1: test1, ...

Private Member Functions

void parseStatname (const string &statname)
 will determine extstat, intstat, setnum and costname from statname
void parseStatname (const string &statname)
 will determine extstat, intstat, setnum and costname from statname

Detailed Description

The specification of a statistic to compute (as can be specified as a string in PTester)

Definition at line 165 of file PExperiment.cc.


Constructor & Destructor Documentation

PLearn::StatSpec::StatSpec ( ) [inline]

Definition at line 175 of file PExperiment.cc.

        : setnum(-1), costindex(-1)
    {}
PLearn::StatSpec::StatSpec ( ) [inline]

Definition at line 241 of file PTester.h.

: setnum(-1) {}

Member Function Documentation

void PLearn::StatSpec::init ( const string &  statname,
PP< PLearner learner 
)

Definition at line 197 of file PExperiment.cc.

References costindex, costname, parseStatname(), and setnum.

{
    parseStatname(statname);
    if(setnum==0)
        costindex = learner->getTrainCostIndex(costname);
    else
        costindex = learner->getTestCostIndex(costname);
}

Here is the call graph for this function:

void PLearn::StatSpec::init ( const string &  statname)

Definition at line 972 of file PTester.cc.

{
    parseStatname(statname);
}
string PLearn::StatSpec::intStatName ( ) [inline]

Definition at line 181 of file PExperiment.cc.

References costname, intstat, and setname.

Referenced by statName().

    { return intstat + "[" + setname + "." + costname + "]"; }

Here is the caller graph for this function:

void PLearn::StatSpec::parseStatname ( const string &  statname) [private]

will determine extstat, intstat, setnum and costname from statname

Definition at line 206 of file PExperiment.cc.

References costname, extstat, intstat, PLERROR, PLearn::removeallblanks(), setname, setnum, PLearn::split(), PLearn::split_on_first(), and PLearn::toint().

Referenced by init().

{
    vector<string> tokens = split(removeallblanks(statname), "[]");
    string set_and_cost;
  
    if(tokens.size()==2)
    {
        extstat = "E";
        intstat = tokens[0];
        set_and_cost = tokens[1];
    }
    else if(tokens.size()==3)
    {
        extstat = tokens[0];
        intstat = tokens[1];
        set_and_cost = tokens[2];
    }
    else
        PLERROR("In parse_statname: parse error for %s",statname.c_str());

    if(set_and_cost.length()<5)
        PLERROR("In parse_statname: parse error for %s",statname.c_str());

    split_on_first(set_and_cost,".", setname, costname);
  
    if(setname=="train")
        setnum = 0;
    else if(setname=="test")
        setnum = 1;
    else if(setname.substr(0,4)=="test")
    {
        setnum = toint(setname.substr(4));
        if(setnum==0)
            PLERROR("In parse_statname: use the name train instead of test0.\n"
                    "The first set of a split is the training set. The following are test sets named test1 test2 ..."); 
        if(setnum<=0)
            PLERROR("In parse_statname: parse error for %s",statname.c_str());        
    }
    else
        PLERROR("In parse_statname: parse error for %s",statname.c_str());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::StatSpec::parseStatname ( const string &  statname) [private]

will determine extstat, intstat, setnum and costname from statname

string PLearn::StatSpec::statName ( ) [inline]

Definition at line 245 of file PTester.h.

    { return extstat + "[" + setname + "." + intstatname + "]"; }
string PLearn::StatSpec::statName ( ) [inline]

Definition at line 185 of file PExperiment.cc.

References extstat, and intStatName().

    { return extstat + "[" + intStatName() + "]"; }

Here is the call graph for this function:


Member Data Documentation

the name of the cost we are interested in.

Definition at line 173 of file PExperiment.cc.

Referenced by init(), and PLearn::PTester::perform().

data set on which to compute stat: 0 :train, 1: test1, ...

Definition at line 172 of file PExperiment.cc.

Referenced by init(), intStatName(), and parseStatname().

Definition at line 168 of file PExperiment.cc.

Referenced by parseStatname(), and statName().

"external" stat, to be computed over splits

Definition at line 169 of file PExperiment.cc.

Referenced by intStatName(), parseStatname(), and PLearn::PTester::perform().

data set on which to compute stat: 0 :train, 1: test1, ...

"internal" stat to be computed over examples the given a train or test set of a split. Ex.: "E[costname]" This string will at some point be used to call the VecStatsCollector's getStat(...) method.

Definition at line 239 of file PTester.h.

Referenced by PLearn::PTester::perform1Split(), and PLearn::SequentialValidation::run().

"internal" stat to be computed over examples the given a train or test set of a split

"external" stat, to be computed over splits

Definition at line 170 of file PExperiment.cc.

Referenced by intStatName(), and parseStatname().

"train" or "test1" or "test2" ...

Definition at line 171 of file PExperiment.cc.

Referenced by init(), parseStatname(), PLearn::PTester::perform(), PLearn::PTester::perform1Split(), and PLearn::SequentialValidation::run().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines