PLearn 0.1
|
selects samples from a source matrix according to given vector of indices More...
#include <SelectRowsVMatrix.h>
Public Member Functions | |
SelectRowsVMatrix () | |
SelectRowsVMatrix (VMat the_source, TVec< int > the_indices, bool the_rows_to_remove=false, bool warn=true) | |
Also copies the original fieldinfos upon construction Here the indices will be shared for efficiency. | |
SelectRowsVMatrix (VMat the_source, Vec the_indices, bool the_rows_to_remove=false, bool warn=true) | |
Here the indices will be copied locally into an integer vector. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual SelectRowsVMatrix * | 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. | |
virtual real | get (int i, int j) const |
These methods are implemented by buffering calls to getNewRow. | |
virtual void | getSubRow (int i, int j, Vec v) const |
fills v with the subrow i laying between columns j (inclusive) and j+v.length() (exclusive) | |
virtual real | getStringVal (int col, const string &str) const |
Returns value associated with a string (or MISSING_VALUE if there's no association for this string). | |
virtual string | getValString (int col, real val) const |
Returns the string associated with value val for field# col. | |
virtual string | getString (int row, int col) const |
Returns element as a string, even if value doesn't map to a string, in which case tostring(value) is returned. | |
virtual const map< string, real > & | getStringToRealMapping (int col) const |
returns the whole string->value mapping | |
virtual const map< real, string > & | getRealToStringMapping (int col) const |
Returns the real->string mapping for column 'col'. | |
virtual void | reset_dimensions () |
In case the dimensions of an underlying VMat has changed, recompute it. | |
virtual real | dot (int i1, int i2, int inputsize) const |
Returns the dot product between row i1 and row i2 (considering only the inputsize first elements). | |
virtual real | dot (int i, const Vec &v) const |
Returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered). | |
virtual PP< Dictionary > | getDictionary (int col) const |
Return the Dictionary object for a certain field, or a null pointer if there isn't one. | |
virtual void | getValues (int row, int col, Vec &values) const |
Returns the possible values for a certain field in the VMatrix. | |
virtual void | getValues (const Vec &input, int col, Vec &values) const |
Returns the possible values of a certain field (column) given the input. | |
Static Public Member Functions | |
static string | _classname_ () |
SelectRowsVMatrix. | |
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 () |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Public Attributes | |
TVec< int > | indices |
Public build options. | |
bool | rows_to_remove |
Indication that the rows specified in indices or indices_vmat should be removed, not selected from the source VMatrix. | |
VMat | indices_vmat |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
void | getNewRow (int i, const Vec &v) const |
Must be implemented in subclasses: default version returns an error. | |
Protected Attributes | |
bool | obtained_inputsize_from_source |
Protected learnt options. | |
bool | obtained_targetsize_from_source |
bool | obtained_weightsize_from_source |
bool | obtained_extrasize_from_source |
bool | warn_if_all_rows_selected |
TVec< int > | selected_indices |
Private Types | |
typedef SourceVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
selects samples from a source matrix according to given vector of indices
Definition at line 55 of file SelectRowsVMatrix.h.
typedef SourceVMatrix PLearn::SelectRowsVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 60 of file SelectRowsVMatrix.h.
PLearn::SelectRowsVMatrix::SelectRowsVMatrix | ( | ) |
Definition at line 54 of file SelectRowsVMatrix.cc.
: obtained_inputsize_from_source(false), obtained_targetsize_from_source(false), obtained_weightsize_from_source(false), obtained_extrasize_from_source(false), warn_if_all_rows_selected(true), rows_to_remove(false) {}
PLearn::SelectRowsVMatrix::SelectRowsVMatrix | ( | VMat | the_source, |
TVec< int > | the_indices, | ||
bool | the_rows_to_remove = false , |
||
bool | warn = true |
||
) |
Also copies the original fieldinfos upon construction Here the indices will be shared for efficiency.
But you should not modify them afterwards!
Definition at line 63 of file SelectRowsVMatrix.cc.
References build_(), and PLearn::SourceVMatrix::source.
: obtained_inputsize_from_source(false), obtained_targetsize_from_source(false), obtained_weightsize_from_source(false), obtained_extrasize_from_source(false), warn_if_all_rows_selected(warn), indices(the_indices), rows_to_remove(the_rows_to_remove) { source = the_source; build_(); }
PLearn::SelectRowsVMatrix::SelectRowsVMatrix | ( | VMat | the_source, |
Vec | the_indices, | ||
bool | the_rows_to_remove = false , |
||
bool | warn = true |
||
) |
Here the indices will be copied locally into an integer vector.
Definition at line 77 of file SelectRowsVMatrix.cc.
References build_(), indices, PLearn::TVec< T >::length(), PLearn::TVec< T >::resize(), and PLearn::SourceVMatrix::source.
: obtained_inputsize_from_source(false), obtained_targetsize_from_source(false), obtained_weightsize_from_source(false), obtained_extrasize_from_source(false), warn_if_all_rows_selected(warn), rows_to_remove(the_rows_to_remove) { source = the_source; indices.resize(the_indices.length()); indices << the_indices; // copy to integer indices build_(); }
string PLearn::SelectRowsVMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
OptionList & PLearn::SelectRowsVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
RemoteMethodMap & PLearn::SelectRowsVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
Object * PLearn::SelectRowsVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
StaticInitializer SelectRowsVMatrix::_static_initializer_ & PLearn::SelectRowsVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
void PLearn::SelectRowsVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 173 of file SelectRowsVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
Referenced by PLearn::SortRowsVMatrix::build(), PLearn::ReplicateSamplesVMatrix::build(), PLearn::ReorderByMissingVMatrix::build(), PLearn::RemoveDuplicateVMatrix::build(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build(), PLearn::DisregardRowsVMatrix::build(), PLearn::ClassSubsetVMatrix::build(), PLearn::BootstrapVMatrix::build(), PLearn::SortRowsVMatrix::build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::ReorderByMissingVMatrix::build_(), PLearn::RemoveDuplicateVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::DisregardRowsVMatrix::build_(), PLearn::ClassSubsetVMatrix::build_(), and PLearn::BootstrapVMatrix::build_().
{ inherited::build(); build_(); }
void PLearn::SelectRowsVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 182 of file SelectRowsVMatrix.cc.
References PLearn::VMatrix::extrasize_, PLearn::VMatrix::fieldinfos, PLearn::TVec< T >::fill(), i, indices, indices_vmat, PLearn::VMatrix::inputsize_, PLearn::TVec< T >::length(), PLearn::VMat::length(), PLearn::VMatrix::length_, n, obtained_extrasize_from_source, obtained_inputsize_from_source, obtained_targetsize_from_source, obtained_weightsize_from_source, PLERROR, PLWARNING, PLearn::TVec< T >::push_back(), PLearn::TVec< T >::resize(), rows_to_remove, selected_indices, PLearn::SourceVMatrix::source, PLearn::VMatrix::targetsize_, warn_if_all_rows_selected, PLearn::VMatrix::weightsize_, PLearn::VMat::width(), and PLearn::VMatrix::width_.
Referenced by build(), and SelectRowsVMatrix().
{ if (indices_vmat) { int n = indices_vmat->length(); indices.resize(n); for (int i = 0; i < n; i++) indices[i] = int(round(indices_vmat->get(i,0))); } if(rows_to_remove) { TVec<bool> tag(source->length()); tag.fill(true); int count_to_remove = 0; for(int i=0; i<indices.length(); i++) { tag[indices[i]] = false; count_to_remove++; } // Allocate enough memory. selected_indices.resize(source->length() - count_to_remove); selected_indices.resize(0); for(int i=0; i<source->length(); i++) if(tag[i]) selected_indices.push_back(i); } else { selected_indices.resize(indices.length()); selected_indices << indices; } //we don't display the warning for SortRowsVMatrix as it always select all row! if(warn_if_all_rows_selected && selected_indices.length()==source.length() && source.length()>0) PLWARNING("In SelectRowsVMatrix::build_() - " "All rows have been selected!"); length_ = selected_indices.length(); if (source) { string error_msg = "In SelectRowsVMatrix::build_ - For safety reasons, it is forbidden to " "re-use sizes obtained from a previous source VMatrix with a new source " "VMatrix having different sizes"; width_ = source->width(); if(inputsize_<0) { inputsize_ = source->inputsize(); obtained_inputsize_from_source = true; } else if (obtained_inputsize_from_source && inputsize_ != source->inputsize()) PLERROR(error_msg.c_str()); if(targetsize_<0) { targetsize_ = source->targetsize(); obtained_targetsize_from_source = true; } else if (obtained_targetsize_from_source && targetsize_ != source->targetsize()) PLERROR(error_msg.c_str()); if(weightsize_<0) { weightsize_ = source->weightsize(); obtained_weightsize_from_source = true; } else if (obtained_weightsize_from_source && weightsize_ != source->weightsize()) PLERROR(error_msg.c_str()); if(extrasize_ == 0) { extrasize_ = source->extrasize(); obtained_extrasize_from_source = true; } else if (obtained_extrasize_from_source && extrasize_ != source->extrasize()) PLERROR(error_msg.c_str()); fieldinfos = source->fieldinfos; } else { // Restore the original undefined sizes if the current one had been obtained // from the source VMatrix. if (obtained_inputsize_from_source) { inputsize_ = -1; obtained_inputsize_from_source = false; } if (obtained_targetsize_from_source) { targetsize_ = -1; obtained_targetsize_from_source = false; } if (obtained_weightsize_from_source) { weightsize_ = -1; obtained_weightsize_from_source = false; } } }
string PLearn::SelectRowsVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
void PLearn::SelectRowsVMatrix::declareOptions | ( | OptionList & | ol | ) | [static] |
Declares this class' options.
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 112 of file SelectRowsVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), indices, indices_vmat, PLearn::OptionBase::learntoption, PLearn::VMatrix::length_, PLearn::OptionBase::nosave, obtained_extrasize_from_source, obtained_inputsize_from_source, obtained_targetsize_from_source, obtained_weightsize_from_source, PLearn::redeclareOption(), rows_to_remove, warn_if_all_rows_selected, PLearn::VMatrix::width_, and PLearn::VMatrix::writable.
Referenced by PLearn::SortRowsVMatrix::declareOptions(), PLearn::ReplicateSamplesVMatrix::declareOptions(), PLearn::ReorderByMissingVMatrix::declareOptions(), PLearn::RemoveDuplicateVMatrix::declareOptions(), PLearn::MultiToUniInstanceSelectRandomVMatrix::declareOptions(), PLearn::DisregardRowsVMatrix::declareOptions(), PLearn::ClassSubsetVMatrix::declareOptions(), and PLearn::BootstrapVMatrix::declareOptions().
{ // Build options. declareOption(ol, "indices", &SelectRowsVMatrix::indices, OptionBase::buildoption, "The array of row indices to extract"); declareOption(ol, "indices_vmat", &SelectRowsVMatrix::indices_vmat, OptionBase::buildoption, "If provided, will override the 'indices' option: the indices will be taken\n" "from the first column of the given VMatrix (taking the closest integer)."); declareOption(ol, "rows_to_remove", &SelectRowsVMatrix::rows_to_remove, OptionBase::buildoption, "Indication that the rows specified in indices or indices_vmat\n" "should be removed, not selected from the source VMatrix."); // Learnt options. declareOption(ol, "obtained_inputsize_from_source", &SelectRowsVMatrix::obtained_inputsize_from_source, OptionBase::learntoption, "Set to 1 if the inputsize was obtained from the source VMat."); declareOption(ol, "obtained_targetsize_from_source", &SelectRowsVMatrix::obtained_targetsize_from_source, OptionBase::learntoption, "Set to 1 if the targetsize was obtained from the source VMat."); declareOption(ol, "obtained_weightsize_from_source", &SelectRowsVMatrix::obtained_weightsize_from_source, OptionBase::learntoption, "Set to 1 if the weightsize was obtained from the source VMat."); declareOption(ol, "obtained_extrasize_from_source", &SelectRowsVMatrix::obtained_extrasize_from_source, OptionBase::learntoption, "Set to 1 if the extrasize was obtained from the source VMat."); declareOption(ol, "warn_if_all_rows_selected", &SelectRowsVMatrix::warn_if_all_rows_selected, OptionBase::buildoption, "If true, we generate a warning if we select all row."); inherited::declareOptions(ol); // Hide unused options. // Note: it is not obvious that all the options below are useless, one may // want to un-hide some in the future. However, the more hidden, the // simpler for the beginner. redeclareOption(ol, "writable", &SelectRowsVMatrix::writable, OptionBase::nosave, "Not used."); redeclareOption(ol, "length", &SelectRowsVMatrix::length_, OptionBase::nosave, "Not used."); redeclareOption(ol, "width", &SelectRowsVMatrix::width_, OptionBase::nosave, "Not used."); }
static const PPath& PLearn::SelectRowsVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 98 of file SelectRowsVMatrix.h.
:
SelectRowsVMatrix * PLearn::SelectRowsVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
Returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered).
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 100 of file SelectRowsVMatrix.cc.
References selected_indices, and PLearn::SourceVMatrix::source.
{ return source->dot(selected_indices[i],v); }
Returns the dot product between row i1 and row i2 (considering only the inputsize first elements).
The default version in VMatrix is somewhat inefficient, as it repeatedly calls get(i,j) The default version in RowBufferedVMatrix is a little better as it buffers the 2 Vecs between calls in case one of them is needed again. But the real strength of this method is for specialised and efficient versions in subbclasses. This method is typically used by SmartKernels so that they can compute kernel values between input samples efficiently.
Reimplemented from PLearn::RowBufferedVMatrix.
Definition at line 97 of file SelectRowsVMatrix.cc.
References selected_indices, and PLearn::SourceVMatrix::source.
{ return source->dot(int(selected_indices[i1]), int(selected_indices[i2]), inputsize); }
These methods are implemented by buffering calls to getNewRow.
returns element (i,j)
Reimplemented from PLearn::RowBufferedVMatrix.
Reimplemented in PLearn::ClassSubsetVMatrix.
Definition at line 91 of file SelectRowsVMatrix.cc.
References selected_indices, and PLearn::SourceVMatrix::source.
{ return source->get(selected_indices[i], j); }
PP< Dictionary > PLearn::SelectRowsVMatrix::getDictionary | ( | int | col | ) | const [virtual] |
Return the Dictionary object for a certain field, or a null pointer if there isn't one.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 270 of file SelectRowsVMatrix.cc.
References PLERROR, PLearn::SourceVMatrix::source, and PLearn::VMatrix::width_.
void PLearn::SelectRowsVMatrix::getNewRow | ( | int | i, |
const Vec & | v | ||
) | const [inline, protected, virtual] |
Must be implemented in subclasses: default version returns an error.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 107 of file SelectRowsVMatrix.h.
{ getSubRow(i, 0, v); }
OptionList & PLearn::SelectRowsVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
OptionMap & PLearn::SelectRowsVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
const map< real, string > & PLearn::SelectRowsVMatrix::getRealToStringMapping | ( | int | col | ) | const [virtual] |
Returns the real->string mapping for column 'col'.
Reimplemented from PLearn::VMatrix.
Definition at line 109 of file SelectRowsVMatrix.cc.
References PLearn::SourceVMatrix::source.
{ return source->getRealToStringMapping(col);}
RemoteMethodMap & PLearn::SelectRowsVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 52 of file SelectRowsVMatrix.cc.
Returns element as a string, even if value doesn't map to a string, in which case tostring(value) is returned.
Reimplemented from PLearn::VMatrix.
Definition at line 103 of file SelectRowsVMatrix.cc.
References selected_indices, and PLearn::SourceVMatrix::source.
{ return source->getString(selected_indices[row], col); }
const map< string, real > & PLearn::SelectRowsVMatrix::getStringToRealMapping | ( | int | col | ) | const [virtual] |
returns the whole string->value mapping
Reimplemented from PLearn::VMatrix.
Definition at line 106 of file SelectRowsVMatrix.cc.
References PLearn::SourceVMatrix::source.
{ return source->getStringToRealMapping(col);}
Returns value associated with a string (or MISSING_VALUE if there's no association for this string).
Reimplemented from PLearn::VMatrix.
Definition at line 264 of file SelectRowsVMatrix.cc.
References PLearn::SourceVMatrix::source.
{ return source->getStringVal(col, str); }
fills v with the subrow i laying between columns j (inclusive) and j+v.length() (exclusive)
Reimplemented from PLearn::RowBufferedVMatrix.
Reimplemented in PLearn::ClassSubsetVMatrix.
Definition at line 94 of file SelectRowsVMatrix.cc.
References PLearn::VMat::getSubRow(), selected_indices, and PLearn::SourceVMatrix::source.
{ source->getSubRow(selected_indices[i], j, v); }
Returns the string associated with value val for field# col.
Or returns "" if no string is associated.
Reimplemented from PLearn::VMatrix.
Definition at line 267 of file SelectRowsVMatrix.cc.
References PLearn::SourceVMatrix::source.
{ return source->getValString(col,val); }
Returns the possible values for a certain field in the VMatrix.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 280 of file SelectRowsVMatrix.cc.
References PLERROR, selected_indices, PLearn::SourceVMatrix::source, and PLearn::VMatrix::width_.
{ #ifdef BOUNDCHECK if(col>=width_) PLERROR("access out of bound. Width=%i accessed col=%i",width_,col); #endif source->getValues(selected_indices[row],col,values); }
void PLearn::SelectRowsVMatrix::getValues | ( | const Vec & | input, |
int | col, | ||
Vec & | values | ||
) | const [virtual] |
Returns the possible values of a certain field (column) given the input.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 289 of file SelectRowsVMatrix.cc.
References PLERROR, PLearn::SourceVMatrix::source, and PLearn::VMatrix::width_.
void PLearn::SelectRowsVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 162 of file SelectRowsVMatrix.cc.
References PLearn::deepCopyField(), indices, indices_vmat, PLearn::SourceVMatrix::makeDeepCopyFromShallowCopy(), and selected_indices.
Referenced by PLearn::SortRowsVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ReplicateSamplesVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ReorderByMissingVMatrix::makeDeepCopyFromShallowCopy(), PLearn::RemoveDuplicateVMatrix::makeDeepCopyFromShallowCopy(), PLearn::DisregardRowsVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ClassSubsetVMatrix::makeDeepCopyFromShallowCopy(), and PLearn::BootstrapVMatrix::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(selected_indices, copies); deepCopyField(indices, copies); deepCopyField(indices_vmat, copies); }
virtual void PLearn::SelectRowsVMatrix::reset_dimensions | ( | ) | [inline, virtual] |
In case the dimensions of an underlying VMat has changed, recompute it.
Reimplemented from PLearn::VMatrix.
Definition at line 120 of file SelectRowsVMatrix.h.
Reimplemented from PLearn::SourceVMatrix.
Reimplemented in PLearn::BootstrapVMatrix, PLearn::ClassSubsetVMatrix, PLearn::DisregardRowsVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::SortRowsVMatrix, and PLearn::ValueSelectRowsVMatrix.
Definition at line 98 of file SelectRowsVMatrix.h.
Public build options.
Definition at line 77 of file SelectRowsVMatrix.h.
Referenced by PLearn::SortRowsVMatrix::build_(), build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::ReorderByMissingVMatrix::build_(), PLearn::RemoveDuplicateVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::DisregardRowsVMatrix::build_(), PLearn::ClassSubsetVMatrix::build_(), PLearn::BootstrapVMatrix::build_(), PLearn::SortRowsVMatrix::declareOptions(), declareOptions(), PLearn::ReorderByMissingVMatrix::declareOptions(), PLearn::RemoveDuplicateVMatrix::declareOptions(), PLearn::MultiToUniInstanceSelectRandomVMatrix::declareOptions(), PLearn::BootstrapVMatrix::declareOptions(), PLearn::ClassSubsetVMatrix::get(), PLearn::ClassSubsetVMatrix::getSubRow(), PLearn::DisregardRowsVMatrix::inferIndices(), makeDeepCopyFromShallowCopy(), SelectRowsVMatrix(), and PLearn::GaussMix::setTrainingSet().
Definition at line 83 of file SelectRowsVMatrix.h.
Referenced by PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), build_(), PLearn::RemoveDuplicateVMatrix::build_(), PLearn::SortRowsVMatrix::build_(), PLearn::ReorderByMissingVMatrix::build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::BootstrapVMatrix::declareOptions(), PLearn::ReorderByMissingVMatrix::declareOptions(), PLearn::MultiToUniInstanceSelectRandomVMatrix::declareOptions(), declareOptions(), PLearn::SortRowsVMatrix::declareOptions(), PLearn::RemoveDuplicateVMatrix::declareOptions(), and makeDeepCopyFromShallowCopy().
Definition at line 68 of file SelectRowsVMatrix.h.
Referenced by build_(), and declareOptions().
Protected learnt options.
Definition at line 65 of file SelectRowsVMatrix.h.
Referenced by build_(), and declareOptions().
Definition at line 66 of file SelectRowsVMatrix.h.
Referenced by build_(), and declareOptions().
Definition at line 67 of file SelectRowsVMatrix.h.
Referenced by build_(), and declareOptions().
Indication that the rows specified in indices or indices_vmat should be removed, not selected from the source VMatrix.
Definition at line 81 of file SelectRowsVMatrix.h.
Referenced by build_(), PLearn::BootstrapVMatrix::build_(), and declareOptions().
TVec<int> PLearn::SelectRowsVMatrix::selected_indices [protected] |
Definition at line 72 of file SelectRowsVMatrix.h.
Referenced by build_(), dot(), get(), getString(), getSubRow(), getValues(), and makeDeepCopyFromShallowCopy().
Definition at line 70 of file SelectRowsVMatrix.h.
Referenced by build_(), PLearn::BootstrapVMatrix::build_(), declareOptions(), and PLearn::SortRowsVMatrix::SortRowsVMatrix().