PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <RegressorFromDistribution.h>
Public Member Functions | |
RegressorFromDistribution () | |
Default constructor. | |
virtual int | outputsize () const |
Returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options). | |
virtual void | forget () |
(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) and sets 'stage' back to 0 (this is the stage of a fresh learner!). | |
virtual void | train () |
The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process. | |
virtual void | computeOutput (const Vec &input, Vec &output) const |
Computes the output from the input. | |
virtual void | computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const |
Computes the costs from already computed output. | |
virtual TVec< std::string > | getTestCostNames () const |
Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method). | |
virtual TVec< std::string > | getTrainCostNames () const |
Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats. | |
virtual void | setTrainingSet (VMat training_set, bool call_forget=true) |
Overridden to forward to the underlying distribution. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual RegressorFromDistribution * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Finish building the object; just call inherited::build followed by build_() | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
PP< PDistribution > | distribution |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef PLearner | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
The first sentence should be a BRIEF DESCRIPTION of what the class does.
Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html
Definition at line 58 of file RegressorFromDistribution.h.
typedef PLearner PLearn::RegressorFromDistribution::inherited [private] |
Reimplemented from PLearn::PLearner.
Definition at line 60 of file RegressorFromDistribution.h.
PLearn::RegressorFromDistribution::RegressorFromDistribution | ( | ) |
string PLearn::RegressorFromDistribution::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
OptionList & PLearn::RegressorFromDistribution::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
RemoteMethodMap & PLearn::RegressorFromDistribution::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
Object * PLearn::RegressorFromDistribution::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 53 of file RegressorFromDistribution.cc.
StaticInitializer RegressorFromDistribution::_static_initializer_ & PLearn::RegressorFromDistribution::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
void PLearn::RegressorFromDistribution::build | ( | ) | [virtual] |
Finish building the object; just call inherited::build followed by build_()
Reimplemented from PLearn::PLearner.
Definition at line 75 of file RegressorFromDistribution.cc.
{ inherited::build(); build_(); }
void PLearn::RegressorFromDistribution::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::PLearner.
Definition at line 84 of file RegressorFromDistribution.cc.
{ }
string PLearn::RegressorFromDistribution::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file RegressorFromDistribution.cc.
void PLearn::RegressorFromDistribution::computeCostsFromOutputs | ( | const Vec & | input, |
const Vec & | output, | ||
const Vec & | target, | ||
Vec & | costs | ||
) | const [virtual] |
Computes the costs from already computed output.
Implements PLearn::PLearner.
Definition at line 142 of file RegressorFromDistribution.cc.
References PLearn::powdistance(), and PLearn::TVec< T >::resize().
{ costs.resize(1); costs[0] = powdistance(target, output); }
void PLearn::RegressorFromDistribution::computeOutput | ( | const Vec & | input, |
Vec & | output | ||
) | const [virtual] |
Computes the output from the input.
Reimplemented from PLearn::PLearner.
Definition at line 132 of file RegressorFromDistribution.cc.
References PLASSERT.
{ PLASSERT( distribution ); distribution->setPredictor(input); distribution->expectation(output); }
void PLearn::RegressorFromDistribution::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::PLearner.
Definition at line 61 of file RegressorFromDistribution.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), and distribution.
{ declareOption(ol, "distribution", &RegressorFromDistribution::distribution, OptionBase::buildoption, "The underlying (conditional) distribution. Its predictor and\n" "predicted sizes will be set automatically."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::RegressorFromDistribution::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::PLearner.
Definition at line 138 of file RegressorFromDistribution.h.
:
//##### Protected Options ###############################################
RegressorFromDistribution * PLearn::RegressorFromDistribution::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::PLearner.
Definition at line 53 of file RegressorFromDistribution.cc.
void PLearn::RegressorFromDistribution::forget | ( | ) | [virtual] |
(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) and sets 'stage' back to 0 (this is the stage of a fresh learner!).
Reimplemented from PLearn::PLearner.
Definition at line 111 of file RegressorFromDistribution.cc.
{ inherited::forget(); if (distribution) distribution->forget(); }
OptionList & PLearn::RegressorFromDistribution::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file RegressorFromDistribution.cc.
OptionMap & PLearn::RegressorFromDistribution::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file RegressorFromDistribution.cc.
RemoteMethodMap & PLearn::RegressorFromDistribution::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file RegressorFromDistribution.cc.
TVec< string > PLearn::RegressorFromDistribution::getTestCostNames | ( | ) | const [virtual] |
Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).
Implements PLearn::PLearner.
Definition at line 153 of file RegressorFromDistribution.cc.
References PLearn::TVec< T >::append(), and PLearn::TVec< T >::isEmpty().
{ static TVec<string> test_costs; if (test_costs.isEmpty()) test_costs.append("mse"); return test_costs; }
TVec< string > PLearn::RegressorFromDistribution::getTrainCostNames | ( | ) | const [virtual] |
Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.
Implements PLearn::PLearner.
Definition at line 164 of file RegressorFromDistribution.cc.
{ static TVec<string> no_train_cost; return no_train_cost; }
void PLearn::RegressorFromDistribution::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::PLearner.
Definition at line 91 of file RegressorFromDistribution.cc.
References PLearn::deepCopyField().
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(distribution, copies); }
int PLearn::RegressorFromDistribution::outputsize | ( | ) | const [virtual] |
Returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options).
Implements PLearn::PLearner.
Definition at line 100 of file RegressorFromDistribution.cc.
{ if (!distribution) return -1; else return distribution->getNPredicted(); }
void PLearn::RegressorFromDistribution::setTrainingSet | ( | VMat | training_set, |
bool | call_forget = true |
||
) | [virtual] |
Overridden to forward to the underlying distribution.
Reimplemented from PLearn::PLearner.
Definition at line 173 of file RegressorFromDistribution.cc.
References PLASSERT.
{ inherited::setTrainingSet(training_set, call_forget); PLASSERT( training_set->inputsize() >= 0 && training_set->targetsize() >= 1 ); // Create a dataset whose input part is the concatenation of the input and // target parts of the training set. VMat all_input_trainset = new ForwardVMatrix(training_set); all_input_trainset->build(); all_input_trainset->defineSizes(training_set->inputsize() + training_set->targetsize(), 0, training_set->weightsize(), training_set->extrasize()); PLASSERT( distribution ); // Note that 'call_forget' is set to false in the following call, because // if it was true, then distribution->forget() would have already been // called in this->forget(). distribution->setTrainingSet(all_input_trainset, false); // Set sizes for the underlying distribution. distribution->setPredictorPredictedSizes(training_set->inputsize(), training_set->targetsize()); }
void PLearn::RegressorFromDistribution::train | ( | ) | [virtual] |
The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process.
Implements PLearn::PLearner.
Definition at line 121 of file RegressorFromDistribution.cc.
References PLERROR.
{ if (!distribution) PLERROR("In RegressorFromDistribution::train - You need to specify a " "distribution before calling the train() method"); distribution->train(); }
Reimplemented from PLearn::PLearner.
Definition at line 138 of file RegressorFromDistribution.h.
Definition at line 65 of file RegressorFromDistribution.h.
Referenced by declareOptions().