PLearn 0.1
Public Member Functions | Public Attributes
PLearn::VarMeasurer Class Reference

#include <VarMeasurer.h>

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

List of all members.

Public Member Functions

 VarMeasurer (Var the_v, int the_every, const string &the_filename, const string &the_onscreen_prompt="")
virtual bool measure (int t, const Vec &costs)

Public Attributes

Var v
int every
string filename
ofstream out
string onscreen_prompt

Detailed Description

Definition at line 53 of file VarMeasurer.h.


Constructor & Destructor Documentation

PLearn::VarMeasurer::VarMeasurer ( Var  the_v,
int  the_every,
const string &  the_filename,
const string &  the_onscreen_prompt = "" 
) [inline]

Definition at line 64 of file VarMeasurer.h.

        :v(the_v), every(the_every), filename(the_filename), onscreen_prompt(the_onscreen_prompt)
    { 
        if (filename.size() != 0)
            out.open(filename.c_str());
    }

Member Function Documentation

bool PLearn::VarMeasurer::measure ( int  t,
const Vec costs 
) [virtual]

This method is called at iteration t of a training algorithm, and it can monitor the cost values given the costs vector. The returned value indicates whether training should be stopped (by default shoudl be false).

Reimplemented from PLearn::Measurer.

Definition at line 45 of file VarMeasurer.cc.

References PLearn::endl(), and i.

{
    if (t%every == 0)
    {
        if (out)
        {
            out << t << ' ';
            for (int i=0; i<v->length(); i++)
                out << v->value[i] << ' ';
            out << endl;
        }
        if (onscreen_prompt.size() != 0)
        {
            cout << t << ": " << onscreen_prompt << " ";
            for (int i=0; i<v->length(); i++)
                cout << v->value[i] << ' ';
            cout << endl;
        }
    }
    return false;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 57 of file VarMeasurer.h.

Definition at line 58 of file VarMeasurer.h.

Definition at line 60 of file VarMeasurer.h.

Definition at line 59 of file VarMeasurer.h.

Definition at line 56 of file VarMeasurer.h.


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