PLearn 0.1
|
VMatrix that takes several experiment split_stats.pmat to extract the split statistics and perform validation. More...
#include <SplitWiseValidationVMatrix.h>
Public Member Functions | |
SplitWiseValidationVMatrix () | |
Default constructor. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual SplitWiseValidationVMatrix * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
RowBufferedVMatrix. | |
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 | |
TVec< PPath > | split_stats_ppaths |
PPath of the experiment split_stats.pmat. | |
int | validation_error_column |
Index of the validation error statistic column. | |
int | nsplits |
Number of splits to consider, starting from the first one. | |
bool | add_column_average |
Indication that the average of the columns should be added. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
Fill the vector 'v' with the content of the i-th row. | |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Protected Attributes | |
Mat | data |
Contains all information about this VMatrix. | |
Private Types | |
typedef RowBufferedVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
VMatrix that takes several experiment split_stats.pmat to extract the split statistics and perform validation.
It looks at the validation error, selects the best experiment and only report the associated statistics, for each split.
Definition at line 53 of file SplitWiseValidationVMatrix.h.
typedef RowBufferedVMatrix PLearn::SplitWiseValidationVMatrix::inherited [private] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 55 of file SplitWiseValidationVMatrix.h.
PLearn::SplitWiseValidationVMatrix::SplitWiseValidationVMatrix | ( | ) |
Default constructor.
Definition at line 55 of file SplitWiseValidationVMatrix.cc.
: validation_error_column(-1), add_column_average(false) {}
string PLearn::SplitWiseValidationVMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
OptionList & PLearn::SplitWiseValidationVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
RemoteMethodMap & PLearn::SplitWiseValidationVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
Object * PLearn::SplitWiseValidationVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
StaticInitializer SplitWiseValidationVMatrix::_static_initializer_ & PLearn::SplitWiseValidationVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
void PLearn::SplitWiseValidationVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::VMatrix.
Definition at line 134 of file SplitWiseValidationVMatrix.cc.
References PLearn::VMatrix::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::SplitWiseValidationVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::VMatrix.
Definition at line 85 of file SplitWiseValidationVMatrix.cc.
References add_column_average, data, PLearn::VMatrix::fill(), PLearn::TMat< T >::fill(), PLearn::getDataSet(), i, j, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), PLearn::VMatrix::length_, nsplits, PLERROR, PLWARNING, PLearn::TMat< T >::resize(), split_stats_ppaths, PLearn::VMat::toMat(), PLearn::VMatrix::updateMtime(), validation_error_column, PLearn::TMat< T >::width(), and PLearn::VMatrix::width_.
Referenced by build().
{ if(validation_error_column < 0) PLERROR("In SplitWiseValidationVMatrix::build_(): validation_error_column cannot be < 0"); if(split_stats_ppaths.length() == 0) PLERROR("In SplitWiseValidationVMatrix::build_(): split_stats_ppaths is empty"); TVec<Mat> stats(split_stats_ppaths.length()); Mat stats_i; for(int i=0; i<stats.length(); i++) { VMat v = getDataSet(split_stats_ppaths[i]); updateMtime(v); stats_i = v->toMat(); if(i==0) { if(nsplits<0) nsplits = stats_i.length(); data.resize(nsplits,stats_i.width()); data.fill(REAL_MAX); } if(stats_i.length() <nsplits) { PLWARNING("In SplitWiseValidationVMatrix::build_(): split_stats_ppaths[%d]=%s does not have enough splits, it will be ignored", i, split_stats_ppaths[i].c_str()); continue; } for(int j=0; j<nsplits; j++) { if(data(j,validation_error_column) > stats_i(j,validation_error_column)) data(j) << stats_i(j); } } length_ = data.length(); width_ = data.width(); if(add_column_average) { data.resize(data.length()+1, data.width()); data(data.length()-1).fill(0); length_++; for(int i=0; i<data.width(); i++) { for(int j=0; j<data.length()-1; j++) data(data.length()-1,i) += data(j,i); data(data.length()-1,i) = data(data.length()-1,i)/(data.length()-1); } } }
string PLearn::SplitWiseValidationVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
void PLearn::SplitWiseValidationVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::VMatrix.
Definition at line 64 of file SplitWiseValidationVMatrix.cc.
References add_column_average, PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), nsplits, split_stats_ppaths, and validation_error_column.
{ declareOption(ol, "split_stats_ppaths", &SplitWiseValidationVMatrix::split_stats_ppaths, OptionBase::buildoption, "Help text describing this option"); declareOption(ol, "validation_error_column", &SplitWiseValidationVMatrix::validation_error_column, OptionBase::buildoption, "Index of the validation error statistic column"); declareOption(ol, "nsplits", &SplitWiseValidationVMatrix::nsplits, OptionBase::buildoption, "Number of splits to consider, starting from the first one.\n" "If < 0, then all splits are considered (based on the number\n" "of splits of the first expdir)."); declareOption(ol, "add_column_average", &SplitWiseValidationVMatrix::add_column_average, OptionBase::buildoption, "Indication that the average of the columns should be added."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::SplitWiseValidationVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 81 of file SplitWiseValidationVMatrix.h.
:
//##### Protected Options ###############################################
SplitWiseValidationVMatrix * PLearn::SplitWiseValidationVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
void PLearn::SplitWiseValidationVMatrix::getNewRow | ( | int | i, |
const Vec & | v | ||
) | const [protected, virtual] |
Fill the vector 'v' with the content of the i-th row.
'v' is assumed to be the right size.
Implements PLearn::RowBufferedVMatrix.
Definition at line 59 of file SplitWiseValidationVMatrix.cc.
References data.
{ v << data(i); }
OptionList & PLearn::SplitWiseValidationVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
OptionMap & PLearn::SplitWiseValidationVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
RemoteMethodMap & PLearn::SplitWiseValidationVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 53 of file SplitWiseValidationVMatrix.cc.
void PLearn::SplitWiseValidationVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 140 of file SplitWiseValidationVMatrix.cc.
References data, PLearn::deepCopyField(), PLearn::RowBufferedVMatrix::makeDeepCopyFromShallowCopy(), and split_stats_ppaths.
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(split_stats_ppaths, copies); deepCopyField(data, copies); //PLERROR("SplitWiseValidationVMatrix::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 81 of file SplitWiseValidationVMatrix.h.
Indication that the average of the columns should be added.
Definition at line 70 of file SplitWiseValidationVMatrix.h.
Referenced by build_(), and declareOptions().
Mat PLearn::SplitWiseValidationVMatrix::data [protected] |
Contains all information about this VMatrix.
Definition at line 93 of file SplitWiseValidationVMatrix.h.
Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy().
Number of splits to consider, starting from the first one.
Definition at line 67 of file SplitWiseValidationVMatrix.h.
Referenced by build_(), and declareOptions().
PPath of the experiment split_stats.pmat.
Definition at line 61 of file SplitWiseValidationVMatrix.h.
Referenced by build_(), declareOptions(), and makeDeepCopyFromShallowCopy().
Index of the validation error statistic column.
Definition at line 64 of file SplitWiseValidationVMatrix.h.
Referenced by build_(), and declareOptions().