PLearn 0.1
|
Base classes for virtual matrices. More...
#include <VMatrix.h>
Public Member Functions | |
VMatrix (bool call_build_=false) | |
Default constructor. | |
VMatrix (int the_length, int the_width, bool call_build_=false) | |
virtual | ~VMatrix () |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual VMatrix * | deepCopy (CopiesMap &copies) const |
void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be. | |
void | setFieldInfos (const Array< VMField > &finfo) const |
Set field information. | |
bool | hasFieldInfos () const |
Returns true if fieldinfos have been set. | |
Array< VMField > & | getFieldInfos () const |
If no fieldnames have been set, will set default field names to "0", "1", "2", ... | |
Array< VMField > | getSavedFieldInfos () const |
Read the fieldnames from the metadatadir. | |
VMField & | getFieldInfos (int fieldindex) const |
Return the fieldinfos for a given column. | |
void | declareField (int fieldindex, const string &fieldname, VMField::FieldType fieldtype=VMField::UnknownType) |
Declare the fieldinfos (in particular the field name) for a given column. | |
void | declareFieldNames (const TVec< string > &fnames) |
Declare all fieldinfos. | |
int | fieldIndex (const string &fieldname) const |
Returns the column index corresponding to a fieldname or -1 if the name was not found. | |
int | getFieldIndex (const string &fieldname_or_num, bool throw_error=true) const |
This first calls fieldIndex to try and get the index corresponding to the given string. | |
int | remote_getFieldIndex (const string &fieldname_or_num) const |
Remote version of 'getFieldIndex'. | |
string | fieldName (int fieldindex) const |
Return the field name at a given index. | |
TVec< string > | fieldNames () const |
Returns the vector of field names. | |
void | unduplicateFieldNames () |
Add a numeric suffix to duplicated fieldNames (eg: field.1 field.2 etc..). | |
virtual TVec< string > | inputFieldNames () const |
Returns the names of the input fields (if any) | |
virtual TVec< string > | targetFieldNames () const |
Returns the names of the target fields (if any) | |
virtual TVec< string > | weightFieldNames () const |
Returns the names of the weight fields (if any) | |
virtual TVec< string > | extraFieldNames () const |
Returns the names of the extra fields (if any) | |
VMField::FieldType | fieldType (int fieldindex) const |
VMField::FieldType | fieldType (const string &fieldname) const |
const VMFieldStat & | fieldStat (int j) const |
const VMFieldStat & | fieldStat (const string &fieldname) const |
void | printFields (PStream &out) const |
void | printFieldInfo (PStream &out, int fieldnum, bool print_binning=false) const |
void | printFieldInfo (PStream &out, const string &fieldname_or_num, bool print_binning=false) const |
void | saveFieldInfos () const |
Loads/saves from/to the metadatadir/fieldnames file. | |
void | loadFieldInfos () const |
virtual void | setMetaInfoFrom (const VMatrix *vm) |
Sets all meta info (length_, width_, inputsize_, targetsize_, weightsize_, extrasize_, fieldnames, ...) that is not already set, by copying it from the source's Vmat vm. | |
bool | looksTheSameAs (const VMat &m) |
Return true iif it looks like the same matrix, i.e. | |
void | compatibleSizeError (const VMat &m, const string &extra_msg="") |
Generate a PLERROR iff 'm' does not look like the same matrix, i.e. | |
virtual void | setMetaDataDir (const PPath &the_metadatadir) |
This should be called by the build method of every VMatrix that has a metadatadir. | |
bool | hasMetaDataDir () const |
Returns true if a metadatadir was set. | |
PPath | getMetaDataDir () const |
Throws a PLERROR if no metadatadir was set. | |
void | lockMetaDataDir (time_t max_lock_age=0, bool verbose=true) const |
Locks the metadata directory by creating a .lock file inside it. | |
void | unlockMetaDataDir () const |
Removes the .lock file inside the metadatadir. | |
virtual void | save (const PPath &filename) const |
This method overloads the Object::save method which is deprecated. | |
virtual void | savePMAT (const PPath &pmatfile, bool force_float=false, bool auto_float=false) const |
Save the VMatrix in PMat format. | |
virtual void | remote_savePMAT (const PPath &pmatfile) const |
virtual void | remote_savePMAT_float (const PPath &pmatfile) const |
virtual void | saveDMAT (const PPath &dmatdir) const |
Save the VMatrix in DMat format. | |
virtual void | saveAMAT (const PPath &amatfile, bool verbose=true, bool no_header=false, bool save_strings=false) const |
Save the content of the matrix in the AMAT ASCII format into a file. | |
virtual void | saveCMAT (const PPath &filename) const |
bool | isWritable () const |
Return true if the matrix is writable, i.e. | |
string | resolveFieldInfoLink (const PPath &target, const PPath &source) |
This function (used with .vmat datasets), is used to return the filename of fieldInfo files (string maps (.smap) and notes (.notes)). | |
time_t | getMtime () const |
Return the time of "last modification" associated with this matrix The result returned is typically based on mtime of the files contianing this matrix's data when the object is constructed. | |
void | updateMtime (time_t t) |
Update the "last modification" time for this matrix. | |
void | updateMtime (const PPath &p) |
void | updateMtime (VMat v) |
void | setMtime (time_t t) |
Preferably use updateMtime()! Sets the "last modification" time for this matrix, this should be called by the constructor to reflect the mtime of the disk files. | |
bool | isUpToDate (const PPath &file, bool warning_mtime0=true, bool warning_older=false) const |
Return 'true' iff 'file' was last modified after this VMat, or this VMat's last modification time is undefined (set to 0). | |
bool | isUpToDate (VMat vm, bool warning_mtime0=true, bool warning_older=false) const |
Return 'true' iff 'vm' was last modified after this VMat, this VMat's last modification time is undefined (set to 0), or vm's last modification time is undefined. | |
int | width () const |
Return the number of columns in the VMatrix. | |
int | length () const |
Return the number of rows in the VMatrix. | |
void | defineSizes (int inputsize, int targetsize, int weightsize=0, int extrasize=0) |
Define the input, target and weight sizes. | |
void | copySizesFrom (const VMat &m) |
Copy the values of inputsize, targetsize and weightsize from the source matrix m. | |
bool | getSavedSizes (int &inputsize, int &targetsize, int &weightsize, int &extrasize) const |
Read the saved sizes from the metadatadir. | |
int | inputsize () const |
Input size accessor. | |
int | targetsize () const |
Target size accessor. | |
int | weightsize () const |
Weight size accessor. | |
int | extrasize () const |
Extra size accessor. | |
bool | hasWeights () const |
Return true if VMatrix has a weight column. | |
virtual void | getExample (int i, Vec &input, Vec &target, real &weight) |
Default version calls getSubRow based on inputsize_ targetsize_ weightsize_ But exotic subclasses may construct, input, target and weight however they please. | |
boost::tuple< Vec, Vec, real > | remote_getExample (int i) |
Remote version of getExample. | |
void | getExamples (int i_start, int length, Mat &inputs, Mat &targets, Vec &weights, Mat *extra=NULL, bool allow_circular=false) |
Obtain a subset of 'length' examples, starting from 'i_start'. | |
virtual void | getExtra (int i, Vec &extra) |
Complements the getExample method, fetching the the extrasize_ "extra" fields expected to appear after the input, target and weight fields Default version calls getSubRow based on inputsize_ targetsize_ weightsize_ and extrasize_. | |
Vec | remote_getExtra (int i) |
virtual real | get (int i, int j) const =0 |
This method must be implemented in all subclasses. | |
virtual void | put (int i, int j, real value) |
This method must be implemented in all subclasses of writable matrices. | |
virtual void | getSubRow (int i, int j, Vec v) const |
It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead). | |
virtual void | putSubRow (int i, int j, Vec v) |
It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead) | |
virtual void | appendRow (Vec v) |
This method must be implemented for matrices that are allowed to grow. | |
virtual void | insertRow (int i, Vec v) |
This method must be implemented for matrices that are allowed to grow. | |
virtual void | flush () |
For matrices stored on disk, this should flush all pending buffered write operations. | |
void | putOrAppendRow (int i, Vec v) |
Will call putRow if i<length() and appendRow if i==length(). | |
void | forcePutRow (int i, Vec v) |
Will call putRow if i<length(). | |
virtual void | getRow (int i, Vec v) const |
These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine) | |
virtual void | putRow (int i, Vec v) |
virtual void | fill (real value) |
virtual void | getMat (int i, int j, Mat m) const |
Copies the submatrix starting at i,j into m (which must have appropriate length and width). | |
virtual void | putMat (int i, int j, Mat m) |
Copies matrix m at position i,j of this VMat. | |
virtual void | getColumn (int i, Vec v) const |
Copies column i into v (which must have appropriate length equal to the VMat's length). | |
Vec | remote_getColumn (int i) const |
remote version of getColumn: return newly alloc'd vec | |
bool | find (const Vec &input, real tolerance, int *i=0, int i_start=0) const |
Return true iff the input vector is in this VMat (we compare only the input part). | |
virtual VMat | subMat (int i, int j, int l, int w) |
Default version returns a SubVMatrix referencing the current VMatrix however this can be overridden to provide more efficient shortcuts (see MemoryVMatrix::subMat and SubVMatrix::subMat for examples) | |
virtual Mat | toMat () const |
Returns a Mat with the same data as this VMat. | |
Mat | toMatCopy () const |
Returns a Mat with the same data as this VMat. | |
virtual void | compacify () |
The default implementation of this method does nothing, but subclasses may overload it to reallocate memory to exactly what is needed and no more. | |
virtual void | reset_dimensions () |
In case the dimensions of an underlying VMat has changed, recompute it. | |
operator Mat () const | |
Conversion to Mat. | |
virtual void | newwrite (PStream &out) const |
Output the content of the VMat in the stream 'out'. | |
virtual void | computeStats () |
bool | hasStats () const |
void | saveStats (const PPath &filename) const |
void | loadStats (const PPath &filename) |
TVec< StatsCollector > | getStats (bool progress_bar=false) const |
Returns the unconditional statistics for all fields from the stats.psave file (if the file does not exist, a default version is automatically created). | |
TVec< StatsCollector > | getPrecomputedStatsFromFile (const string &filename, int maxnvalues, bool progress_bar) const |
Generic function to obtain the statistics from a given file in the metadatadir. | |
TVec< PP< StatsCollector > > | remote_getStats () const |
StatsCollector & | getStats (int fieldnum) const |
void | compareStats (VMat target, real stderror_threshold, real missing_threshold, Vec stderror, Vec missing) |
Compare the stats of this VMat with the target one. | |
int | maxFieldNamesSize () const |
void | computeMissingSizeValue (bool warn_if_cannot_compute=true, bool warn_if_size_mismatch=true) |
If only one of inputsize, targetsize, weightsize, extrasize is unknow while width>=0, we compute its value. | |
TVec< pair< real, real > > | getBoundingBox (real extra_percent=0.00) const |
Returns the bounding box of the data, as a vector of min:max pairs. | |
TVec< RealMapping > | getRanges () |
Returns the ranges as defined in the ranges.psave file (for all fields) (if the ranges.psave file does not exist, a reasonable default version is created ). | |
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). | |
real | dot (int i1, int i2) const |
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 void | accumulateXtY (int X_startcol, int X_ncols, int Y_startcol, int Y_ncols, Mat &result, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
result += transpose(X).Y where X = this->subMatColumns(X_startcol,X_ncols) and Y = this->subMatColumns(Y_startcol,Y_ncols) | |
virtual void | accumulateXtX (int X_startcol, int X_ncols, Mat &result, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
A special case of method accumulateXtY result += transpose(X).X where X = this->subMatColumns(X_startcol,X_ncols) | |
void | init_map_sr () const |
Make sure string mappings are the right size. | |
void | saveAllStringMappings () |
Save all string mapings (one .smap file for each field). | |
void | saveStringMappings (int col, const PPath &fname, map< string, real > *str_to_real=0) |
Save a single field's string mapping in file 'fname'. | |
void | addStringMapping (int col, string str, real val) |
Adds a string<->real mapping. | |
real | addStringMapping (int col, string str) |
Adds a string<->real mapping for a new string, if it doesn't already have one and returns the associated value. | |
void | removeAllStringMappings () |
Remove all string mappings. | |
void | removeColumnStringMappings (int c) |
Remove all string mappings of a given field. | |
void | removeStringMapping (int col, string str) |
Removes a single string mapping. | |
void | setStringMapping (int col, const map< string, real > &zemap) |
overwrite the string<->real mapping with this one (and build the reverse mapping). | |
void | deleteStringMapping (int col) |
Deletes string mapping for column i. | |
void | loadStringMapping (int col) |
Loads the appropriate string map file for column 'col'. | |
virtual void | loadAllStringMappings () |
Loads the appropriate string map file for every column. | |
void | copyStringMappingsFrom (const VMat &source) |
Copy all string mappings from a given VMat. | |
virtual string | getValString (int col, real val) const |
Returns the string associated with value val for field# col. | |
virtual const map< string, real > & | getStringToRealMapping (int col) const |
Returns the string->real mapping for column 'col'. | |
virtual const map< real, string > & | getRealToStringMapping (int col) const |
Returns the real->string mapping for column 'col'. | |
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 | 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 void | getRowAsStrings (int i, TVec< string > &v_str) const |
Copy row i (converted to string values, using string mappings when they exist) into v. | |
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 |
Gives the possible values of a certain field (column) given the input. | |
Vec | getRowVec (int i) const |
returns a given row | |
void | appendRows (Mat rows) |
appends the given rows | |
void | setSFIFFilename (int col, string ext, const PPath &filepath="") |
These 3 functions deal with stringmaps, notes, and binning files (all three called Special Field Info Files, or 'SFIF') for each field eventually, I (julien) guess all this info should be wrapped (thus saved, and loaded) in the VMField class. | |
void | setSFIFFilename (string fieldname, string ext, const PPath &filepath="") |
PPath | getSFIFFilename (int col, string ext) |
getSFIFFilename :If a '*.vmat' dataset uses fields from another dataset, how can we keep the field info dependency? To resolve this issue, a file named __default.lnk containing path 'P' can be placed in the FieldInfo directory of the .vmat. | |
PPath | getSFIFFilename (string fieldname, string ext) |
PPath | getSFIFDirectory () const |
Return the directory that stores SFIF files. | |
bool | isSFIFDirect (int col, string ext) |
isSFIFDirect : tells whether the SFIF filename is the default filename. | |
bool | isSFIFDirect (string fieldname, string ext) |
virtual int64_t | getSizeOnDisk () |
Static Public Member Functions | |
static string | _classname_ () |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
Array< VMField > | fieldinfos |
Array< VMFieldStat > | fieldstats |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declare this class' options. | |
static void | declareMethods (RemoteMethodMap &rmm) |
Declare the methods that are remote-callable. | |
Protected Attributes | |
int | length_ |
Length of the VMatrix. | |
int | width_ |
Width of the VMatrix. | |
int | inputsize_ |
For training/testing data sets we assume each row is composed of 4 parts: an input part, a target part, and a weight part. | |
int | targetsize_ |
int | weightsize_ |
int | extrasize_ |
bool | writable |
Are write operations tolerated? | |
PPath | metadatadir |
Path of directory that will contain meta information on this dataset (fieldnames, cached statistics, etc...) and possibly the data itself. | |
TVec< StatsCollector > | field_stats |
Statistics for each field. | |
TVec< PP< StatsCollector > > | field_p_stats |
TVec< map< string, real > > | map_sr |
The string mapping for each field, in both directions. | |
TVec< map< real, string > > | map_rs |
Private Types | |
typedef Object | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. | |
Private Attributes | |
PStream | lockf_ |
.lock file in metadatadir | |
Vec | get_row |
Used in the 'find' method to store a row. | |
Vec | dotrow_1 |
Used in the default dot(i,j) method to store the i-th and j-th rows. | |
Vec | dotrow_2 |
time_t | mtime_ |
Time of "last modification" of data files. | |
time_t | mtime_update |
Friends | |
class | VMat |
Base classes for virtual matrices.
VMatrix provides an abstraction for a virtual matrix, namely a matrix wherein all element access operations are virtual. This enables a wide variety of matrix-like objects to be implemented, from simple data containers (e.g. MemoryVMatrix), to large-scale matrices that don't fit in memory (e.g. FileVMatrix), to on-the-fly calculations that are implemented through various processing VMatrices.
For implementers, a simple class to derive from is RowBufferedVMatrix, which implements most of the functionalities of the abstract VMatrix interface in terms of a few simple virtual functions to be overridden by the user.
typedef Object PLearn::VMatrix::inherited [private] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::SDBVMatrix, PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::ThresholdVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
PLearn::VMatrix::VMatrix | ( | bool | call_build_ = false | ) |
Default constructor.
Definition at line 80 of file VMatrix.cc.
References build_(), and lockf_.
: inherited (call_build_), mtime_ (0), mtime_update(0), length_ (-1), width_ (-1), inputsize_ (-1), targetsize_ (-1), weightsize_ (-1), extrasize_ (0), writable (false) { lockf_ = PStream(); if (call_build_) build_(); }
Definition at line 97 of file VMatrix.cc.
References build_(), and lockf_.
: inherited (call_build_), mtime_ (0), mtime_update (0), length_ (the_length), width_ (the_width), inputsize_ (-1), targetsize_ (-1), weightsize_ (-1), extrasize_ (0), writable (false), map_sr(TVec<map<string,real> > (the_width)), map_rs(TVec<map<real,string> > (the_width)), fieldstats (0) { lockf_ = PStream(); if (call_build_) build_(); }
PLearn::VMatrix::~VMatrix | ( | ) | [virtual] |
Definition at line 2033 of file VMatrix.cc.
{}
string PLearn::VMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
OptionList & PLearn::VMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
RemoteMethodMap & PLearn::VMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
StaticInitializer VMatrix::_static_initializer_ & PLearn::VMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
void PLearn::VMatrix::accumulateXtX | ( | int | X_startcol, |
int | X_ncols, | ||
Mat & | result, | ||
int | startrow = 0 , |
||
int | nrows = -1 , |
||
int | ignore_this_row = -1 |
||
) | const [virtual] |
A special case of method accumulateXtY result += transpose(X).X where X = this->subMatColumns(X_startcol,X_ncols)
Reimplemented in PLearn::ForwardVMatrix.
Definition at line 2288 of file VMatrix.cc.
References PLearn::externalProductAcc(), i, and x.
{ Vec x(X_ncols); int endrow = (nrows>0) ?startrow+nrows :length_; for(int i=startrow; i<endrow; i++) if(i!=ignore_this_row) { getSubRow(i,X_startcol,x); externalProductAcc(result, x,x); } }
void PLearn::VMatrix::accumulateXtY | ( | int | X_startcol, |
int | X_ncols, | ||
int | Y_startcol, | ||
int | Y_ncols, | ||
Mat & | result, | ||
int | startrow = 0 , |
||
int | nrows = -1 , |
||
int | ignore_this_row = -1 |
||
) | const [virtual] |
result += transpose(X).Y where X = this->subMatColumns(X_startcol,X_ncols) and Y = this->subMatColumns(Y_startcol,Y_ncols)
Reimplemented in PLearn::ForwardVMatrix.
Definition at line 2270 of file VMatrix.cc.
References PLearn::externalProductAcc(), i, and x.
{ int endrow = (nrows>0) ?startrow+nrows :length_; Vec x(X_ncols); Vec y(Y_ncols); for(int i=startrow; i<endrow; i++) if(i!=ignore_this_row) { getSubRow(i,X_startcol,x); getSubRow(i,Y_startcol,y); externalProductAcc(result, x,y); } }
Adds a string<->real mapping.
Definition at line 1074 of file VMatrix.cc.
References init_map_sr(), map_rs, and map_sr.
Referenced by addStringMapping(), PLearn::EncodedVMatrix::build_(), PLearn::TextFilesVMatrix::buildVMatrixStringMapping(), declareMethods(), PLearn::IndexedVMatrix::ensureMappingsConsistency(), and PLearn::ConcatRowsVMatrix::ensureMappingsConsistency().
{ init_map_sr(); map_sr[col][str]=val; map_rs[col][val]=str; }
Adds a string<->real mapping for a new string, if it doesn't already have one and returns the associated value.
If the string doesn't already have an associated value, it will be associated with value -100-number_of_strings_already_in_the_map.
Definition at line 1084 of file VMatrix.cc.
References addStringMapping(), PLearn::TVec< T >::find(), init_map_sr(), m, and map_sr.
{ init_map_sr(); map<string,real>& m = map_sr[col]; map<string,real>::iterator it = m.find(str); real val = 0; if(it != m.end()) // str was found in map val = it->second; else // str not found in map: add a new mapping { val = - real(m.size()) - 100; addStringMapping(col, str, val); } return val; }
void PLearn::VMatrix::appendRow | ( | Vec | v | ) | [virtual] |
This method must be implemented for matrices that are allowed to grow.
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompactFileVMatrix, PLearn::CompressedVMatrix, PLearn::DiskVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1833 of file VMatrix.cc.
References PLERROR.
Referenced by declareMethods().
{ PLERROR("In VMatrix::appendRow - Not implemented by VMatrix subclass '%s'", classname().c_str()); }
void PLearn::VMatrix::appendRows | ( | Mat | rows | ) |
appends the given rows
Definition at line 2314 of file VMatrix.cc.
References i, and PLearn::TMat< T >::length().
Referenced by declareMethods().
void PLearn::VMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 575 of file VMatrix.cc.
References PLearn::Object::build(), and build_().
Referenced by PLearn::AsciiVMatrix::AsciiVMatrix(), PLearn::VMatrixFromDistribution::build(), PLearn::PreprocessingVMatrix::build(), PLearn::UniformVMatrix::build(), PLearn::TextSenseSequenceVMatrix::build(), PLearn::TextFilesVMatrix::build(), PLearn::SplitWiseValidationVMatrix::build(), PLearn::SparseVMatrix::build(), PLearn::SourceVMatrix::build(), PLearn::SelectRowsFileIndexVMatrix::build(), PLearn::RemoveRowsVMatrix::build(), PLearn::RegularGridVMatrix::build(), PLearn::RegressionTreeRegisters::build(), PLearn::RangeVMatrix::build(), PLearn::RandomSamplesFromVMatrix::build(), PLearn::PythonTableVMatrix::build(), PLearn::PairsVMatrix::build(), PLearn::MultiInstanceVMatrix::build(), PLearn::MixtureVMatrix::build(), PLearn::MissingIndicatorVMatrix::build(), PLearn::MemoryVMatrix::build(), PLearn::LIBSVMSparseVMatrix::build(), PLearn::LearnerProcessedVMatrix::build(), PLearn::KernelVMatrix::build(), PLearn::JoinVMatrix::build(), PLearn::InterleaveVMatrix::build(), PLearn::InfiniteMNISTVMatrix::build(), PLearn::ImputationVMatrix::build(), PLearn::ForwardVMatrix::build(), PLearn::FileVMatrix::build(), PLearn::ExtractNNetParamsVMatrix::build(), PLearn::DiskVMatrix::build(), PLearn::DictionaryVMatrix::build(), PLearn::DatedJoinVMatrix::build(), PLearn::CrossReferenceVMatrix::build(), PLearn::ConstantVMatrix::build(), PLearn::ConcatRowsVMatrix::build(), PLearn::ConcatColumnsVMatrix::build(), PLearn::CompactFileVMatrix::build(), PLearn::BinaryOpVMatrix::build(), PLearn::BinaryNumbersVMatrix::build(), PLearn::BatchVMatrix::build(), and PLearn::AsciiVMatrix::build().
{ inherited::build(); build_(); }
void PLearn::VMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 562 of file VMatrix.cc.
References PLearn::PPath::isEmpty(), metadatadir, mtime_update, setMetaDataDir(), and updateMtime().
Referenced by build(), and VMatrix().
{ if(!metadatadir.isEmpty()) setMetaDataDir(metadatadir); // make sure we perform all necessary operations if(mtime_update == time_t(-1)) updateMtime(0); else if(mtime_update!=0) updateMtime(mtime_update); }
void PLearn::VMatrix::compacify | ( | ) | [virtual] |
The default implementation of this method does nothing, but subclasses may overload it to reallocate memory to exactly what is needed and no more.
Reimplemented in PLearn::CompressedVMatrix, and PLearn::ForwardVMatrix.
Definition at line 1936 of file VMatrix.cc.
{}
void PLearn::VMatrix::compareStats | ( | VMat | target, |
real | stderror_threshold, | ||
real | missing_threshold, | ||
Vec | stderror, | ||
Vec | missing | ||
) |
Compare the stats of this VMat with the target one.
target | The VMat we compare against |
stderror_threshold | The threshold allowed for the standard error |
missing_threshold | The threshold allowed for the % of missing |
stderror | A measure of difference |
missing | A measure of difference |
Definition at line 2324 of file VMatrix.cc.
References PLearn::fast_is_equal(), i, PLearn::StatsCollector::mean(), PLearn::StatsCollector::n(), PLearn::StatsCollector::nmissing(), PLCHECK, PLERROR, PLWARNING, PLearn::pow(), PLearn::sqrt(), PLearn::StatsCollector::stderror(), and PLearn::VMat::width().
{ if(target->width()!=width()) PLERROR("In VecStatsCollector:: compareStats() - This VMatrix has " "width %d which differs from the target width of %d", width(), target->width()); for(int i=0;i<width();i++) { const StatsCollector tstats = target->getStats(i); const StatsCollector lstats = getStats(i); real tmissing = tstats.nmissing()/tstats.n(); real lmissing = lstats.nmissing()/lstats.n(); real terr = sqrt(tmissing*(1-tmissing)+lmissing*(1-lmissing)); real th_missing = fabs(tmissing-lmissing)/terr; if(fast_is_equal(terr,0)) { if(!fast_is_equal(tmissing,0)||!fast_is_equal(lmissing,0)) PLWARNING("In VMatrix::compareStats - field %d(%s)terr=%f," " tmissing=%f, lmissing=%f!",i, fieldName(i).c_str(), terr, tmissing, lmissing); PLCHECK((fast_is_equal(tmissing,0)||fast_is_equal(tmissing,1)) && (fast_is_equal(lmissing,0)||fast_is_equal(lmissing,1))); } else if(isnan(th_missing)) PLWARNING("In VMatrix::compareStats - should not happen!"); real tmean = tstats.mean(); real lmean = lstats.mean(); real tstderror = sqrt(pow(tstats.stderror(), 2) + pow(lstats.stderror(), 2)); real th_stderror = fabs(lmean-tmean)/tstderror; if(tstderror==0) PLWARNING("In VMatrix::compareStats - field %d(%s) have a" " stderror of 0 for both matrice.", i, fieldName(i).c_str()); stderror[i]=th_stderror; missing[i]=th_missing; } return; }
void PLearn::VMatrix::compatibleSizeError | ( | const VMat & | m, |
const string & | extra_msg = "" |
||
) |
Generate a PLERROR iff 'm' does not look like the same matrix, i.e.
it does not have same sizes and width. If an 'extra_msg' is provided, this message is appended to the error message displayed when there is a size mismatch.
Definition at line 1416 of file VMatrix.cc.
References MY_PRINT_ERROR_MST, and PLearn::VMat::width().
Referenced by PLearn::MeanMedianModeImputationVMatrix::loadMeanMedianModeFile().
{ #define MY_PRINT_ERROR_MST(NAME) PLERROR("In VMatrix::compatibleSizeError " \ " - in class %s - The matrices are not compatible!\n" \ "m1."#NAME"=%d and m2."#NAME"=%d. \n%s", \ classname().c_str(), this->NAME(), m->NAME(), extra_msg.c_str()); if(this->width() != m->width()) MY_PRINT_ERROR_MST(width) else if(this->inputsize() != m->inputsize()) MY_PRINT_ERROR_MST(inputsize) else if(this->weightsize() != m->weightsize()) MY_PRINT_ERROR_MST(weightsize) else if(this->targetsize() != m->targetsize()) MY_PRINT_ERROR_MST(targetsize) else if(this->extrasize() != m->extrasize() ) MY_PRINT_ERROR_MST(extrasize) #undef MY_PRINT_ERROR_MST }
void PLearn::VMatrix::computeMissingSizeValue | ( | bool | warn_if_cannot_compute = true , |
bool | warn_if_size_mismatch = true |
||
) |
If only one of inputsize, targetsize, weightsize, extrasize is unknow while width>=0, we compute its value.
Two warnings may be issued in this method: 1. If 'warn_if_cannot_compute' is true, a warning is issued when it is not possible to compute a missing size's value (for instance when there are two missing sizes). 2. If 'warn_if_size_mismatch' is true, a warning is issued when all sizes are defined but they do not match the width.
Definition at line 2386 of file VMatrix.cc.
References min, and PLWARNING.
Referenced by PLearn::SubVMatrix::build_(), PLearn::ConstantVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), and PLearn::ConcatColumnsVMatrix::build_().
{ int v=min(inputsize_,0) + min(targetsize_,0) + min(weightsize_,0) + min(extrasize_,0); if (width_ < 0 && v <= -1) { if (warn_if_cannot_compute) PLWARNING("In VMatrix::computeMissingSizeValue for %s - Cannot " "compute the missing size value when the width is undefined", classname().c_str()); return; } if(v < -1){ if(warn_if_cannot_compute) PLWARNING("In VMatrix::computeMissingSizeValue() - in class %s" " more then one of" " inputsize(%d), targetsize(%d), weightsize(%d) and" " extrasize(%d) is unknow so we cannot compute them with" " the width(%d)", classname().c_str(), inputsize_, targetsize_, weightsize_, extrasize_, width_); return; }else if(v==0 && warn_if_size_mismatch && width_ >= 0 && width_ != inputsize_ + targetsize_ + weightsize_ + extrasize_) PLWARNING("In VMatrix::computeMissingSizeValue() for class %s - " "inputsize_(%d) + targetsize_(%d) + weightsize_(%d) + " "extrasize_(%d) != width_(%d) !", classname().c_str(), inputsize_, targetsize_, weightsize_, extrasize_, width_); else if(inputsize_<0) inputsize_ = width_- targetsize_ - weightsize_ - extrasize_; else if(targetsize_ < 0) targetsize_ = width_- inputsize_ - weightsize_ - extrasize_; else if(weightsize_ < 0) weightsize_ = width_- inputsize_ - targetsize_ - extrasize_; else if(extrasize_ < 0) extrasize_ = width_- inputsize_ - targetsize_ - weightsize_; }
void PLearn::VMatrix::computeStats | ( | ) | [virtual] |
Reimplemented in PLearn::ForwardVMatrix.
Definition at line 778 of file VMatrix.cc.
References fieldstats, getRow(), i, j, length(), PLearn::update(), and width().
Referenced by PLearn::GaussianizeVMatrix::setMetaDataDir().
{ fieldstats = Array<VMFieldStat>(width()); Vec row(width()); for(int i=0; i<length(); i++) { getRow(i,row); for(int j=0; j<width(); j++) fieldstats[j].update(row[j]); } }
void PLearn::VMatrix::copySizesFrom | ( | const VMat & | m | ) |
Copy the values of inputsize, targetsize and weightsize from the source matrix m.
Definition at line 1309 of file VMatrix.cc.
Referenced by PLearn::MemoryVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::EncodedVMatrix::build_(), and declareMethods().
{ defineSizes(m->inputsize(), m->targetsize(), m->weightsize(), m->extrasize()); }
void PLearn::VMatrix::copyStringMappingsFrom | ( | const VMat & | source | ) |
Copy all string mappings from a given VMat.
Definition at line 1567 of file VMatrix.cc.
References i, PLERROR, and PLearn::VMat::width().
Referenced by PLearn::ConcatRowsVMatrix::ensureMappingsConsistency().
{ if (width_ != source->width()) { PLERROR("In VMatrix::copyStringMappingsFrom - The source VMatrix doesn't have the same width"); } map_rs.resize(width_); map_sr.resize(width_); for (int i = 0; i < width_; i++) { setStringMapping(i, source->getStringToRealMapping(i)); } }
void PLearn::VMatrix::declareField | ( | int | fieldindex, |
const string & | fieldname, | ||
VMField::FieldType | fieldtype = VMField::UnknownType |
||
) |
Declare the fieldinfos (in particular the field name) for a given column.
Definition at line 823 of file VMatrix.cc.
References getFieldInfos().
Referenced by PLearn::JoinVMatrix::addStatField(), PLearn::SDBVMatrix::appendField(), PLearn::AsciiVMatrix::AsciiVMatrix(), PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), PLearn::JoinVMatrix::build_(), declareFieldNames(), declareMethods(), PLearn::TextFilesVMatrix::setColumnNamesAndWidth(), PLearn::JulianizeVMatrix::setVMFields(), PLearn::FinancePreprocVMatrix::setVMFields(), and PLearn::StrTableVMatrix::StrTableVMatrix().
{ getFieldInfos(fieldindex) = VMField(fieldname,fieldtype); }
void PLearn::VMatrix::declareFieldNames | ( | const TVec< string > & | fnames | ) |
Declare all fieldinfos.
Definition at line 831 of file VMatrix.cc.
References declareField(), i, PLearn::TVec< T >::length(), PLERROR, and width().
Referenced by PLearn::RemapLastColumnVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MemoryVMatrix::build_(), PLearn::MeanMedianModeImputationVMatrix::build_(), PLearn::IndexedVMatrix::build_(), PLearn::GeneralizedOneHotVMatrix::build_(), PLearn::ExtendedVMatrix::build_(), PLearn::EncodedVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::MissingIndicatorVMatrix::buildNewRecordFormat(), declareMethods(), and PLearn::FileVMatrix::FileVMatrix().
{ if(fnames.length()!=width()) PLERROR("In VMatrix::declareFieldNames length of fnames differs from width() of VMatrix"); for(int i=0; i<fnames.length(); i++) declareField(i,fnames[i]); }
void PLearn::VMatrix::declareMethods | ( | RemoteMethodMap & | rmm | ) | [static, protected] |
Declare the methods that are remote-callable.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::GaussianizeVMatrix.
Definition at line 175 of file VMatrix.cc.
References PLearn::Object::_getRemoteMethodMap_(), addStringMapping(), appendRow(), appendRows(), copySizesFrom(), declareField(), declareFieldNames(), PLearn::declareMethod(), defineSizes(), dot(), fieldIndex(), fieldName(), fieldNames(), fill(), flush(), get(), getBoundingBox(), getRealToStringMapping(), getRowVec(), getString(), getStringToRealMapping(), PLearn::RemoteMethodMap::inherited(), length(), putRow(), remote_getColumn(), remote_getExample(), remote_getExtra(), remote_getFieldIndex(), remote_getStats(), remote_savePMAT(), remote_savePMAT_float(), saveAllStringMappings(), saveAMAT(), saveDMAT(), saveFieldInfos(), setMetaInfoFrom(), setStringMapping(), subMat(), and toMat().
{ // Insert a backpointer to remote methods; note that this // different than for declareOptions() rmm.inherited(inherited::_getRemoteMethodMap_()); declareMethod( rmm, "getRow", &VMatrix::getRowVec, (BodyDoc("Returns a row of a matrix \n"), ArgDoc ("i", "Position of the row to get.\n"), RetDoc ("row i vector"))); declareMethod( rmm, "getExample", &VMatrix::remote_getExample, (BodyDoc("Returns the input, target and weight parts of a row.\n"), ArgDoc ("i", "Position of the row to get.\n"), RetDoc ("An (input, target, weight) tuple."))); declareMethod( rmm, "getExtra", &VMatrix::remote_getExtra, (BodyDoc("Returns the extra part of a row.\n"), ArgDoc ("i", "Position of the row to get.\n"), RetDoc ("Values for extrafields."))); declareMethod( rmm, "getColumn", &VMatrix::remote_getColumn, (BodyDoc("Returns a row of a matrix \n"), ArgDoc ("i", "Position of the row to get.\n"), RetDoc ("row i vector"))); declareMethod( rmm, "getString", &VMatrix::getString, (BodyDoc("Returns an element of a matrix as a string\n"), ArgDoc ("i", "Position of the row to get.\n"), ArgDoc ("j", "Position of the column to get.\n"), RetDoc ("string value"))); declareMethod( rmm, "getMat", &VMatrix::toMat, (BodyDoc("Returns the content of the vmat as a Mat\n"), RetDoc ("The content of this VMatrix as a Mat"))); declareMethod( rmm, "getLength", &VMatrix::length, (BodyDoc("Return length of this VMatrix.\n"), RetDoc("The length of this VMatrix."))); declareMethod( rmm, "declareField", &VMatrix::declareField, (BodyDoc("Declares the field infos for a given column (index).\n"), ArgDoc ("fieldindex", "The column index.\n"), ArgDoc ("fieldname", "The field name of this column.\n"), ArgDoc ("fieldtype", "The field type of this column.\n"))); declareMethod( rmm, "declareFieldNames", &VMatrix::declareFieldNames, (BodyDoc("Declares the field names.\n"), ArgDoc ("fnames", "TVec of field names.\n"))); declareMethod( rmm, "fieldNames", &VMatrix::fieldNames, (BodyDoc("Returns the field names.\n"), RetDoc ("TVec of field names.\n"))); declareMethod( rmm, "fieldName", &VMatrix::fieldName, (BodyDoc("Returns the field name for a given column.\n"), ArgDoc ("col", "column index.\n"), RetDoc ("Field name.\n"))); declareMethod( rmm, "findFieldIndex", &VMatrix::fieldIndex, (BodyDoc("Returns the index of a field, or -1 if the field does not " "exist.\n"), ArgDoc ("fname", "Field name of the field.\n"), RetDoc ("Index of the field (-1 if not found)\n"))); declareMethod( rmm, "getFieldIndex", &VMatrix::remote_getFieldIndex, (BodyDoc("Returns the index of a field. " "Throws an error if the field is not found.\n"), ArgDoc ("fname_or_num", "Field name or index (as a string) of the field.\n"), RetDoc ("Index of the field.\n"))); declareMethod( rmm, "appendRow", &VMatrix::appendRow, (BodyDoc("Appends a row to the VMatrix.\n"), ArgDoc ("v", "Vec with values (row) to append.\n"))); declareMethod( rmm, "appendRows", &VMatrix::appendRows, (BodyDoc("Appends rows to the VMatrix.\n"), ArgDoc ("rows", "A matrix containing the rows to append.\n"))); declareMethod( rmm, "putRow", &VMatrix::putRow, (BodyDoc("Store a row into the VMatrix.\n"), ArgDoc ("i", "Index of the row being modified.\n"), ArgDoc ("v", "Vec with values (row) to store.\n"))); declareMethod( rmm, "saveFieldInfos", &VMatrix::saveFieldInfos, (BodyDoc("Saves field names, etc. in metadatadir.\n"))); declareMethod( rmm, "flush", &VMatrix::flush, (BodyDoc("Flush mods. to disk.\n"))); declareMethod( rmm, "getBoundingBox", &VMatrix::getBoundingBox, (BodyDoc("Returns the (possibly enlarged) bounding box of the data."), ArgDoc ("extra_percent", "if non 0, then the box is enlarged in both ends\n" "of every direction by that given percentage"), RetDoc ("bounding box as as a vector of (min,max) pairs"))); declareMethod( rmm, "fill", &VMatrix::fill, (BodyDoc("Appends fills the VMatrix with a constant value.\n"), ArgDoc ("value", "The fill value.\n"))); declareMethod( rmm, "dot", &VMatrix::dot, (BodyDoc("dot product between row i1 and row i2, w/ inputsize first elements."), ArgDoc ("i1", "First row to consider."), ArgDoc ("i2", "Second row to consider."), ArgDoc ("inputsize", "nb. elements to consider."), RetDoc ("dot product"))); declareMethod( rmm, "saveAMAT", &VMatrix::saveAMAT, (BodyDoc("Saves this matrix as an .amat file."), ArgDoc ("amatfile", "Path of the file to create."), ArgDoc ("verbose", "output details?"), ArgDoc ("no_header", "save data only"), ArgDoc ("save_strings", "save string instead of real values"))); declareMethod( rmm, "savePMAT", &VMatrix::remote_savePMAT, (BodyDoc("Saves this matrix as a .pmat file."), ArgDoc ("pmatfile", "Path of the file to create."))); declareMethod( rmm, "savePMAT_float", &VMatrix::remote_savePMAT_float, (BodyDoc("Saves this matrix as a .pmat file in float format."), ArgDoc ("pmatfile", "Path of the file to create."))); declareMethod( rmm, "saveDMAT", &VMatrix::saveDMAT, (BodyDoc("Saves this matrix as a .dmat directory."), ArgDoc ("dmatdir", "Path of the dir to create."))); declareMethod( rmm, "subMat", &VMatrix::subMat, (BodyDoc("Return a sub-matrix from a VMatrix\n"), ArgDoc ("i", "start row"), ArgDoc ("j", "start col"), ArgDoc ("l", "length"), ArgDoc ("w", "width"), RetDoc ("The sub-VMatrix"))); declareMethod( rmm, "get", &VMatrix::get, (BodyDoc("Returns the element at position (i,j)\n"), ArgDoc ("i", "row"), ArgDoc ("j", "col"), RetDoc ("Value at (i,j)"))); declareMethod( rmm, "getStats", &VMatrix::remote_getStats, (BodyDoc("Returns the unconditonal statistics for all fields\n"), RetDoc ("Stats vector"))); declareMethod( rmm, "defineSizes", &VMatrix::defineSizes, (BodyDoc("Define this vmatrix's sizes\n"), ArgDoc ("inputsize", "inputsize"), ArgDoc ("targetsize", "targetsize"), ArgDoc ("weightsize", "weightsize"), ArgDoc ("extrasize", "extrasize"))); declareMethod( rmm, "copySizesFrom", &VMatrix::copySizesFrom, (BodyDoc("Define this vmatrix's sizes from another vmatrix\n"), ArgDoc ("vm", "the other vmatrix"))); declareMethod( rmm, "addStringMapping", static_cast<void (VMatrix::*)(int, string, real)>(&VMatrix::addStringMapping), (BodyDoc("Add or replace a string mapping for a column\n"), ArgDoc ("col", "column number"), ArgDoc ("str", "string value"), ArgDoc ("val", "numeric value"))); declareMethod( rmm, "setStringMapping", &VMatrix::setStringMapping, (BodyDoc("Set the string->real mapping for a given column.\n"), ArgDoc ("col", "column number"), ArgDoc ("map", "map of string->real"))); declareMethod( rmm, "getStringToRealMapping", &VMatrix::getStringToRealMapping, (BodyDoc("Get the string->real mapping for a given column.\n"), ArgDoc ("col", "column number"), RetDoc ("map of string->real"))); declareMethod( rmm, "getRealToStringMapping", &VMatrix::getRealToStringMapping, (BodyDoc("Get the real->string mapping for a given column.\n"), ArgDoc ("col", "column number"), RetDoc ("map of real->string"))); declareMethod( rmm, "setMetaInfoFrom", &VMatrix::setMetaInfoFrom, (BodyDoc("Set this vmatrix's meta-info from another vmatrix\n"), ArgDoc ("vm", "the other vmatrix"))); declareMethod( rmm, "saveAllStringMappings", &VMatrix::saveAllStringMappings, (BodyDoc("Save this vmatrix's string mapping infos\n"))); }
void PLearn::VMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declare this class' options.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 120 of file VMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::Object::declareOptions(), extrasize_, fieldinfos, inputsize_, length_, metadatadir, mtime_update, PLearn::OptionBase::nosave, targetsize_, weightsize_, width_, and writable.
Referenced by PLearn::VMatrixFromDistribution::declareOptions(), PLearn::PreprocessingVMatrix::declareOptions(), PLearn::UniformVMatrix::declareOptions(), PLearn::TextSenseSequenceVMatrix::declareOptions(), PLearn::TextFilesVMatrix::declareOptions(), PLearn::SplitWiseValidationVMatrix::declareOptions(), PLearn::SparseVMatrix::declareOptions(), PLearn::SourceVMatrix::declareOptions(), PLearn::SelectRowsFileIndexVMatrix::declareOptions(), PLearn::RemoveRowsVMatrix::declareOptions(), PLearn::RegularGridVMatrix::declareOptions(), PLearn::RegressionTreeRegisters::declareOptions(), PLearn::RangeVMatrix::declareOptions(), PLearn::RandomSamplesFromVMatrix::declareOptions(), PLearn::PythonTableVMatrix::declareOptions(), PLearn::PairsVMatrix::declareOptions(), PLearn::MultiInstanceVMatrix::declareOptions(), PLearn::MixtureVMatrix::declareOptions(), PLearn::MissingIndicatorVMatrix::declareOptions(), PLearn::MemoryVMatrix::declareOptions(), PLearn::LIBSVMSparseVMatrix::declareOptions(), PLearn::LearnerProcessedVMatrix::declareOptions(), PLearn::KernelVMatrix::declareOptions(), PLearn::JoinVMatrix::declareOptions(), PLearn::InterleaveVMatrix::declareOptions(), PLearn::InfiniteMNISTVMatrix::declareOptions(), PLearn::ImputationVMatrix::declareOptions(), PLearn::ForwardVMatrix::declareOptions(), PLearn::FileVMatrix::declareOptions(), PLearn::ExtractNNetParamsVMatrix::declareOptions(), PLearn::DiskVMatrix::declareOptions(), PLearn::DictionaryVMatrix::declareOptions(), PLearn::DatedJoinVMatrix::declareOptions(), PLearn::CrossReferenceVMatrix::declareOptions(), PLearn::ConstantVMatrix::declareOptions(), PLearn::ConcatRowsVMatrix::declareOptions(), PLearn::ConcatColumnsVMatrix::declareOptions(), PLearn::CompactFileVMatrix::declareOptions(), PLearn::BinaryOpVMatrix::declareOptions(), PLearn::BinaryNumbersVMatrix::declareOptions(), PLearn::BatchVMatrix::declareOptions(), and PLearn::AsciiVMatrix::declareOptions().
{ declareOption( ol, "writable", &VMatrix::writable, OptionBase::buildoption, "Are write operations permitted?"); declareOption( ol, "length", &VMatrix::length_, OptionBase::buildoption, "Length of the matrix (number of rows)"); declareOption( ol, "width", &VMatrix::width_, OptionBase::buildoption, "Width of the matrix (number of columns; -1 indicates this varies\n" "from sample to sample...)"); declareOption( ol, "inputsize", &VMatrix::inputsize_, OptionBase::buildoption, "Size of input part (-1 if variable or unspecified, 0 if no input)"); declareOption( ol, "targetsize", &VMatrix::targetsize_, OptionBase::buildoption, "Size of target part (-1 if variable or unspecified, 0 if no target)"); declareOption( ol, "weightsize", &VMatrix::weightsize_, OptionBase::buildoption, "Size of weights (-1 if unspecified, 0 if no weight, 1 for sample\n" "weight, >1 currently not supported)."); declareOption( ol, "extrasize", &VMatrix::extrasize_, OptionBase::buildoption, "Size of extra fields (additional info). Defaults to 0"); declareOption( ol, "metadatadir", &VMatrix::metadatadir, OptionBase::buildoption, "A directory in which to store meta-information for this matrix \n" "You don't always have to give this explicitly. For ex. if your \n" "VMat is the outer VMatrix in a .vmat file, the metadatadir will \n" "automatically be set to name_of_vmat_file.metadata/ \n" "And if it is the source inside another VMatrix that sets its \n" "metadatadir, it will often be set from that surrounding vmat's metadata.\n"); declareOption( ol, "mtime", &VMatrix::mtime_update, OptionBase::buildoption|OptionBase::nosave, "DO NOT play with this if you don't know the implementation!\n" "This add a dependency mtime to the gived value.\n" "Use -1 to set permanently that we do not know the mtime."); declareOption( ol, "fieldinfos", &VMatrix::fieldinfos, OptionBase::buildoption, "Field infos.\n"); inherited::declareOptions(ol); }
static const PPath& PLearn::VMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 151 of file VMatrix.h.
{
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 78 of file VMatrix.cc.
void PLearn::VMatrix::defineSizes | ( | int | inputsize, |
int | targetsize, | ||
int | weightsize = 0 , |
||
int | extrasize = 0 |
||
) | [inline] |
Define the input, target and weight sizes.
Definition at line 449 of file VMatrix.h.
Referenced by PLearn::TemporalHorizonVMatrix::build_(), PLearn::SelectRowsFileIndexVMatrix::build_(), PLearn::RankedVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::MissingIndicatorVMatrix::buildNewRecordFormat(), PLearn::NeighborhoodConditionalMean::computeNeighborhood(), declareMethods(), PLearn::NeighborhoodConditionalMean::experimentWithVariousKs(), PLearn::DynamicallyLinkedRBMsModel::generate(), PLearn::get_input(), PLearn::Preprocessing::manageTrainTestUnknownSets(), PLearn::MemoryVMatrix::MemoryVMatrix(), PLearn::ToBagClassifier::setTrainingSet(), and PLearn::TemporalHorizonVMatrix::TemporalHorizonVMatrix().
{ inputsize_ = inputsize; targetsize_ = targetsize; weightsize_ = weightsize; extrasize_ = extrasize; }
void PLearn::VMatrix::deleteStringMapping | ( | int | col | ) |
Deletes string mapping for column i.
Definition at line 1193 of file VMatrix.cc.
References PLERROR.
Referenced by PLearn::EncodedVMatrix::build_().
{ init_map_sr(); if(col>=map_sr.size() || col>=map_rs.size()) PLERROR("deleteStringMapping : out of bounds for col=%i in string mapping array (size=%i).\n Current VMatrix\nclass"\ "is '%s' (or maybe derivated class?). be sure to set\n map_sr(rs) to appropriate sizes as soon as you know the width of the matrix\n"\ "(in constructor or elsewhere)",col,map_sr.size(),classname().c_str()); map_sr[col].clear(); map_rs[col].clear(); }
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 in PLearn::CompactVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::RemoveRowsVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::OneHotVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SparseVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1962 of file VMatrix.cc.
References PLearn::dot().
Referenced by declareMethods().
{ dotrow_1.resize(inputsize); dotrow_2.resize(inputsize); getSubRow(i1, 0, dotrow_1); getSubRow(i2, 0, dotrow_2); return PLearn::dot(dotrow_1, dotrow_2); }
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 in PLearn::CompactVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::RemoveRowsVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::OneHotVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SparseVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1971 of file VMatrix.cc.
References PLearn::dot(), and PLearn::TVec< T >::length().
{ dotrow_1.resize(v.length()); getSubRow(i, 0, dotrow_1); return PLearn::dot(dotrow_1, v); }
TVec< string > PLearn::VMatrix::extraFieldNames | ( | ) | const [virtual] |
Returns the names of the extra fields (if any)
Definition at line 523 of file VMatrix.cc.
References extrasize_, fieldNames(), inputsize_, PLearn::TVec< T >::subVec(), targetsize_, and weightsize_.
{ return fieldNames().subVec(inputsize_+targetsize_+weightsize_,extrasize_); }
int PLearn::VMatrix::extrasize | ( | ) | const [inline] |
Extra size accessor.
Definition at line 479 of file VMatrix.h.
Referenced by getExamples(), and setMetaInfoFrom().
{ return extrasize_; }
int PLearn::VMatrix::fieldIndex | ( | const string & | fieldname | ) | const |
Returns the column index corresponding to a fieldname or -1 if the name was not found.
Definition at line 529 of file VMatrix.cc.
References getFieldInfos(), i, and width().
Referenced by PLearn::NeighborhoodImputationVMatrix::build_(), declareMethods(), getFieldIndex(), and setMetaInfoFrom().
{ Array<VMField>& infos = getFieldInfos(); for(int i=0; i<width(); i++) if(infos[i].name==fieldname) return i; return -1; }
string PLearn::VMatrix::fieldName | ( | int | fieldindex | ) | const [inline] |
Return the field name at a given index.
Definition at line 207 of file VMatrix.h.
Referenced by declareMethods(), fieldNames(), PLearn::MeanMedianModeImputationVMatrix::getRow(), getSFIFFilename(), hasFieldInfos(), isSFIFDirect(), PLearn::SourceVMatrix::setMetaDataDir(), and setSFIFFilename().
{ return getFieldInfos(fieldindex).name; }
TVec< string > PLearn::VMatrix::fieldNames | ( | ) | const |
Returns the vector of field names.
Definition at line 503 of file VMatrix.cc.
References d, fieldName(), i, and width().
Referenced by PLearn::SelectColumnsVMatrix::build_(), declareMethods(), extraFieldNames(), inputFieldNames(), PLearn::MeanMedianModeImputationVMatrix::loadMeanMedianModeFile(), PLearn::FileVMatrixTest::perform(), targetFieldNames(), and weightFieldNames().
{ int d = width(); if (d < 0) return TVec<string>(); TVec<string> names(d); for(int i=0; i<d; i++) names[i] = fieldName(i); return names; }
const VMFieldStat& PLearn::VMatrix::fieldStat | ( | int | j | ) | const [inline] |
const VMFieldStat& PLearn::VMatrix::fieldStat | ( | const string & | fieldname | ) | const [inline] |
Definition at line 245 of file VMatrix.h.
{ return fieldStat(fieldIndex(fieldname)); }
VMField::FieldType PLearn::VMatrix::fieldType | ( | int | fieldindex | ) | const [inline] |
Definition at line 230 of file VMatrix.h.
{ return getFieldInfos(fieldindex).fieldtype; }
VMField::FieldType PLearn::VMatrix::fieldType | ( | const string & | fieldname | ) | const [inline] |
Definition at line 235 of file VMatrix.h.
{ return fieldType(fieldIndex(fieldname)); }
void PLearn::VMatrix::fill | ( | real | value | ) | [virtual] |
Reimplemented in PLearn::ForwardVMatrix, and PLearn::MemoryVMatrix.
Definition at line 1824 of file VMatrix.cc.
References i.
Referenced by PLearn::SplitWiseValidationVMatrix::build_(), PLearn::ShiftAndRescaleVMatrix::build_(), declareMethods(), PLearn::ProcessSymbolicSequenceVMatrix::fill_current_row(), and PLearn::ProcessSymbolicSequenceVMatrix::getNewRow().
bool PLearn::VMatrix::find | ( | const Vec & | input, |
real | tolerance, | ||
int * | i = 0 , |
||
int | i_start = 0 |
||
) | const |
Return true iff the input vector is in this VMat (we compare only the input part).
If the parameter 'i' is provided, it will be filled with the index of the corresponding data point, or with -1 if it does not exist in this VMat. The 'tolerance' parameter indicates the maximum squared distance between two points to consider them as equal. 'i_start' specifies the row where the search begins.
Definition at line 1982 of file VMatrix.cc.
References j, PLearn::TVec< T >::length(), n, PLERROR, and PLearn::powdistance().
Referenced by PLearn::DictionaryVMatrix::build_(), PLearn::IndexedVMatrix::fullyCheckMappings(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), PLearn::TextFilesVMatrix::generateMapCounts(), PLearn::SelectColumnsVMatrix::getIndicesFromFields(), and PLearn::StrTableVMatrix::StrTableVMatrix().
{ get_row.resize(inputsize()); #ifdef BOUNDCHECK if (input.length() != inputsize()) PLERROR("In VMatrix::find - The given vector must be the same size as " "inputsize"); #endif int n = length(); for (int j = 0; j < n; j++) { int row = (j + i_start) % n; getSubRow(row, 0, get_row); if (powdistance(input, get_row, 2.0) < tolerance) { if (i) *i = row; return true; } } if (i) *i = -1; return false; }
void PLearn::VMatrix::flush | ( | ) | [virtual] |
For matrices stored on disk, this should flush all pending buffered write operations.
Reimplemented in PLearn::CompactFileVMatrix, PLearn::DiskVMatrix, and PLearn::FileVMatrix.
Definition at line 1864 of file VMatrix.cc.
Referenced by declareMethods().
{}
Will call putRow if i<length().
if i>= length(), it will call appendRow with 0 filled rows as many times as necessary before it can append row i.
Definition at line 1886 of file VMatrix.cc.
References PLearn::TVec< T >::clear(), PLearn::TVec< T >::length(), and PLERROR.
{ if (v.length() != width()) PLERROR("In forcePutRow, Vec to append must have same length (%d) as VMatrix width (%d)", v.length(), width()); if(i<length()) putRow(i,v); else { Vec emptyrow(width()); emptyrow.clear(); while(length()<i) appendRow(emptyrow); appendRow(v); } }
This method must be implemented in all subclasses.
Returns element (i,j).
Implemented in PLearn::NistDB, PLearn::ByteMemoryVMatrix, PLearn::ClassSubsetVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::BatchVMatrix, PLearn::RemoveRowsVMatrix, PLearn::NetflixVMatrix, PLearn::ForwardVMatrix, PLearn::InterleaveVMatrix, PLearn::KernelVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MissingIndicatorVMatrix, PLearn::RangeVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::UniformVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, and PLearn::RegressionTreeRegisters.
Referenced by declareMethods().
Returns the bounding box of the data, as a vector of min:max pairs.
If extra_percent is non 0, then the box is enlarged in both ends of every direction by the given percentage (ex: if the data's x lies within [0,100] and extra_percent is 0.03 then the returned bound pair will be -3:103 ).
Definition at line 1719 of file VMatrix.cc.
References PLearn::TVec< T >::length(), PLearn::StatsCollector::max(), PLearn::StatsCollector::min(), n, and PLearn::StatsCollector::range().
Referenced by declareMethods().
{ TVec<StatsCollector> stats = getStats(); int n = stats.length(); TVec< pair<real,real> > bbox(n); for(int k=0; k<n; k++) { StatsCollector& st = stats[k]; bbox[k] = pair<real,real>(st.min()-extra_percent*st.range(), st.max()+extra_percent*st.range()); } return bbox; }
Copies column i into v (which must have appropriate length equal to the VMat's length).
Reimplemented in PLearn::ForwardVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MissingIndicatorVMatrix, PLearn::TransposeVMatrix, PLearn::VMatrixFromDistribution, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1761 of file VMatrix.cc.
References i, PLearn::TVec< T >::length(), and PLERROR.
{ #ifdef BOUNDCHECK if(v.length() != length()) PLERROR("In VMatrix::getColumn - v must have the same length as the VMatrix"); #endif for(int i=0; i<v.length(); i++) v[i] = get(i,j); }
PP< Dictionary > PLearn::VMatrix::getDictionary | ( | int | col | ) | const [virtual] |
Return the Dictionary object for a certain field, or a null pointer if there isn't one.
Reimplemented in PLearn::AddMissingVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::DictionaryVMatrix, PLearn::LemmatizeVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsVMatrix, PLearn::SourceVMatrix, and PLearn::SubVMatrix.
Definition at line 1287 of file VMatrix.cc.
{
return 0;
}
Default version calls getSubRow based on inputsize_ targetsize_ weightsize_ But exotic subclasses may construct, input, target and weight however they please.
If not a weighted matrix, weight should be set to default value 1.
Reimplemented in PLearn::NetflixVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::MissingIndicatorVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 691 of file VMatrix.cc.
References getSubRow(), i, inputsize_, PLERROR, PLearn::TVec< T >::resize(), targetsize_, and weightsize_.
Referenced by PLearn::DynamicallyLinkedRBMsModel::generate(), PLearn::LIBSVMSparseVMatrix::getExample(), getExamples(), and remote_getExample().
{ if(inputsize_<0) PLERROR("In VMatrix::getExample, inputsize_ not defined for this vmat"); input.resize(inputsize_); getSubRow(i,0,input); if(targetsize_<0) PLERROR("In VMatrix::getExample, targetsize_ not defined for this vmat"); target.resize(targetsize_); if (targetsize_ > 0) { getSubRow(i,inputsize_,target); } if(weightsize_==0) weight = 1; else if(weightsize_<0) PLERROR("In VMatrix::getExample, weightsize_ not defined for this vmat"); else if(weightsize_>1) PLERROR("In VMatrix::getExample, weightsize_ >1 not supported by this call"); else weight = get(i,inputsize_+targetsize_); }
void PLearn::VMatrix::getExamples | ( | int | i_start, |
int | length, | ||
Mat & | inputs, | ||
Mat & | targets, | ||
Vec & | weights, | ||
Mat * | extra = NULL , |
||
bool | allow_circular = false |
||
) |
Obtain a subset of 'length' examples, starting from 'i_start'.
The 'extra' matrix is provided as a pointer so that it can be omitted without significant overhead. If the 'allow_circular' boolean parameter is set to 'true', then one may ask for a subset that goes beyond this VMat's length: in such a case, the rest of the subset will be filled with data found at the beginning of this VMat.
Reimplemented in PLearn::LIBSVMSparseVMatrix.
Definition at line 728 of file VMatrix.cc.
References extrasize(), getExample(), getExtra(), inputsize(), length(), PLASSERT, PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), and targetsize().
{ inputs.resize(length, inputsize()); targets.resize(length, targetsize()); weights.resize(length); if (extras) extras->resize(length, extrasize()); Vec input, target, extra; int total_length = this->length(); PLASSERT( i_start < total_length ); for (int k = 0; k < length; k++) { input = inputs(k); target = targets(k); int idx = i_start + k; if (allow_circular) idx %= total_length; PLASSERT( idx >= 0 && idx < total_length ); getExample(idx, input, target, weights[k]); if (extras) { extra = (*extras)(k); getExtra(idx, extra); } } }
Complements the getExample method, fetching the the extrasize_ "extra" fields expected to appear after the input, target and weight fields Default version calls getSubRow based on inputsize_ targetsize_ weightsize_ and extrasize_.
Reimplemented in PLearn::LIBSVMSparseVMatrix.
Definition at line 757 of file VMatrix.cc.
References extrasize_, getSubRow(), inputsize_, PLERROR, PLearn::TVec< T >::resize(), targetsize_, and weightsize_.
Referenced by getExamples(), and remote_getExtra().
{ if(inputsize_<0 || targetsize_<0 || weightsize_<0 || extrasize_<0) PLERROR("In VMatrix::getExtra, sizes not properly defined for this vmat"); extra.resize(extrasize_); if(extrasize_>0) getSubRow(i,inputsize_+targetsize_+weightsize_, extra); }
int PLearn::VMatrix::getFieldIndex | ( | const string & | fieldname_or_num, |
bool | throw_error = true |
||
) | const |
This first calls fieldIndex to try and get the index corresponding to the given string.
If this fails, the given string is assumed to hold the numerical index, and its conversion to int will be returned (or a PLERROR issued if this fails, unless 'throw_error' is set to false, in which case -1 is returned instead).
Definition at line 541 of file VMatrix.cc.
References fieldIndex(), i, PLearn::pl_islong(), PLERROR, PLearn::toint(), PLearn::tostring(), and width().
Referenced by printFieldInfo().
{ int i = fieldIndex(fieldname_or_num); if(i==-1 && pl_islong(fieldname_or_num)) { i = toint(fieldname_or_num); // Now ensure that THE WHOLE FIELD has been converted, because we want // to ensure that stuff that starts with a number but contains other // things is not silently converted to the starting number if (tostring(i) != fieldname_or_num) i = -1; } if ((i < 0 || i >= width()) && error) PLERROR("In VMatrix::getFieldIndex - Asked for an invalid column number: '%s'", fieldname_or_num.c_str()); return i; }
Return the fieldinfos for a given column.
Definition at line 173 of file VMatrix.h.
{ return getFieldInfos()[fieldindex]; }
If no fieldnames have been set, will set default field names to "0", "1", "2", ...
i.e. their column index.
Definition at line 434 of file VMatrix.cc.
References fieldinfos, getMetaDataDir(), hasMetaDataDir(), PLearn::isfile(), j, loadFieldInfos(), PLearn::TVec< T >::resize(), PLearn::TVec< T >::size(), PLearn::tostring(), w, and width().
Referenced by PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), declareField(), fieldIndex(), PLearn::ConcatRowsVMatrix::findAllFields(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), printFieldInfo(), setMetaInfoFrom(), and unduplicateFieldNames().
{ if(fieldinfos.size()==0 && hasMetaDataDir()) { PPath fname = getMetaDataDir() / "fieldnames"; if(isfile(fname)) // file exists loadFieldInfos(); } int ninfos = fieldinfos.size(); int w = width(); if(ninfos!=w && w > 0) { fieldinfos.resize(w); for(int j=ninfos; j<w; j++) fieldinfos[j] = VMField(tostring(j)); } return fieldinfos; }
Copies the submatrix starting at i,j into m (which must have appropriate length and width).
Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::SubVMatrix, PLearn::TransposeVMatrix, and PLearn::VMatrixFromDistribution.
Definition at line 1906 of file VMatrix.cc.
References PLearn::TMat< T >::length(), m, PLERROR, and PLearn::TMat< T >::width().
Referenced by PLearn::operator<<().
{ #ifdef BOUNDCHECK if(i<0 || j<0 || i+m.length()>length() || j+m.width()>width()) PLERROR("In VMatrix::getMat(i,j,m) OUT OF BOUNDS"); #endif for(int ii=0; ii<m.length(); ii++) { getSubRow(i+ii, j, m(ii)); } }
PPath PLearn::VMatrix::getMetaDataDir | ( | ) | const |
Throws a PLERROR if no metadatadir was set.
Definition at line 1502 of file VMatrix.cc.
Referenced by PLearn::VariableDeletionVMatrix::build_(), PLearn::GaussianizeVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::TextFilesVMatrix::buildIdx(), PLearn::TextFilesVMatrix::generateMapCounts(), getFieldInfos(), getSavedFieldInfos(), getSavedSizes(), getSFIFDirectory(), PLearn::FilteredVMatrix::openIndex(), saveFieldInfos(), PLearn::TextFilesVMatrix::setMetaDataDir(), PLearn::MeanMedianModeImputationVMatrix::setMetaDataDir(), PLearn::GaussianizeVMatrix::setMetaDataDir(), PLearn::PrecomputedVMatrix::usePrecomputed(), PLearn::LocallyPrecomputedVMatrix::~LocallyPrecomputedVMatrix(), PLearn::TemporaryDiskVMatrix::~TemporaryDiskVMatrix(), and PLearn::TemporaryFileVMatrix::~TemporaryFileVMatrix().
{ // TODO Remove ? // if(!hasMetaDataDir()) // PLERROR("In VMatrix::getMetaDataDir(): metadatadir was not set"); return metadatadir; }
time_t PLearn::VMatrix::getMtime | ( | ) | const [inline] |
Return the time of "last modification" associated with this matrix The result returned is typically based on mtime of the files contianing this matrix's data when the object is constructed.
mtime_ defaults to 0, so that's what will be returned by default, if the time was never set by a call to updateMtime(t) or setMtime(t)(see below).
Definition at line 382 of file VMatrix.h.
References PLearn::max().
Referenced by setMetaInfoFrom(), and PLearn::vmatmain().
{ return mtime_==numeric_limits<time_t>::max()? 0: mtime_; }
TVec< StatsCollector > PLearn::VMatrix::getPrecomputedStatsFromFile | ( | const string & | filename, |
int | maxnvalues, | ||
bool | progress_bar | ||
) | const |
Generic function to obtain the statistics from a given file in the metadatadir.
If this file does not exist, statistics are computed and saved in this file.
Definition at line 1657 of file VMatrix.cc.
References PLearn::computeStats(), PLearn::PPath::isEmpty(), PLearn::isfile(), PLearn::TVec< T >::length(), PLearn::load(), PLWARNING, PLearn::rm(), and PLearn::save().
Referenced by PLearn::VariableDeletionVMatrix::build_(), and PLearn::GaussianizeVMatrix::setMetaDataDir().
{ TVec<StatsCollector> stats; PPath metadatadir = getMetaDataDir(); PPath statsfile; bool uptodate = false; if (hasMetaDataDir()) { lockMetaDataDir(); statsfile = metadatadir / filename; uptodate = isUpToDate(statsfile); } try{ if (uptodate){ PLearn::load(statsfile, stats); if(stats.length()!=width()){ uptodate=false; PLWARNING("In VMatrix::getPrecomputedStatsFromFile() for class" " %s - The file %s don't have the good number of" " stats. We regenerate it.", classname().c_str(), statsfile.c_str()); } } if(!uptodate){ VMat vm = const_cast<VMatrix*>(this); stats = PLearn::computeStats(vm, maxnvalues, progress_bar); if(hasMetaDataDir()) PLearn::save(statsfile, stats); } }catch(const PLearnError& e){ if(!metadatadir.isEmpty()) unlockMetaDataDir(); //we erase the file if we are creating it // as it can be partilly saved. if(!uptodate && isfile(statsfile)) rm(statsfile); throw e; } if (!metadatadir.isEmpty()) unlockMetaDataDir(); return stats; }
TVec< RealMapping > PLearn::VMatrix::getRanges | ( | ) |
Returns the ranges as defined in the ranges.psave file (for all fields) (if the ranges.psave file does not exist, a reasonable default version is created ).
Definition at line 1735 of file VMatrix.cc.
References PLearn::computeRanges(), PLearn::isfile(), PLearn::load(), max, and PLearn::save().
{ TVec<RealMapping> ranges; PPath rangefile = getMetaDataDir() / "ranges.psave"; if(isfile(rangefile)) PLearn::load(rangefile, ranges); else { ranges = computeRanges(getStats(),std::max(10,length()/200),std::max(10,length()/100) ); PLearn::save(rangefile, ranges); } return ranges; }
Returns the real->string mapping for column 'col'.
Reimplemented in PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1263 of file VMatrix.cc.
Referenced by declareMethods().
{ init_map_sr(); return map_rs[col]; }
These methods do not usually need to be overridden in subclasses (default versions call getSubRow, which should do just fine)
Copies row i into v (which must have appropriate length equal to the VMat's width).
Reimplemented in PLearn::SDBVMatrix, PLearn::IntStreamVMatrix, PLearn::CrossReferenceVMatrix, PLearn::ForwardVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::VMatrixFromDistribution, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1800 of file VMatrix.cc.
References PLearn::TVec< T >::length(), and PLERROR.
Referenced by computeStats().
{ #ifdef BOUNDCHECK if(v.length() != width()) PLERROR("In VMatrix::getRow(i,v) length of v and width of VMatrix differ"); #endif getSubRow(i,0,v); }
Copy row i (converted to string values, using string mappings when they exist) into v.
Definition at line 1245 of file VMatrix.cc.
References j, and PLearn::TVec< T >::resize().
returns a given row
Definition at line 2304 of file VMatrix.cc.
Referenced by declareMethods().
Read the fieldnames from the metadatadir.
Does not modify any internal members.
Definition at line 914 of file VMatrix.cc.
References PLearn::PPath::absolute(), PLearn::PStream::getline(), getMetaDataDir(), i, in, PLearn::isfile(), PLearn::openFile(), PLERROR, PLearn::PStream::raw_ascii, PLearn::split(), PLearn::toint(), w, and width().
Referenced by loadFieldInfos(), and saveFieldInfos().
{ PPath filename = getMetaDataDir() / "fieldnames"; if (!isfile(filename)) // no current fieldinfos saved { Array<VMField> no_fieldinfos(0); return no_fieldinfos; } PStream in = openFile(filename, PStream::raw_ascii, "r"); int w = width(); Array<VMField> current_fieldinfos(w); for(int i=0; i<w; ++i) { string line = in.getline(); vector<string> v(split(line)); switch(v.size()) { case 1: current_fieldinfos[i] = VMField(v[0]); break; case 2: current_fieldinfos[i] = VMField(v[0], VMField::FieldType(toint(v[1]))); break; default: PLERROR("In VMatrix::getSavedFieldInfos Format not recognized in file %s.\n" "Each line should be '<name> {<type>}'.\n" "Got: '%s'. Check for a space in <name>", filename.absolute().c_str(),line.c_str()); } } return current_fieldinfos; }
bool PLearn::VMatrix::getSavedSizes | ( | int & | inputsize, |
int & | targetsize, | ||
int & | weightsize, | ||
int & | extrasize | ||
) | const |
Read the saved sizes from the metadatadir.
If the "sizes" file does not exist, return false. If it exists but the format is wrong, generate a PLerror. If everything looks clean, the 3 arguments are set to the sizes and return true.
Definition at line 945 of file VMatrix.cc.
References getMetaDataDir(), in, PLearn::isfile(), PLearn::openFile(), PLearn::PStream::peek(), PLearn::PStream::plearn_ascii, PLearn::PStream::skipBlanks(), and weightsize().
Referenced by loadFieldInfos(), and saveFieldInfos().
{ PPath filename = getMetaDataDir() / "sizes"; inputsize = targetsize = weightsize = extrasize = -1; if (isfile(filename)) { PStream in = openFile(filename, PStream::plearn_ascii, "r"); // perr << "In loadFieldInfos() loading sizes from " << filename << endl; in >> inputsize >> targetsize >> weightsize; in.skipBlanks(); extrasize = 0; if(in.peek()!=EOF) in >> extrasize; return true; // Successfully loaded } return false; }
PPath PLearn::VMatrix::getSFIFDirectory | ( | ) | const |
Return the directory that stores SFIF files.
Definition at line 997 of file VMatrix.cc.
References getMetaDataDir(), and PLERROR.
Referenced by getSFIFFilename(), isSFIFDirect(), and setSFIFFilename().
{ PPath meta = getMetaDataDir(); if (meta.empty()) PLERROR("%s: cannot have a SFIFDirectory if there is no metadatadir", __FUNCTION__); return meta / "FieldInfo"; }
getSFIFFilename :If a '*.vmat' dataset uses fields from another dataset, how can we keep the field info dependency? To resolve this issue, a file named __default.lnk containing path 'P' can be placed in the FieldInfo directory of the .vmat.
Here's how the function getSFIFFilename search for a file : if the default SFIF file doesn't exist, it will then search for the default filename +'.lnk'. if the later neither exists, the __default.lnk file is used if present, and if not, then an empty (thus inexistent) file (with SFIF default filename) is assumed.
Definition at line 1035 of file VMatrix.cc.
References fieldName().
Referenced by isSFIFDirect(), and PLearn::SourceVMatrix::setMetaDataDir().
{ return getSFIFFilename(fieldName(col),ext); }
PPath PLearn::VMatrix::getSFIFFilename | ( | string | fieldname, |
string | ext | ||
) |
Definition at line 1040 of file VMatrix.cc.
References getSFIFDirectory(), PLearn::isfile(), PLearn::makeFileNameValid(), and resolveFieldInfoLink().
{ PPath target = makeFileNameValid(fieldname+ext); PPath normalfname = getSFIFDirectory() / target; string defaultlinkfname = getSFIFDirectory() / "__default.lnk"; if(isfile(normalfname)) return normalfname; else if(isfile(normalfname+".lnk")) return resolveFieldInfoLink(target, normalfname+".lnk"); else if(isfile(defaultlinkfname)) return resolveFieldInfoLink(target, defaultlinkfname); // assume target is here, but file is empty thus inexistant else return normalfname; }
virtual int64_t PLearn::VMatrix::getSizeOnDisk | ( | ) | [inline, virtual] |
TVec< StatsCollector > PLearn::VMatrix::getStats | ( | bool | progress_bar = false | ) | const |
Returns the unconditional statistics for all fields from the stats.psave file (if the file does not exist, a default version is automatically created).
Definition at line 1581 of file VMatrix.cc.
Referenced by printFieldInfo(), and PLearn::ImputationVMatrix::testResultantVMatrix().
{ if(!field_stats) field_stats = getPrecomputedStatsFromFile("stats.psave", 2000, progress_bar); return field_stats; }
StatsCollector& PLearn::VMatrix::getStats | ( | int | fieldnum | ) | const [inline] |
Definition at line 663 of file VMatrix.h.
References getStats().
Referenced by getStats().
{ return getStats()[fieldnum]; }
Returns element as a string, even if value doesn't map to a string, in which case tostring(value) is returned.
Reimplemented in PLearn::ConcatColumnsVMatrix, PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1231 of file VMatrix.cc.
References PLearn::tostring().
Referenced by declareMethods().
{ real val = get(row,col); string str = getValString(col, val); if (str == "") // There is no string mapping associated to this value. return tostring(val); else return str; }
Returns the string->real mapping for column 'col'.
Reimplemented in PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1255 of file VMatrix.cc.
Referenced by declareMethods(), and setMetaInfoFrom().
{ init_map_sr(); return map_sr[col]; }
Returns value associated with a string (or MISSING_VALUE if there's no association for this string).
Reimplemented in PLearn::AddMissingVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::DictionaryVMatrix, PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::LemmatizeVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1221 of file VMatrix.cc.
References MISSING_VALUE.
{ if(map_sr.length()==0 || map_sr[col].find(str)==map_sr[col].end()) return MISSING_VALUE; else return map_sr[col][str]; }
It is suggested that this method be implemented in subclasses to speed up accesses (default version repeatedly calls get(i,j) which may have a significant overhead).
Fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive).
Reimplemented in PLearn::NistDB, PLearn::ByteMemoryVMatrix, PLearn::ClassSubsetVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::RemoveRowsVMatrix, PLearn::ForwardVMatrix, PLearn::InterleaveVMatrix, PLearn::KernelVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SubVMatrix, PLearn::UniformVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1782 of file VMatrix.cc.
References PLearn::TVec< T >::length().
Referenced by getExample(), and getExtra().
{ for(int k=0; k<v.length(); k++) v[k] = get(i,j+k); }
Returns the string associated with value val for field# col.
Or returns "" if no string is associated.
Reimplemented in PLearn::AutoSDBVMatrix, PLearn::AddMissingVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::DictionaryVMatrix, PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::LemmatizeVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix.
Definition at line 1208 of file VMatrix.cc.
References PLearn::find(), and PLearn::is_missing().
Referenced by PLearn::IndexedVMatrix::ensureMappingsConsistency(), PLearn::ConcatRowsVMatrix::ensureMappingsConsistency(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), and printFieldInfo().
{ if(is_missing(val)) return ""; init_map_sr(); if(map_rs[col].find(val)==map_rs[col].end()) return ""; else return map_rs[col][val]; }
Returns the possible values for a certain field in the VMatrix.
For example, if "col" corresponds to the target column, this function could fill "values" with the class indices of the possible target classes for the example at row "row". The default getValues(...) function gives an empty "values"
Reimplemented in PLearn::AddMissingVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::DictionaryVMatrix, PLearn::LemmatizeVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsVMatrix, PLearn::SourceVMatrix, and PLearn::SubVMatrix.
Definition at line 1295 of file VMatrix.cc.
References PLearn::TVec< T >::resize().
{ values.resize(0); }
Gives the possible values of a certain field (column) given the input.
Reimplemented in PLearn::AddMissingVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::DictionaryVMatrix, PLearn::LemmatizeVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsVMatrix, PLearn::SourceVMatrix, and PLearn::SubVMatrix.
Definition at line 1300 of file VMatrix.cc.
References PLearn::TVec< T >::resize().
{ values.resize(0); }
bool PLearn::VMatrix::hasFieldInfos | ( | ) | const |
Returns true if fieldinfos have been set.
Definition at line 466 of file VMatrix.cc.
References fieldinfos, fieldName(), i, PLearn::is_equal(), PLearn::TVec< T >::length(), PLearn::pl_isnumber(), width(), and x.
Referenced by PLearn::MovingAverageVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::SourceVMatrix::setMetaDataDir(), and setMetaInfoFrom().
{ if (fieldinfos.length() != width()) return false; // If there are some field infos, we check them to see whether they are // default ones (i.e. 0, 1, ..., width-1), in which case 'false' is // returned. double x; for (int i = 0; i < width(); i++) { string name = fieldName(i); if (!pl_isnumber(name, &x) || !is_equal(x, i)) return true; } return false; }
bool PLearn::VMatrix::hasMetaDataDir | ( | ) | const [inline] |
Returns true if a metadatadir was set.
Definition at line 290 of file VMatrix.h.
Referenced by PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::PrecomputedVMatrix::build_(), PLearn::LocallyPrecomputedVMatrix::build_(), PLearn::GaussianizeVMatrix::build_(), PLearn::ForwardVMatrix::build_(), PLearn::FilteredVMatrix::build_(), getFieldInfos(), PLearn::FilteredVMatrix::openIndex(), PLearn::PrecomputedVMatrix::setMetaDataDir(), PLearn::MeanMedianModeImputationVMatrix::setMetaDataDir(), PLearn::GaussianizeVMatrix::setMetaDataDir(), PLearn::DiskVMatrix::~DiskVMatrix(), PLearn::FileVMatrix::~FileVMatrix(), PLearn::LocallyPrecomputedVMatrix::~LocallyPrecomputedVMatrix(), PLearn::TemporaryDiskVMatrix::~TemporaryDiskVMatrix(), and PLearn::TemporaryFileVMatrix::~TemporaryFileVMatrix().
{ return !metadatadir.isEmpty(); }
bool PLearn::VMatrix::hasStats | ( | ) | const [inline] |
Definition at line 643 of file VMatrix.h.
{ return fieldstats.size()>0; }
bool PLearn::VMatrix::hasWeights | ( | ) | const [inline] |
Return true if VMatrix has a weight column.
Definition at line 482 of file VMatrix.h.
{ return weightsize_>0; }
void PLearn::VMatrix::init_map_sr | ( | ) | const |
Make sure string mappings are the right size.
Definition at line 422 of file VMatrix.cc.
References PLearn::TVec< T >::length(), map_rs, map_sr, PLearn::TVec< T >::resize(), and width().
Referenced by addStringMapping(), and PLearn::ConcatColumnsVMatrix::build_().
{ if (map_sr.length()==0 || map_sr.length() != width()) { map_sr.resize(width()); map_rs.resize(width()); } }
TVec< string > PLearn::VMatrix::inputFieldNames | ( | ) | const [virtual] |
Returns the names of the input fields (if any)
Definition at line 514 of file VMatrix.cc.
References fieldNames(), inputsize_, and PLearn::TVec< T >::subVec().
{ return fieldNames().subVec(0,inputsize_); }
int PLearn::VMatrix::inputsize | ( | ) | const [inline] |
Input size accessor.
Definition at line 470 of file VMatrix.h.
Referenced by PLearn::SubVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::ClassSubsetVMatrix::build_(), PLearn::RegressionTreeRegisters::checkMissing(), PLearn::TemporalHorizonVMatrix::dot(), PLearn::MemoryVMatrix::dot(), PLearn::ClassSubsetVMatrix::get(), PLearn::ProcessSymbolicSequenceVMatrix::getDictionary(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), getExamples(), PLearn::ProcessSymbolicSequenceVMatrix::getNewRow(), PLearn::MixUnlabeledNeighbourVMatrix::getNewRow(), PLearn::KNNVMatrix::getNewRow(), PLearn::EncodedVMatrix::getNewRow(), PLearn::ProcessSymbolicSequenceVMatrix::getStringVal(), PLearn::ClassSubsetVMatrix::getSubRow(), PLearn::ProcessSymbolicSequenceVMatrix::getValString(), PLearn::ProcessSymbolicSequenceVMatrix::getValues(), setMetaInfoFrom(), PLearn::RegressionTreeRegisters::sortRows(), and PLearn::VMat::subMatRows().
{ return inputsize_; }
This method must be implemented for matrices that are allowed to grow.
Reimplemented in PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1842 of file VMatrix.cc.
{ if (i<0 || i>length_) PLERROR("In VMatrix::insertRow: row index (%d) outside valid range [%d,%d]", i, 0, length_); else if (i == length_) appendRow(v); else { appendRow(v); // dummy operation to increase VMat length Vec row(width_); for (int j=length_-1; j>i; --j) { getRow(j-1, row); putRow(j, row); } putRow(i, v); } }
isSFIFDirect : tells whether the SFIF filename is the default filename.
(if false, means the field uses the SFIF from another dataset)
Definition at line 1059 of file VMatrix.cc.
References fieldName().
{ return isSFIFDirect(fieldName(col), ext); }
bool PLearn::VMatrix::isSFIFDirect | ( | string | fieldname, |
string | ext | ||
) |
Definition at line 1064 of file VMatrix.cc.
References getSFIFDirectory(), getSFIFFilename(), and PLearn::makeFileNameValid().
{ PPath target = makeFileNameValid(fieldname+ext); PPath normalfname = getSFIFDirectory() / target; return getSFIFFilename(fieldname,ext) == normalfname; }
bool PLearn::VMatrix::isUpToDate | ( | const PPath & | file, |
bool | warning_mtime0 = true , |
||
bool | warning_older = false |
||
) | const |
Return 'true' iff 'file' was last modified after this VMat, or this VMat's last modification time is undefined (set to 0).
If 'warning_mtime0' is 'true', then a warning will be issued when the file exists and this VMat's last modification time is undefined. If 'warning_older' is 'true', then a warning will be issued when the file exists and it is older than this VMat's last modification time.
Definition at line 1606 of file VMatrix.cc.
References PLearn::PPath::absolute(), PLearn::isfile(), PLearn::mtime(), and PLWARNING.
Referenced by PLearn::FilteredVMatrix::openIndex(), PLearn::TextFilesVMatrix::setMetaDataDir(), PLearn::RegressionTreeRegisters::sortRows(), and PLearn::PrecomputedVMatrix::usePrecomputed().
{ bool exist = isfile(path); bool uptodate = false; if(exist) uptodate = getMtime() < mtime(path); if (warning_mtime0 && exist && uptodate && getMtime()==0) PLWARNING("In VMatrix::isUpToDate - for class '%s'" " File '%s' will be used, but " "this VMat's last modification time is undefined: we cannot " "be sure the file is up-to-date.", classname().c_str(), path.absolute().c_str()); if(warning_older && exist && !uptodate) PLWARNING("In VMatrix::isUpToDate - for class '%s'" " File '%s' is older than this " "VMat's mtime of %ld, and should not be re-used.", classname().c_str(), path.absolute().c_str(), long(getMtime())); return exist && uptodate; }
bool PLearn::VMatrix::isUpToDate | ( | VMat | vm, |
bool | warning_mtime0 = true , |
||
bool | warning_older = false |
||
) | const |
Return 'true' iff 'vm' was last modified after this VMat, this VMat's last modification time is undefined (set to 0), or vm's last modification time is undefined.
If 'warning_mtime0' is 'true', then a warning will be issued when one of the VMats' last modification time is undefined. If 'warning_older' is 'true', then a warning will be issued when 'vm' is older than this VMat.
Definition at line 1631 of file VMatrix.cc.
References PLWARNING.
{ time_t my_time = getMtime(); time_t vm_time = vm->getMtime(); bool uptodate = my_time < vm_time || my_time == 0 || vm_time == 0; if (warning_mtime0 && uptodate && (my_time == 0 || vm_time == 0)) PLWARNING("In VMatrix::isUpToDate - for class '%s'" " When comparing the VMats' last modification times, at " "least one was found to be undefined: we cannot be sure " "the VMat is up-to-date.", classname().c_str()); if(warning_older && !uptodate) PLWARNING("In VMatrix::isUpToDate - for class '%s'" " The VMat with mtime of %ld is older than this " "VMat's with mtime of %ld, and should not be re-used.", classname().c_str(), long(vm->getMtime()), long(getMtime())); return uptodate; }
bool PLearn::VMatrix::isWritable | ( | ) | const [inline] |
Return true if the matrix is writable, i.e.
if put()-like member functions can succeed.
Definition at line 350 of file VMatrix.h.
Referenced by PLearn::FileVMatrix::~FileVMatrix().
{ return writable; }
int PLearn::VMatrix::length | ( | ) | const [inline] |
Return the number of rows in the VMatrix.
Definition at line 439 of file VMatrix.h.
References PLERROR.
Referenced by PLearn::CompactVMatrix::append(), PLearn::AsciiVMatrix::appendRow(), PLearn::TextFilesVMatrix::autoBuildMappings(), PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::RemoveDuplicateVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::RandomSamplesVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MemoryVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::DictionaryVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), PLearn::AsciiVMatrix::build_(), PLearn::RegressionTreeRegisters::checkMissing(), PLearn::MeanImputationVMatrix::computeMeanVector(), computeStats(), declareMethods(), PLearn::SparseVMatrix::dot(), PLearn::RowBufferedVMatrix::dot(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), PLearn::DynamicallyLinkedRBMsModel::generate(), PLearn::TextFilesVMatrix::generateMapCounts(), PLearn::SubVMatrix::get(), PLearn::RowBufferedVMatrix::get(), PLearn::RangeVMatrix::get(), PLearn::NistDB::get(), PLearn::KernelVMatrix::get(), PLearn::InterleaveVMatrix::get(), PLearn::CrossReferenceVMatrix::get(), PLearn::RegressionTreeRegisters::getAllRegisteredRow(), PLearn::LIBSVMSparseVMatrix::getExample(), getExamples(), PLearn::LIBSVMSparseVMatrix::getExtra(), PLearn::TextFilesVMatrix::getFileAndPos(), PLearn::SubVMatrix::getMat(), PLearn::VecExtendedVMatrix::getNewRow(), PLearn::ThresholdVMatrix::getNewRow(), PLearn::SubVMatrix::getNewRow(), PLearn::SparseVMatrix::getNewRow(), PLearn::RemapLastColumnVMatrix::getNewRow(), PLearn::RegularGridVMatrix::getNewRow(), PLearn::PutSubVMatrix::getNewRow(), PLearn::OneHotVMatrix::getNewRow(), PLearn::MovingAverageVMatrix::getNewRow(), PLearn::MixUnlabeledNeighbourVMatrix::getNewRow(), PLearn::MixtureVMatrix::getNewRow(), PLearn::IndexedVMatrix::getNewRow(), PLearn::GeneralizedOneHotVMatrix::getNewRow(), PLearn::FilteredVMatrix::getNewRow(), PLearn::ExtendedVMatrix::getNewRow(), PLearn::DiskVMatrix::getNewRow(), PLearn::CompactFileVMatrix::getNewRow(), PLearn::AsciiVMatrix::getNewRow(), PLearn::ConcatRowsSubVMatrix::getpositions(), PLearn::ConcatRowsVMatrix::getPositionsAux(), PLearn::TextSenseSequenceVMatrix::getRestrictedRow(), PLearn::RowBufferedVMatrix::getRow(), PLearn::CrossReferenceVMatrix::getRow(), PLearn::SubVMatrix::getString(), PLearn::SubVMatrix::getSubRow(), PLearn::RowBufferedVMatrix::getSubRow(), PLearn::NistDB::getSubRow(), PLearn::KernelVMatrix::getSubRow(), PLearn::InterleaveVMatrix::getSubRow(), PLearn::SubVMatrix::getValues(), PLearn::DictionaryVMatrix::getValues(), PLearn::operator<<(), PLearn::FileVMatrixTest::perform(), PLearn::SubVMatrix::put(), PLearn::SubVMatrix::putMat(), PLearn::ConcatRowsVMatrix::putMat(), PLearn::SubVMatrix::putSubRow(), setMetaInfoFrom(), PLearn::RegressionTreeRegisters::sortEachDim(), PLearn::RegressionTreeRegisters::sortRows(), PLearn::SparseVMatrix::SparseVMatrix(), and PLearn::ImputationVMatrix::testResultantVMatrix().
void PLearn::VMatrix::loadAllStringMappings | ( | ) | [virtual] |
Loads the appropriate string map file for every column.
It is virtual because StrTableVMatrix will need to override it.
Reimplemented in PLearn::StrTableVMatrix.
Definition at line 1513 of file VMatrix.cc.
Referenced by PLearn::DiskVMatrix::build_().
{ if (! hasMetaDataDir() || ! isdir(getSFIFDirectory())) return; for(int i=0;i<width();i++) loadStringMapping(i); }
void PLearn::VMatrix::loadFieldInfos | ( | ) | const |
Definition at line 893 of file VMatrix.cc.
References extrasize_, getSavedFieldInfos(), getSavedSizes(), inputsize_, setFieldInfos(), targetsize_, and weightsize_.
Referenced by PLearn::FileVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), and getFieldInfos().
{ Array<VMField> current_fieldinfos = getSavedFieldInfos(); setFieldInfos(current_fieldinfos); // Update only if they can successfully be read from the saved metadata // and they don't already exist in the VMatrix int inp, tar, weight, extr; if (inputsize_ == -1 && targetsize_ == -1 && weightsize_ == -1 && getSavedSizes(inp,tar,weight,extr)) { inputsize_ = inp; targetsize_ = tar; weightsize_ = weight; extrasize_ = extr; } }
void PLearn::VMatrix::loadStats | ( | const PPath & | filename | ) |
Definition at line 793 of file VMatrix.cc.
References fieldstats, in, j, PLearn::openFile(), PLWARNING, PLearn::PStream::raw_ascii, PLearn::Object::read(), PLearn::TVec< T >::resize(), PLearn::TVec< T >::size(), and width().
{ PStream in = openFile(filename, PStream::raw_ascii, "r"); int nfields; in >> nfields; if(nfields!=width()) PLWARNING("In VMatrix::loadStats - nfields differs from VMat width"); fieldstats.resize(nfields); for(int j=0; j<fieldstats.size(); j++) fieldstats[j].read(in); }
void PLearn::VMatrix::loadStringMapping | ( | int | col | ) |
Loads the appropriate string map file for column 'col'.
Definition at line 1525 of file VMatrix.cc.
References PLearn::force_mkdir(), PLearn::PStream::good(), PLearn::isfile(), PLearn::openFile(), PLearn::pathexists(), PLERROR, and PLearn::PStream::skipBlanks().
{ if(!hasMetaDataDir()) return; PPath fname = getSFIFFilename(col,".smap"); init_map_sr(); string SFIFdir= getSFIFDirectory(); if(!pathexists(SFIFdir)) force_mkdir(SFIFdir); if(!isfile(fname)) return; deleteStringMapping(col); // smap file exists, open it PStream f = openFile(fname, PStream::plearn_ascii); // TODO Remove ? #if 0 string pref; f>>pref; if(string(pref)!="#SMAP") PLERROR( string("File "+fname+" is not a valid String mapping file.\nShould start with #SMAP on first line (this is to prevent inopportunely overwritting another type of file)").c_str()); #endif while(f.good()) { string s; real val; f >> s >> val; if(f.good()) { map_sr[col][s] = val; map_rs[col][val] = s; f.skipBlanks(); } } }
void PLearn::VMatrix::lockMetaDataDir | ( | time_t | max_lock_age = 0 , |
bool | verbose = true |
||
) | const |
Locks the metadata directory by creating a .lock file inside it.
If such a file already exists, it is interpreted as being locked by some other process: this process will print to cerr that it is waiting for a lock on that directory, and will block and wait until the existing .lock is removed before recreating its own. Throws a PLearnError if called and metadatadir is not set, or lock is already held by this object (i.e. this->lockMetaDataDir has already been called previously and no unlockMetaDataDir() was called). If the 'max_lock_age' option is given a value > 0, then the lock file will be ignored (and replaced by our own lock file) as soon as its modification date becomes older than 'max_lock_age' (in seconds).
The 'verbose' option can be set to false to prevent useless output.
Definition at line 1438 of file VMatrix.cc.
References PLearn::endl(), PLearn::filesize(), PLearn::force_mkdir(), PLearn::getPid(), PLearn::getUser(), PLearn::PStream::good(), PLearn::hostname(), PLearn::isfile(), PLearn::PLearnError::message(), PLearn::mtime(), PLearn::openFile(), PLearn::pathexists(), PLearn::perr, PLERROR, PLearn::PStream::read(), PLearn::tostring(), and PLearn::uniform_multinomial_sample().
Referenced by PLearn::FilteredVMatrix::openIndex().
{ #ifndef DISABLE_VMATRIX_LOCK if(!hasMetaDataDir()) PLERROR("In VMatrix::lockMetaDataDir() subclass %s -" " metadatadir was not set", classname().c_str()); if(lockf_.good()) // Already locked by this object! PLERROR("VMatrix::lockMetaDataDir() subclass %s -" " called while already locked by this object.", classname().c_str()); if(!pathexists(metadatadir)) force_mkdir(metadatadir); PPath lockfile = metadatadir / ".lock"; while (isfile(lockfile) && (max_lock_age == 0 || mtime(lockfile) + max_lock_age > time(0))) { // There is a lock file, and it is not older than 'max_lock_age'. string bywho; try{ PStream st = openFile(lockfile, PStream::raw_ascii, "r", false); if(st.good()) st.read(bywho, streamsize(filesize(lockfile))); } catch(const PLearnError& e) { PLERROR("In VMatrix::lockMetaDataDir - Catching exceptions is" " dangerous in PLearn (memory" " leaks may occur), thus I prefer to stop here. " " Comment this line if you don't care." " The error message is: %s",e.message().c_str()); bywho = "UNKNOWN (could not read .lock file)" ; } catch(...) { PLERROR("In VMatrix::lockMetaDataDir - Catching exceptions is dangerous in PLearn (memory " "leaks may occur), thus I prefer to stop here. Comment this line if you don't care."); bywho = "UNKNOWN (could not read .lock file)"; } if (verbose) perr << "Waiting for .lock in directory " << metadatadir << " created by " << bywho << endl; sleep(uniform_multinomial_sample(10) + 1); // Random wait for more safety. } lockf_ = openFile(lockfile, PStream::raw_ascii, "w"); string lock_content = "host " + hostname() + ", pid " + tostring(getPid()) + ", user " + getUser(); lockf_ << lock_content; lockf_.flush(); #endif }
Return true iif it looks like the same matrix, i.e.
it has same sizes, width and length.
Definition at line 1403 of file VMatrix.cc.
References PLearn::VMat::length(), and PLearn::VMat::width().
{ return !( this->width() != m->width() || this->length() != m->length() || this->inputsize() != m->inputsize() || this->weightsize() != m->weightsize() || this->targetsize() != m->targetsize() || this->extrasize() != m->extrasize() ); }
void PLearn::VMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
This needs to be overridden by every class that adds "complex" data members to the class, such as Vec
, Mat
, PP<Something>
, etc. Typical implementation:
void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies) { inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(complex_data_member1, copies); deepCopyField(complex_data_member2, copies); ... }
copies | A map used by the deep-copy mechanism to keep track of already-copied objects. |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::ViewSplitterVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 404 of file VMatrix.cc.
References PLearn::deepCopyField(), dotrow_1, dotrow_2, field_stats, fieldinfos, fieldstats, get_row, PLearn::Object::makeDeepCopyFromShallowCopy(), map_rs, and map_sr.
Referenced by PLearn::VMatrixFromDistribution::makeDeepCopyFromShallowCopy(), PLearn::RowBufferedVMatrix::makeDeepCopyFromShallowCopy(), PLearn::RegressionTreeRegisters::makeDeepCopyFromShallowCopy(), PLearn::MissingIndicatorVMatrix::makeDeepCopyFromShallowCopy(), PLearn::MemoryVMatrix::makeDeepCopyFromShallowCopy(), PLearn::KernelVMatrix::makeDeepCopyFromShallowCopy(), PLearn::InterleaveVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ImputationVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ForwardVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ConstantVMatrix::makeDeepCopyFromShallowCopy(), PLearn::ConcatRowsVMatrix::makeDeepCopyFromShallowCopy(), and PLearn::BatchVMatrix::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); deepCopyField(get_row, copies); deepCopyField(dotrow_1, copies); deepCopyField(dotrow_2, copies); deepCopyField(field_stats, copies); deepCopyField(map_sr, copies); deepCopyField(map_rs, copies); deepCopyField(fieldinfos, copies); deepCopyField(fieldstats, copies); // TODO See if we can deep-copy a PStream (and what it means). }
int PLearn::VMatrix::maxFieldNamesSize | ( | ) | const |
void PLearn::VMatrix::newwrite | ( | PStream & | out | ) | const [virtual] |
Output the content of the VMat in the stream 'out'.
Overridden to display only the content of the VMat when out's mode is 'raw_ascii' or 'pretty_ascii' (instead of doing serialization).
Reimplemented from PLearn::Object.
Definition at line 2008 of file VMatrix.cc.
{ /* switch(out.outmode) { case PStream::raw_ascii: case PStream::pretty_ascii: { Vec v(width()); for(int i=0; i<length(); i++) { getRow(i,v); out << v << endl; } break; } default: inherited::newwrite(out); } */ inherited::newwrite(out); }
PLearn::VMatrix::operator Mat | ( | ) | const [inline] |
Conversion to Mat.
WARNING: modifying the content of the returned Mat may or may not modify the content of the VMatrix, depending on the type of the VMatrix. If you want to be sure to get a *copy* of the data, consider calling toMatCopy() instead.
Definition at line 629 of file VMatrix.h.
{ return toMat(); }
void PLearn::VMatrix::printFieldInfo | ( | PStream & | out, |
const string & | fieldname_or_num, | ||
bool | print_binning = false |
||
) | const |
Definition at line 670 of file VMatrix.cc.
References getFieldIndex(), and printFieldInfo().
{ printFieldInfo(out, getFieldIndex(fieldname_or_num), print_binning); }
void PLearn::VMatrix::printFieldInfo | ( | PStream & | out, |
int | fieldnum, | ||
bool | print_binning = false |
||
) | const |
Definition at line 584 of file VMatrix.cc.
References PLearn::VMField::Continuous, PLearn::StatsCollector::counts, PLearn::VMField::Date, PLearn::VMField::DiscrFloat, PLearn::VMField::DiscrGeneral, PLearn::VMField::DiscrMonotonic, PLearn::endl(), PLearn::VMField::fieldtype, getFieldInfos(), getStats(), getValString(), PLearn::left(), PLearn::StatsCollector::max(), PLearn::StatsCollector::maxnvalues, PLearn::StatsCollector::mean(), PLearn::StatsCollector::min(), PLearn::StatsCollectorCounts::n, PLearn::VMField::name, PLearn::StatsCollectorCounts::nbelow, PLearn::StatsCollector::nmissing(), PLearn::StatsCollector::nnonmissing(), PLERROR, PLearn::StatsCollector::stddev(), PLearn::StatsCollectorCounts::sum, PLearn::StatsCollector::sum(), and PLearn::VMField::UnknownType.
Referenced by printFieldInfo(), and printFields().
{ VMField fi = getFieldInfos(fieldnum); StatsCollector& s = getStats(fieldnum); out << "Field #" << fieldnum << ": "; out << fi.name << "\t type: "; switch(fi.fieldtype) { case VMField::UnknownType: out << "UnknownType\n"; break; case VMField::Continuous: out << "Continuous\n"; break; case VMField::DiscrGeneral: out << "DiscrGeneral\n"; break; case VMField::DiscrMonotonic: out << "DiscrMonotonic\n"; break; case VMField::DiscrFloat: out << "DiscrFloat\n"; break; case VMField::Date: out << "Date\n"; break; default: PLERROR("Can't write name of type"); } map<real,StatsCollectorCounts>::const_iterator it = s.counts.begin(); map<real,StatsCollectorCounts>::const_iterator countsend = s.counts.end(); int n_values = 0; //some value(FLT_MAX, meaby others) are used for others purpose. //We must not cont then. while(it!=countsend) { real val = it->first; const StatsCollectorCounts& co = it->second; string str = getValString(fieldnum, val); if(co.n>0) n_values++; ++it; } char plus = ' '; if (n_values==s.maxnvalues) plus = '+'; out << "nmissing: " << s.nmissing() << '\n'; out << "nnonmissing: " << s.nnonmissing() << '\n'; out << "sum: " << s.sum() << '\n'; out << "mean: " << s.mean() << '\n'; out << "stddev: " << s.stddev() << '\n'; out << "min: " << s.min() << '\n'; out << "max: " << s.max() << '\n'; out << "ndiffvalue: " << n_values << plus << '\n'; if(!s.counts.empty() && print_binning) { out << "\nCOUNTS: \n"; map<real,StatsCollectorCounts>::const_iterator it = s.counts.begin(); map<real,StatsCollectorCounts>::const_iterator countsend = s.counts.end(); while(it!=countsend) { real val = it->first; const StatsCollectorCounts& co = it->second; string str = getValString(fieldnum, val); ostringstream os; os.setf(ios::left); os << " " << setw(12) << val << " " << setw(12) << str << " n=" << setw(10) << co.n << " nbelow=" << setw(10) << co.nbelow << " sumbelow=" << setw(10) << co.sum << endl; out << os.str(); ++it; } } out << endl << endl; }
void PLearn::VMatrix::printFields | ( | PStream & | out | ) | const |
Definition at line 679 of file VMatrix.cc.
References PLearn::endl(), j, printFieldInfo(), and width().
{ for(int j=0; j<width(); j++) { printFieldInfo(out,j); out << "-----------------------------------------------------" << endl; } }
This method must be implemented in all subclasses of writable matrices.
Sets element (i,j) to value.
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompactFileVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::BatchVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, PLearn::IndexedVMatrix, PLearn::MemoryVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, and PLearn::RegressionTreeRegisters.
Definition at line 1752 of file VMatrix.cc.
References PLERROR.
Copies matrix m at position i,j of this VMat.
Reimplemented in PLearn::ConcatRowsVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::SubVMatrix.
Definition at line 1921 of file VMatrix.cc.
References PLearn::TMat< T >::length(), m, PLERROR, and PLearn::TMat< T >::width().
Referenced by PLearn::ExtractOptionCommand::run().
{ #ifdef BOUNDCHECK if(i<0 || j<0 || i+m.length()>length() || j+m.width()>width()) PLERROR("In VMatrix::putMat(i,j,m) OUT OF BOUNDS"); #endif for(int ii=0; ii<m.length(); ii++) { putSubRow(i+ii, j, m(ii)); } }
Will call putRow if i<length() and appendRow if i==length().
Definition at line 1870 of file VMatrix.cc.
References PLearn::TVec< T >::length(), and PLERROR.
{ if (v.length() != width()) PLERROR("In putOrAppendRow, Vec to append must have same length (%d) as VMatrix width (%d)", v.length(), width()); if(i==length()) appendRow(v); else if(i<length()) putRow(i,v); else PLERROR("In putOrAppendRow, index %d out of range",i); }
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompactVMatrix, PLearn::DiskVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1812 of file VMatrix.cc.
References PLearn::TVec< T >::length(), and PLERROR.
Referenced by declareMethods(), PLearn::FileVMatrixTest::perform(), and savePMAT().
{ #ifdef BOUNDCHECK if(v.length() != width()) PLERROR("In VMatrix::putRow(i,v) length of v and width of VMatrix differ"); #endif putSubRow(i,0,v); }
It is suggested that this method be implemented in subclasses of writable matrices to speed up accesses (default version repeatedly calls put(i,j,value) which may have a significant overhead)
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::SubVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, and PLearn::NeighborhoodImputationVMatrix.
Definition at line 1791 of file VMatrix.cc.
References PLearn::TVec< T >::length().
{ for(int k=0; k<v.length(); k++) put(i, j+k, v[k]); }
remote version of getColumn: return newly alloc'd vec
Definition at line 1771 of file VMatrix.cc.
Referenced by declareMethods().
Remote version of getExample.
Definition at line 717 of file VMatrix.cc.
References getExample().
Referenced by declareMethods().
{ Vec input, target; real weight; getExample(i, input, target, weight); return boost::tuple<Vec, Vec, real>(input, target, weight); }
Definition at line 767 of file VMatrix.cc.
References getExtra().
Referenced by declareMethods().
int PLearn::VMatrix::remote_getFieldIndex | ( | const string & | fieldname_or_num | ) | const [inline] |
Remote version of 'getFieldIndex'.
Definition at line 201 of file VMatrix.h.
Referenced by declareMethods().
{ return getFieldIndex(fieldname_or_num); }
TVec< PP< StatsCollector > > PLearn::VMatrix::remote_getStats | ( | ) | const |
Definition at line 1703 of file VMatrix.cc.
References PLearn::deepCopy(), i, and PLearn::TVec< T >::length().
Referenced by declareMethods().
{ if(field_p_stats.isEmpty()) { TVec<StatsCollector> st= getStats(); field_p_stats.resize(st.length()); CopiesMap cm; for(int i= 0; i < st.length(); ++i) field_p_stats[i]= st[i].deepCopy(cm); } return field_p_stats; }
virtual void PLearn::VMatrix::remote_savePMAT | ( | const PPath & | pmatfile | ) | const [inline, virtual] |
Definition at line 329 of file VMatrix.h.
Referenced by declareMethods().
{savePMAT(pmatfile,false);}
virtual void PLearn::VMatrix::remote_savePMAT_float | ( | const PPath & | pmatfile | ) | const [inline, virtual] |
Definition at line 330 of file VMatrix.h.
Referenced by declareMethods().
{savePMAT(pmatfile,true);}
void PLearn::VMatrix::removeAllStringMappings | ( | ) |
void PLearn::VMatrix::removeColumnStringMappings | ( | int | c | ) |
Remove all string mappings of a given field.
Definition at line 1117 of file VMatrix.cc.
References c.
{ init_map_sr(); map_sr[c].clear(); map_rs[c].clear(); }
void PLearn::VMatrix::removeStringMapping | ( | int | col, |
string | str | ||
) |
Removes a single string mapping.
Definition at line 1166 of file VMatrix.cc.
References PLearn::find().
{ init_map_sr(); map<string,real>::iterator sriterator; // Check if the mapping actually exists. if((sriterator = map_sr[col].find(str)) == map_sr[col].end()) return; real val = map_sr[col][str]; map_sr[col].erase(sriterator); map_rs[col].erase(map_rs[col].find(val)); }
virtual void PLearn::VMatrix::reset_dimensions | ( | ) | [inline, virtual] |
In case the dimensions of an underlying VMat has changed, recompute it.
Reimplemented in PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::CrossReferenceVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::ExtendedVMatrix, PLearn::ForwardVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::InterleaveVMatrix, PLearn::OneHotVMatrix, PLearn::PairsVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::ThresholdVMatrix, and PLearn::VecExtendedVMatrix.
Definition at line 621 of file VMatrix.h.
{ }
This function (used with .vmat datasets), is used to return the filename of fieldInfo files (string maps (.smap) and notes (.notes)).
It recursively navigates through links until it finds a suitable file (.smap or .notes) Idea : a .metadata/FieldInfo can contain one of these files : (the order show here is the one used by the function to searches the file)
fieldName.smap.lnk : containing the actual path+target OR another .lnk file
fieldName.smap : the target (the actual string map or comment file) __default.lnk : contains another FieldInfo directory to look for target (typically the
** Note 1: that target is assumed to be an inexistant file in the directory where none of the previous 3 can be found (since the file exists only when non-empty)
** Note 2: source may not be target
Definition at line 967 of file VMatrix.cc.
References PLearn::PPath::extension(), PLearn::isdir(), PLearn::isfile(), PLearn::loadFileAsString(), and PLearn::removeblanks().
Referenced by getSFIFFilename().
{ PPath contents = removeblanks( loadFileAsString(source) ); if ( contents == source ) return "ERROR"; if( isdir(contents) ) { if ( isfile(contents/target+".lnk") ) return resolveFieldInfoLink(target,contents/target+".lnk"); else if ( isfile(contents/target) ) return contents/target; else if( isfile(contents/"__default.lnk") ) return resolveFieldInfoLink(target, contents/"__default.lnk"); // assume target is there, but file is empty thus inexistant else return contents/target; } else if( contents.extension() == "lnk" ) return resolveFieldInfoLink(target,contents); else return contents; }
void PLearn::VMatrix::save | ( | const PPath & | filename | ) | const [virtual] |
This method overloads the Object::save method which is deprecated.
This method is therefore deprecated and you should call directly the savePMAT() method.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::CompactVMatrix, PLearn::ForwardVMatrix, and PLearn::SparseVMatrix.
Definition at line 2039 of file VMatrix.cc.
References PLDEPRECATED.
Referenced by PLearn::VariableDeletionVMatrix::build_(), PLearn::TextFilesVMatrix::generateMapCounts(), PLearn::GaussianizeVMatrix::setMetaDataDir(), and PLearn::RegressionTreeRegisters::sortRows().
{ PLDEPRECATED( "This method overloads the Object::save method which is " "deprecated. This method is therefore deprecated and you should call " "directly the savePMAT() method." ); savePMAT(filename); }
void PLearn::VMatrix::saveAllStringMappings | ( | ) |
Save all string mapings (one .smap file for each field).
Definition at line 1127 of file VMatrix.cc.
References i.
Referenced by declareMethods(), saveCMAT(), saveDMAT(), and savePMAT().
{ PPath fname; map<string, real> the_map; for(int i=0;i<width();i++) { the_map = getStringToRealMapping(i); if (!the_map.empty()) { fname = getSFIFFilename(i,".smap"); saveStringMappings(i, fname, &the_map); } } }
void PLearn::VMatrix::saveAMAT | ( | const PPath & | amatfile, |
bool | verbose = true , |
||
bool | no_header = false , |
||
bool | save_strings = false |
||
) | const [virtual] |
Save the content of the matrix in the AMAT ASCII format into a file.
If 'no_header' is set to 'true', then the AMAT header won't be saved, which can be useful to export data to other applications. If 'save_strings' is set to 'true', then the string mappings will be used so as to save strings where they exist (instead of saving the corresponding real value).
Reimplemented in PLearn::ForwardVMatrix.
Definition at line 2135 of file VMatrix.cc.
References PLearn::endl(), i, j, PLearn::openFile(), PLearn::space_to_underscore(), and w.
Referenced by declareMethods().
{ int l = length(); int w = width(); PStream out = openFile(amatfile, PStream::raw_ascii, "w"); if (!no_header) { out << "#size: "<< l << ' ' << w << endl; } if(w>0 && !no_header) { out << "#: "; for(int k=0; k<w; k++) //there must not be any space in a field name... out << space_to_underscore(fieldName(k)) << ' '; out << "\n"; } if(!no_header) out << "#sizes: " << inputsize() << ' ' << targetsize() << ' ' << weightsize() << ' ' << extrasize() << endl; PP<ProgressBar> pb; if (verbose) pb = new ProgressBar(cout, "Saving to amat", length()); if (save_strings) { TVec<string> v(w); for (int i = 0; i < l; i++) { getRowAsStrings(i, v); out << v << endl; if (verbose) pb->update(i+1); } } else { Vec v(w); for(int i=0;i<l;i++) { getRow(i,v); for(int j=0; j<w; j++) out << v[j] << ' '; out << "\n"; if (verbose) pb->update(i + 1); } } }
void PLearn::VMatrix::saveCMAT | ( | const PPath & | filename | ) | const [virtual] |
Definition at line 2181 of file VMatrix.cc.
References c, PLearn::endl(), i, PLearn::StatsCollector::isinteger(), j, m, PLearn::StatsCollector::max(), PLearn::StatsCollector::min(), PLearn::openFile(), PLCHECK, PLERROR, PLWARNING, PLearn::pout, PLearn::PStream::put(), saveAllStringMappings(), saveFieldInfos(), setMetaDataDir(), setMetaInfoFrom(), PLearn::TVec< T >::size(), and PLearn::sqrt().
{ PLWARNING("VMatrix::saveCMAT() - NOT FULLY IMPLEMENTED"); //calculate the datatype needed TVec<StatsCollector> stats = getStats(true); int max_bits=0; for(int i=0;i<stats.size();i++){ StatsCollector stat = stats[i]; if(! stat.isinteger()) PLERROR("VMatrix::saveCMAT() currently the source need to contain only integer."); if(stat.min()>=0){ int bits=(int)ceil(sqrt(stat.max())); if(max_bits<bits)max_bits=bits; }else{ PLERROR("not implemented to store negatif number."); } } //example 12000000 u:784:1:8 u:1:1:8 //write the header if(max_bits>8) PLERROR("VMatrix::saveCMAT() currently we convert to cmat with a maximum of 8 bits by fields!"); if(max_bits > 1 && max_bits<8){ max_bits=8; PLWARNING("VMatrix::saveCMAT() currently when we need less then 8 bits(except for 1), we upgrade to 8 bits."); } if(max_bits==0){ PLERROR("VMatrix::saveCMAT() - their was only 0 in the matrix! This is not supported as we don't think this can happen in real case!"); } //write the data if(max_bits==8){ PStream out = openFile(filename, PStream::raw_ascii, "w"); out<<length()<<" u:"<<width()<<":1:"<<max_bits<<endl; Vec v(width()); for(int i=0;i<length();i++){ getRow(i,v); for(int j=0;j<width();j++){ out.put((char)v[j]); } } }else if(max_bits==1){ PStream out = openFile(filename, PStream::raw_ascii, "w"); int w2=width()%8; int w1=width()-w2; PLCHECK(w2+w1==width()); PLCHECK(w1%8==0); PLCHECK(w1>0 && w2>=0); out<<length()<<" u:"<<w1<<":1:"<<max_bits; if(w2!=0) out<<" u:"<<w2<<":1:8"; out<<endl; Vec v(width()); for(int i=0;i<length();i++){ getRow(i,v); int j; for(j=0;j<w1;){ char c=0; for(int k=0;k<8;j++,k++){ c=c<<1; c|=((bool)v[j]); } //revert the bits char value=c; value = (value & 0x0f) << 4 | (value & 0xf0) >> 4; value = (value & 0x33) << 2 | (value & 0xcc) >> 2; value = (value & 0x55) << 1 | (value & 0xaa) >> 1; out.put(value); } PLCHECK(width()-j==w2); for(;j<width();j++){ out.put((char)v[j]); } } } else PLERROR("VMatrix::saveCMAT() - %d bits are not supported!",max_bits); CompactFileVMatrix m = CompactFileVMatrix(filename); m.setMetaDataDir(filename + ".metadata"); m.setMetaInfoFrom(this); m.saveFieldInfos(); m.saveAllStringMappings(); pout<<"generated the file " <<filename <<endl; }
void PLearn::VMatrix::saveDMAT | ( | const PPath & | dmatdir | ) | const [virtual] |
Save the VMatrix in DMat format.
Reimplemented in PLearn::ForwardVMatrix.
Definition at line 2111 of file VMatrix.cc.
References PLearn::DiskVMatrix::appendRow(), PLearn::force_rmdir(), i, saveAllStringMappings(), saveFieldInfos(), and setMetaInfoFrom().
Referenced by declareMethods().
{ force_rmdir(dmatdir); DiskVMatrix vm(dmatdir,width()); vm.setMetaInfoFrom(this); // vm.setFieldInfos(getFieldInfos()); // vm.copySizesFrom(this); Vec v(width()); ProgressBar pb(cout, "Saving to dmat", length()); for(int i=0;i<length();i++) { getRow(i,v); vm.appendRow(v); pb(i); } vm.saveFieldInfos(); vm.saveAllStringMappings(); }
void PLearn::VMatrix::saveFieldInfos | ( | ) | const |
Loads/saves from/to the metadatadir/fieldnames file.
Definition at line 842 of file VMatrix.cc.
References PLearn::endl(), extrasize_, fieldinfos, PLearn::force_mkdir(), getMetaDataDir(), getSavedFieldInfos(), getSavedSizes(), i, inputsize_, PLearn::TVec< T >::length(), PLearn::openFile(), PLearn::PStream::plearn_ascii, PLERROR, PLearn::PStream::raw_ascii, PLearn::TVec< T >::size(), targetsize_, and weightsize_.
Referenced by PLearn::FinancePreprocVMatrix::build_(), declareMethods(), PLearn::FileVMatrix::FileVMatrix(), saveCMAT(), saveDMAT(), savePMAT(), PLearn::DiskVMatrix::~DiskVMatrix(), and PLearn::FileVMatrix::~FileVMatrix().
{ // check if we need to save the fieldinfos if(fieldinfos.size() > 0) { Array<VMField> current_fieldinfos; try{ current_fieldinfos = getSavedFieldInfos(); }catch(PLearnError){} if (current_fieldinfos != fieldinfos) { // Ensure that the metadatadir exists if(!force_mkdir(getMetaDataDir())) PLERROR("In VMatrix::saveFieldInfos: could not create directory %s", getMetaDataDir().absolute().c_str()); PPath filename = getMetaDataDir() / "fieldnames"; PStream out = openFile(filename, PStream::raw_ascii, "w"); for(int i= 0; i < fieldinfos.length(); ++i) out << fieldinfos[i].name << '\t' << fieldinfos[i].fieldtype << endl; } } // check if we need to save the sizes int inp, targ, weight, extr; bool sizes_exist = getSavedSizes(inp, targ, weight, extr); if ((! sizes_exist && (inputsize_ != -1 || targetsize_ != -1 || weightsize_ != -1 || extrasize_ > 0)) || (sizes_exist && (inp != inputsize_ || targ != targetsize_ || weight != weightsize_ || extr!=extrasize_))) { // Slightly hackish phenomenon :: if the sizes file doesn't previously // exist and we cannot write them, THIS IS NOT AN ERROR. In this case, // just catch the error and continue try { // Ensure that the metadatadir exists if(!force_mkdir(getMetaDataDir())) PLERROR("In VMatrix::saveFieldInfos: could not create directory %s", getMetaDataDir().absolute().c_str()); PPath filename = getMetaDataDir() / "sizes"; PStream out = openFile(filename, PStream::plearn_ascii, "w"); out << inputsize_ << targetsize_ << weightsize_ << extrasize_ << endl; } catch (const PLearnError&) { if (sizes_exist) throw; } } }
void PLearn::VMatrix::savePMAT | ( | const PPath & | pmatfile, |
bool | force_float = false , |
||
bool | auto_float = false |
||
) | const [virtual] |
Save the VMatrix in PMat format.
Definition at line 2051 of file VMatrix.cc.
References PLearn::endl(), PLearn::force_rmdir(), i, j, m, PLearn::mv(), PLERROR, PLearn::pout, putRow(), PLearn::rm(), saveAllStringMappings(), saveFieldInfos(), and setMetaInfoFrom().
{ if (width() == -1) PLERROR("In VMat::save - Saving in a pmat file is only possible for constant width VMats (where width()!=-1)"); if(force_float && auto_float) PLERROR("VMatrix::savePMAT() - force_float an auto_float are incompatible option"); int nsamples = length(); PPath pmatfiletmp=pmatfile+".tmp"; if(auto_float){ #ifdef USEFLOAT PLERROR("VMatrix::savePMAT() - auto_float can't reliably select float or double when compiled in float. Compile it in double."); #endif Vec v(width()); bool found_not_equal=false; for(int i=0;i<length();i++){ getRow(i,v); for(int j=0;j<width();j++){ if( ((double)((float)(v[j])))!=v[j] ){ found_not_equal=true;break; } } } if(!found_not_equal){ force_float=true; pout<<"We will store the result matrix in FLOAT format."<<endl; } else pout<<"We will store the result matrix in DOUBLE format."<<endl; } { FileVMatrix m(pmatfiletmp,nsamples,width(),force_float); m.setMetaInfoFrom(this); // m.setFieldInfos(getFieldInfos()); // m.copySizesFrom(this); Vec tmpvec(width()); ProgressBar pb(cout, "Saving to pmat", nsamples); for(int i=0; i<nsamples; i++) { getRow(i,tmpvec); m.putRow(i,tmpvec); pb(i); } m.saveFieldInfos(); m.saveAllStringMappings(); }// to ensure that m is deleted? rm(pmatfile); force_rmdir(pmatfile+".metadata"); mv(pmatfiletmp,pmatfile); mv(pmatfiletmp+".metadata",pmatfile+".metadata"); }
void PLearn::VMatrix::saveStats | ( | const PPath & | filename | ) | const |
Definition at line 809 of file VMatrix.cc.
References PLearn::endl(), fieldstats, j, PLearn::openFile(), PLearn::PStream::raw_ascii, PLearn::TVec< T >::size(), and PLearn::Array< T >::write().
{ PStream out = openFile(filename, PStream::raw_ascii, "w"); out << fieldstats.size() << endl; for(int j=0; j<fieldstats.size(); j++) { fieldstats[j].write(out); out << endl; } }
void PLearn::VMatrix::saveStringMappings | ( | int | col, |
const PPath & | fname, | ||
map< string, real > * | str_to_real = 0 |
||
) |
Save a single field's string mapping in file 'fname'.
The corresponding string -> real mapping can optionally be given in argument, otherwise it will be obtained through the getStringToRealMapping() method.
Definition at line 1144 of file VMatrix.cc.
References PLearn::endl(), PLearn::force_mkdir_for_file(), PLearn::openFile(), and PLearn::rm().
{ map<string, real> the_map; if (!str_to_real) { the_map = getStringToRealMapping(col); str_to_real = &the_map; } if(str_to_real->empty()) { rm(fname); return; } force_mkdir_for_file(fname); PStream o = openFile(fname, PStream::plearn_ascii, "w"); for(map<string,real>::iterator it = str_to_real->begin(); it != str_to_real->end(); ++it) o << it->first << it->second << endl; }
Set field information.
It is a 'const' method because it is called from other 'const' methods.
Definition at line 458 of file VMatrix.cc.
References fieldinfos.
Referenced by PLearn::SubInputVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MovingAverageVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::AddBagInformationVMatrix::build_(), and loadFieldInfos().
{ fieldinfos=finfo; }
void PLearn::VMatrix::setMetaDataDir | ( | const PPath & | the_metadatadir | ) | [virtual] |
This should be called by the build method of every VMatrix that has a metadatadir.
It will create said directory if it doesn's already exist. Throws a PLERROR if called with an empty string.
Reimplemented in PLearn::FilteredVMatrix, PLearn::GaussianizeVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::PrecomputedVMatrix, PLearn::SourceVMatrix, and PLearn::TextFilesVMatrix.
Definition at line 1271 of file VMatrix.cc.
References PLearn::PPath::absolute(), PLearn::PPath::isEmpty(), and PLERROR.
Referenced by build_(), PLearn::ForwardVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), saveCMAT(), PLearn::TextFilesVMatrix::setMetaDataDir(), PLearn::SourceVMatrix::setMetaDataDir(), and PLearn::MeanMedianModeImputationVMatrix::setMetaDataDir().
{ if (the_metadatadir.isEmpty()) PLERROR("In VMatrix::setMetaDataDir - Called setMetaDataDir with an empty PPath"); metadatadir = the_metadatadir.absolute() / ""; // We do not create the metadata directory here anymore. // This is to prevent the proliferation of useless directories. // A VMatrix's subclass should now create the metadatadir itself if it needs it. // Load string mappings from the metadatadir. loadAllStringMappings(); }
void PLearn::VMatrix::setMetaInfoFrom | ( | const VMatrix * | vm | ) | [virtual] |
Sets all meta info (length_, width_, inputsize_, targetsize_, weightsize_, extrasize_, fieldnames, ...) that is not already set, by copying it from the source's Vmat vm.
Modification time is also set to the latest of the current mtime of this vmat and of the mtime of the source. Sizes will be copied only if they are consistent with this VMat's width.
Definition at line 1316 of file VMatrix.cc.
References extrasize(), fieldIndex(), getFieldInfos(), getMtime(), getStringToRealMapping(), hasFieldInfos(), i, inputsize(), length(), max, PLearn::pl_isnumber(), targetsize(), weightsize(), width(), and PLearn::ws().
Referenced by PLearn::ViewSplitterVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::MemoryVMatrix::build_(), PLearn::MeanMedianModeImputationVMatrix::build_(), PLearn::InterleaveVMatrix::build_(), PLearn::ForwardVMatrix::build_(), PLearn::ConcatRowsSubVMatrix::build_(), PLearn::ClassSubsetVMatrix::build_(), PLearn::BinaryOpVMatrix::build_(), declareMethods(), saveCMAT(), saveDMAT(), savePMAT(), PLearn::SourceVMatrix::setMetaInfoFromSource(), and PLearn::MemoryVMatrix::subMat().
{ updateMtime(vm->getMtime()); // copy length and width from vm if not set if(length_<0) length_ = vm->length(); if(width_<0) width_ = vm->width(); // Copy sizes from vm if not set and they do not conflict with the width. int current_w = max(0, inputsize_) + max(0, targetsize_) + max(0, weightsize_) + max(0, extrasize_); int is = vm->inputsize(); if(inputsize_<0 && is>=0) { if (is + current_w <= width_) { inputsize_ = is; current_w += is; } } int ts = vm->targetsize(); if(targetsize_<0 && ts>=0) { if (ts + current_w <= width_) { targetsize_ = ts; current_w += ts; } } int ws = vm->weightsize(); if(weightsize_<0 && ws>=0) { if (ws + current_w <= width_) { // We must also ensure the total sum of sizes (if available) // will match the width. Otherwise we may end up with sizes // conflicting with the width. if (inputsize_ < 0 || targetsize_ < 0 || extrasize_ < 0 || inputsize_ + targetsize_ + extrasize_ + ws == width_) { weightsize_ = ws; current_w += ws; } } } int es = vm->extrasize(); if(extrasize_<=0 && es>=0) { if (es + current_w <= width_) { // Same as above. if (inputsize_ < 0 || targetsize_ < 0 || weightsize_ < 0 || inputsize_ + targetsize_ + weightsize_ + es == width_) { extrasize_ = es; current_w += es; } } } // Fill missing size if possible, also display warning when sizes are not // compatible with the width. computeMissingSizeValue(false); // Copy fieldnames from vm if not set and they look good. bool same_fields_as_source = (!hasFieldInfos() && (width() == vm->width()) && vm->hasFieldInfos()); if(same_fields_as_source) setFieldInfos(vm->getFieldInfos()); // Copy string <-> real mappings for fields which have the same name (or for // all fields if it looks like the fields are the same as the source). TVec<string> fnames = fieldNames(); for (int i = 0; i < width_; i++) { int vm_index = -1; if (same_fields_as_source) vm_index = i; else if (!pl_isnumber(fnames[i])) vm_index = vm->fieldIndex(fnames[i]); if (vm_index >= 0) // The source VMatrix has a field with the same name (which is not a // number): we can get its string mapping. setStringMapping(i, vm->getStringToRealMapping(vm_index)); } //we save it now in case the program crash if(hasMetaDataDir()) saveFieldInfos(); }
void PLearn::VMatrix::setMtime | ( | time_t | t | ) | [inline] |
Preferably use updateMtime()! Sets the "last modification" time for this matrix, this should be called by the constructor to reflect the mtime of the disk files.
Definition at line 405 of file VMatrix.h.
Referenced by PLearn::FileVMatrix::build_().
{ mtime_ = t; }
void PLearn::VMatrix::setSFIFFilename | ( | string | fieldname, |
string | ext, | ||
const PPath & | filepath = "" |
||
) |
Definition at line 1014 of file VMatrix.cc.
References PLearn::endl(), PLearn::force_mkdir_for_file(), getSFIFDirectory(), PLearn::makeFileNameValid(), PLearn::openFile(), PLearn::PStream::raw_ascii, and PLearn::rm().
{ PPath target = makeFileNameValid(fieldname+ext); PPath normalfname = getSFIFDirectory() / target; PPath normalfname_lnk = normalfname + ".lnk"; rm(normalfname_lnk); if(filepath==normalfname || filepath=="") { rm(normalfname_lnk); return; } force_mkdir_for_file(normalfname); PStream o = openFile(normalfname_lnk, PStream::raw_ascii, "w"); o<<filepath<<endl; }
These 3 functions deal with stringmaps, notes, and binning files (all three called Special Field Info Files, or 'SFIF') for each field eventually, I (julien) guess all this info should be wrapped (thus saved, and loaded) in the VMField class.
SFIFs, are by default located in the directory MyDataset.{amat,vmat,etc}.metadata/FieldInfo/ and are named 'fieldname'.{smap,notes,binning,...}. In all 3 functions, the parameter ext (given **with** the dot) specifies the extension of the special field info file [smap,notes,binning], and col is the column index you refer to.
setSFIFFilename : sets the SFIF with extensions 'ext' to some 'string'. if this string is different from the default filename, the string is actually placed in a new file called [dataset].metadata/FieldInfo/fieldname.[ext].lnk if the 'string' is empty, the default SFIF filename is assumed, which is : [MyDataset].metadata/FieldInfo/fieldname.[ext]
Definition at line 1009 of file VMatrix.cc.
References fieldName().
Referenced by PLearn::SourceVMatrix::setMetaDataDir().
{ setSFIFFilename(fieldName(col),ext,filepath); }
overwrite the string<->real mapping with this one (and build the reverse mapping).
Definition at line 1181 of file VMatrix.cc.
Referenced by PLearn::EncodedVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), declareMethods(), and PLearn::IndexedVMatrix::ensureMappingsConsistency().
{ init_map_sr(); map_sr[col]=zemap; map_rs[col].clear(); for(map<string,real>::iterator it = map_sr[col].begin();it!=map_sr[col].end();++it) map_rs[col][it->second]=it->first; }
Default version returns a SubVMatrix referencing the current VMatrix however this can be overridden to provide more efficient shortcuts (see MemoryVMatrix::subMat and SubVMatrix::subMat for examples)
Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::SubVMatrix.
Definition at line 1956 of file VMatrix.cc.
Referenced by declareMethods(), and PLearn::VMat::subMatRows().
{ return new SubVMatrix(this,i,j,l,w); }
TVec< string > PLearn::VMatrix::targetFieldNames | ( | ) | const [virtual] |
Returns the names of the target fields (if any)
Definition at line 517 of file VMatrix.cc.
References fieldNames(), inputsize_, PLearn::TVec< T >::subVec(), and targetsize_.
{ return fieldNames().subVec(inputsize_, targetsize_); }
int PLearn::VMatrix::targetsize | ( | ) | const [inline] |
Target size accessor.
Definition at line 473 of file VMatrix.h.
Referenced by PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::ClassSubsetVMatrix::build_(), PLearn::TemporalHorizonVMatrix::declareOptions(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), getExamples(), PLearn::MixUnlabeledNeighbourVMatrix::getNewRow(), PLearn::KNNVMatrix::getNewRow(), setMetaInfoFrom(), PLearn::VMat::subMatRows(), and PLearn::TemporalHorizonVMatrix::TemporalHorizonVMatrix().
{ return targetsize_; }
Mat PLearn::VMatrix::toMat | ( | ) | const [virtual] |
Returns a Mat with the same data as this VMat.
The default version of this method calls toMatCopy(). However this method will typically be overrided by subclasses (such as MemoryVMatrix) whose internal representation is already a Mat in order to return this Mat directly to avoid a new memory allocation and copy of elements. In this case, and in this case only, modifying the elements of the returned Mat will logically result in modified elements in the original VMatrix view of it. If you want to be sure that altering the content of the returned Mat won't modify the data contained in the VMatrix, you should call toMatCopy() instead.
Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::VMatrixFromDistribution.
Definition at line 1941 of file VMatrix.cc.
Referenced by PLearn::RankedVMatrix::build_(), declareMethods(), and PLearn::FileVMatrixTest::perform().
{ return toMatCopy(); }
Mat PLearn::VMatrix::toMatCopy | ( | ) | const |
void PLearn::VMatrix::unduplicateFieldNames | ( | ) |
Add a numeric suffix to duplicated fieldNames (eg: field.1 field.2 etc..).
Definition at line 485 of file VMatrix.cc.
References fieldinfos, getFieldInfos(), i, j, PLearn::tostring(), and width().
Referenced by PLearn::ConcatColumnsVMatrix::build_().
{ map<string,vector<int> > mp; for(int i=0;i<width();i++) mp[getFieldInfos(i).name].push_back(i); map<string,vector<int> >::iterator it; for(it=mp.begin();it!=mp.end();++it) if(it->second.size()!=1) { vector<int> v=it->second; for(unsigned int j=0;j<v.size();j++) fieldinfos[v[j]].name+="."+tostring(j); } }
void PLearn::VMatrix::unlockMetaDataDir | ( | ) | const |
Removes the .lock file inside the metadatadir.
It will throw a PLearnError if this object did not hold the lock.
Definition at line 1488 of file VMatrix.cc.
References PLERROR, and PLearn::rm().
Referenced by PLearn::FilteredVMatrix::openIndex().
{ #ifndef DISABLE_VMATRIX_LOCK if(!lockf_) PLERROR("In VMatrix::unlockMetaDataDir() was called while no lock is held by this object"); lockf_ = PStream(); // Release the lock. PPath lockfile = metadatadir / ".lock"; rm(lockfile); // Remove the file. #endif }
void PLearn::VMatrix::updateMtime | ( | const PPath & | p | ) |
Definition at line 1599 of file VMatrix.cc.
References PLearn::PPath::isEmpty(), and PLearn::mtime().
{if(!p.isEmpty())updateMtime(mtime(p));}
void PLearn::VMatrix::updateMtime | ( | time_t | t | ) |
Update the "last modification" time for this matrix.
this should be called by the constructor for all dependence, file or other VMatrix, VMat This fonction remember the time that is the more recent. If a dependence have a mtime of 0, getMtime() will always return 0 as if a dependence have an unknow mtime, we should have an unknow mtime
Definition at line 1592 of file VMatrix.cc.
References max.
Referenced by build_(), PLearn::ViewSplitterVMatrix::build_(), PLearn::VecExtendedVMatrix::build_(), PLearn::VariableDeletionVMatrix::build_(), PLearn::TemporaryFileVMatrix::build_(), PLearn::TemporaryDiskVMatrix::build_(), PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SplitWiseValidationVMatrix::build_(), PLearn::SortRowsVMatrix::build_(), PLearn::ShuffleColumnsVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectRowsFileIndexVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::ReplicateSamplesVMatrix::build_(), PLearn::ReorderByMissingVMatrix::build_(), PLearn::RemoveDuplicateVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::RealFunctionsProcessedVMatrix::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::RandomNeighborsDifferencesVMatrix::build_(), PLearn::PutSubVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::ProcessDatasetVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MultiInstanceVMatrix::build_(), PLearn::MovingAverageVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MissingIndicatorVMatrix::build_(), PLearn::MeanMedianModeImputationVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LocalNeighborsDifferencesVMatrix::build_(), PLearn::LocallyPrecomputedVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::KNNImputationVMatrix::build_(), PLearn::KernelVMatrix::build_(), PLearn::JoinVMatrix::build_(), PLearn::InterleaveVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::GramVMatrix::build_(), PLearn::GaussianizeVMatrix::build_(), PLearn::FinancePreprocVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::EncodedVMatrix::build_(), PLearn::DisregardRowsVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::DictionaryVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::DatedJoinVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::CrossReferenceVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), PLearn::BootstrapVMatrix::build_(), PLearn::BinaryOpVMatrix::build_(), PLearn::BinaryNumbersVMatrix::build_(), PLearn::AsciiVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), PLearn::AddMissingVMatrix::build_(), PLearn::AddBagInformationVMatrix::build_(), PLearn::TextFilesVMatrix::loadMappings(), PLearn::TextFilesVMatrix::setMetaDataDir(), PLearn::SparseVMatrix::SparseVMatrix(), and PLearn::ThresholdVMatrix::ThresholdVMatrix().
{ if(t>mtime_ && mtime_!=numeric_limits<time_t>::max()) mtime_=t; else if(t==0) mtime_=numeric_limits<time_t>::max(); }
void PLearn::VMatrix::updateMtime | ( | VMat | v | ) |
Definition at line 1601 of file VMatrix.cc.
{if(v)updateMtime(v->getMtime());}
TVec< string > PLearn::VMatrix::weightFieldNames | ( | ) | const [virtual] |
Returns the names of the weight fields (if any)
Definition at line 520 of file VMatrix.cc.
References fieldNames(), inputsize_, PLearn::TVec< T >::subVec(), targetsize_, and weightsize_.
{ return fieldNames().subVec(inputsize_+targetsize_, weightsize_); }
int PLearn::VMatrix::weightsize | ( | ) | const [inline] |
Weight size accessor.
Definition at line 476 of file VMatrix.h.
Referenced by PLearn::SubVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RegressionTreeRegisters::getAllRegisteredRow(), PLearn::RegressionTreeRegisters::getExample(), PLearn::KNNVMatrix::getNewRow(), PLearn::AppendNeighborsVMatrix::getNewRow(), getSavedSizes(), setMetaInfoFrom(), and PLearn::VMat::subMatRows().
{ return weightsize_; }
int PLearn::VMatrix::width | ( | ) | const [inline] |
Return the number of columns in the VMatrix.
Definition at line 429 of file VMatrix.h.
References PLERROR.
Referenced by PLearn::JoinVMatrix::addStatField(), PLearn::CompactVMatrix::append(), PLearn::DiskVMatrix::appendRow(), PLearn::AsciiVMatrix::appendRow(), PLearn::AsciiVMatrix::AsciiVMatrix(), PLearn::TextFilesVMatrix::autoBuildMappings(), PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MemoryVMatrix::build_(), PLearn::JoinVMatrix::build_(), PLearn::InterleaveVMatrix::build_(), PLearn::GeneralizedOneHotVMatrix::build_(), PLearn::ExtendedVMatrix::build_(), PLearn::DisregardRowsVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), PLearn::AsciiVMatrix::build_(), PLearn::CompactVMatrix::CompactVMatrix(), PLearn::MeanImputationVMatrix::computeMeanVector(), computeStats(), declareFieldNames(), PLearn::SparseVMatrix::dot(), PLearn::MemoryVMatrix::dot(), PLearn::ConcatColumnsVMatrix::dot(), PLearn::CompactVMatrix::dot(), PLearn::CompactVMatrix::dotProduct(), PLearn::ConcatRowsVMatrix::ensureMappingsConsistency(), fieldIndex(), fieldNames(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), PLearn::SubVMatrix::get(), PLearn::RowBufferedVMatrix::get(), PLearn::NistDB::get(), PLearn::KernelVMatrix::get(), PLearn::InterleaveVMatrix::get(), PLearn::CrossReferenceVMatrix::get(), PLearn::ByteMemoryVMatrix::get(), PLearn::SubVMatrix::getDictionary(), PLearn::ConcatColumnsVMatrix::getDictionary(), getFieldIndex(), getFieldInfos(), PLearn::SubVMatrix::getMat(), PLearn::VecExtendedVMatrix::getNewRow(), PLearn::ThresholdVMatrix::getNewRow(), PLearn::SparseVMatrix::getNewRow(), PLearn::RemapLastColumnVMatrix::getNewRow(), PLearn::RegularGridVMatrix::getNewRow(), PLearn::OneHotVMatrix::getNewRow(), PLearn::MixUnlabeledNeighbourVMatrix::getNewRow(), PLearn::JoinVMatrix::getNewRow(), PLearn::IndexedVMatrix::getNewRow(), PLearn::GeneralizedOneHotVMatrix::getNewRow(), PLearn::ExtendedVMatrix::getNewRow(), PLearn::DiskVMatrix::getNewRow(), PLearn::CompactVMatrix::getNewRow(), PLearn::AutoSDBVMatrix::getNewRow(), PLearn::AsciiVMatrix::getNewRow(), PLearn::IntStreamVMatrix::getRow(), PLearn::ForwardVMatrix::getRow(), PLearn::CrossReferenceVMatrix::getRow(), getSavedFieldInfos(), PLearn::SubVMatrix::getString(), PLearn::ConcatColumnsVMatrix::getString(), PLearn::ConcatColumnsVMatrix::getStringMapping(), PLearn::SubVMatrix::getStringVal(), PLearn::ConcatColumnsVMatrix::getStringVal(), PLearn::SubVMatrix::getSubRow(), PLearn::RowBufferedVMatrix::getSubRow(), PLearn::NistDB::getSubRow(), PLearn::MemoryVMatrix::getSubRow(), PLearn::KernelVMatrix::getSubRow(), PLearn::InterleaveVMatrix::getSubRow(), PLearn::SubVMatrix::getValString(), PLearn::ConcatColumnsVMatrix::getValString(), PLearn::SubVMatrix::getValues(), PLearn::ConcatColumnsVMatrix::getValues(), hasFieldInfos(), init_map_sr(), loadStats(), PLearn::Preprocessing::manageTrainTestUnknownSets(), PLearn::operator<<(), PLearn::FileVMatrixTest::perform(), PLearn::CompactVMatrix::perturb(), printFields(), PLearn::SubVMatrix::put(), PLearn::ConcatColumnsVMatrix::put(), PLearn::SubVMatrix::putMat(), PLearn::SubVMatrix::putSubRow(), PLearn::MemoryVMatrix::putSubRow(), PLearn::ConcatRowsVMatrix::recomputeDimensions(), PLearn::GaussianizeVMatrix::setMetaDataDir(), setMetaInfoFrom(), PLearn::TemporalHorizonVMatrix::TemporalHorizonVMatrix(), PLearn::ImputationVMatrix::testResultantVMatrix(), and unduplicateFieldNames().
friend class VMat [friend] |
Definition at line 80 of file VMatrix.h.
Referenced by PLearn::RegressionTreeRegisters::build_(), PLearn::AutoVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::instantiateFromPPath(), PLearn::ForwardVMatrix::setVMat(), PLearn::YMDDatedVMatrix::subDistrAbsoluteUnits(), and PLearn::YMDDatedVMatrix::subDistrRelativeDates().
Reimplemented from PLearn::Object.
Reimplemented in PLearn::PythonProcessedVMatrix, PLearn::AddBagInformationVMatrix, PLearn::AddMissingVMatrix, PLearn::AppendNeighborsVMatrix, PLearn::AsciiVMatrix, PLearn::AutoVMatrix, PLearn::AutoVMatrixSaveSource, PLearn::BinaryNumbersVMatrix, PLearn::BinaryOpVMatrix, PLearn::BootstrapVMatrix, PLearn::ByteMemoryVMatrix, PLearn::CenteredVMatrix, PLearn::ClassSubsetVMatrix, PLearn::CompactFileVMatrix, PLearn::CompactVMatrix, PLearn::CompressedVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ConstantVMatrix, PLearn::CrossReferenceVMatrix, PLearn::CumVMatrix, PLearn::DatedJoinVMatrix, PLearn::DatedVMatrix, PLearn::BatchVMatrix, PLearn::LearnerProcessedVMatrix, PLearn::RemoveRowsVMatrix, PLearn::YMDDatedVMatrix, PLearn::DichotomizeVMatrix, PLearn::DictionaryVMatrix, PLearn::DiskVMatrix, PLearn::DisregardRowsVMatrix, PLearn::EncodedVMatrix, PLearn::NetflixVMatrix, PLearn::ExtendedVMatrix, PLearn::ExtractNNetParamsVMatrix, PLearn::FileVMatrix, PLearn::FilteredVMatrix, PLearn::FinancePreprocVMatrix, PLearn::ForwardVMatrix, PLearn::GaussianizeVMatrix, PLearn::GeneralizedOneHotVMatrix, PLearn::GetInputVMatrix, PLearn::GramVMatrix, PLearn::ImputationVMatrix, PLearn::IndexedVMatrix, PLearn::InfiniteMNISTVMatrix, PLearn::InterleaveVMatrix, PLearn::JoinVMatrix, PLearn::JulianizeVMatrix, PLearn::KernelVMatrix, PLearn::KNNImputationVMatrix, PLearn::KNNVMatrix, PLearn::LemmatizeVMatrix, PLearn::LIBSVMSparseVMatrix, PLearn::LocallyPrecomputedVMatrix, PLearn::LocalNeighborsDifferencesVMatrix, PLearn::MeanImputationVMatrix, PLearn::MeanMedianModeImputationVMatrix, PLearn::MemoryVMatrix, PLearn::MemoryVMatrixNoSave, PLearn::MissingIndicatorVMatrix, PLearn::MissingInstructionVMatrix, PLearn::MixtureVMatrix, PLearn::MixUnlabeledNeighbourVMatrix, PLearn::MovingAverageVMatrix, PLearn::MultiInstanceVMatrix, PLearn::MultiTargetOneHotVMatrix, PLearn::MultiToUniInstanceSelectRandomVMatrix, PLearn::OneHotVMatrix, PLearn::OneVsAllVMatrix, PLearn::PairsVMatrix, PLearn::PLearnerOutputVMatrix, PLearn::PrecomputedVMatrix, PLearn::ProcessDatasetVMatrix, PLearn::ProcessingVMatrix, PLearn::ProcessSymbolicSequenceVMatrix, PLearn::PutSubVMatrix, PLearn::PythonTableVMatrix, PLearn::RandomNeighborsDifferencesVMatrix, PLearn::RandomSamplesFromVMatrix, PLearn::RandomSamplesVMatrix, PLearn::RangeVMatrix, PLearn::RankedVMatrix, PLearn::RealFunctionsProcessedVMatrix, PLearn::RegularGridVMatrix, PLearn::ReIndexedTargetVMatrix, PLearn::RemapLastColumnVMatrix, PLearn::RemoveDuplicateVMatrix, PLearn::ReorderByMissingVMatrix, PLearn::RepeatVMatrix, PLearn::ReplicateSamplesVMatrix, PLearn::RowBufferedVMatrix, PLearn::RowsSubVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsMultiInstanceVMatrix, PLearn::SelectRowsVMatrix, PLearn::SeparateInputVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::ShuffleColumnsVMatrix, PLearn::SortRowsVMatrix, PLearn::SourceVMatrix, PLearn::SparseVMatrix, PLearn::SplitWiseValidationVMatrix, PLearn::StochasticBinarizeVMatrix, PLearn::StrTableVMatrix, PLearn::SubInputVMatrix, PLearn::SubVMatrix, PLearn::TemporalHorizonVMatrix, PLearn::TemporaryDiskVMatrix, PLearn::TemporaryFileVMatrix, PLearn::TextFilesVMatrix, PLearn::TextStreamVMatrix, PLearn::TransposeVMatrix, PLearn::UCIDataVMatrix, PLearn::UniformizeVMatrix, PLearn::UniformVMatrix, PLearn::UpsideDownVMatrix, PLearn::ValueSelectRowsVMatrix, PLearn::VariableDeletionVMatrix, PLearn::VecExtendedVMatrix, PLearn::ViewSplitterVMatrix, PLearn::PreprocessingVMatrix, PLearn::VMatrixFromDistribution, PLearn::VVMatrix, PLearn::ConditionalMeanImputationVMatrix, PLearn::CovariancePreservationImputationVMatrix, PLearn::NeighborhoodImputationVMatrix, PLearn::TextSenseSequenceVMatrix, and PLearn::RegressionTreeRegisters.
Vec PLearn::VMatrix::dotrow_1 [mutable, private] |
Used in the default dot(i,j) method to store the i-th and j-th rows.
Definition at line 89 of file VMatrix.h.
Referenced by makeDeepCopyFromShallowCopy().
Vec PLearn::VMatrix::dotrow_2 [mutable, private] |
Definition at line 90 of file VMatrix.h.
Referenced by makeDeepCopyFromShallowCopy().
int PLearn::VMatrix::extrasize_ [mutable, protected] |
Definition at line 105 of file VMatrix.h.
Referenced by PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), declareOptions(), PLearn::VariableDeletionVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), extraFieldNames(), getExtra(), PLearn::ProcessingVMatrix::getNewRow(), loadFieldInfos(), and saveFieldInfos().
TVec<PP<StatsCollector> > PLearn::VMatrix::field_p_stats [mutable, protected] |
TVec<StatsCollector> PLearn::VMatrix::field_stats [mutable, protected] |
Statistics for each field.
stats[i] contains stats for field i
Definition at line 115 of file VMatrix.h.
Referenced by makeDeepCopyFromShallowCopy(), and PLearn::ImputationVMatrix::testResultantVMatrix().
Array<VMField> PLearn::VMatrix::fieldinfos [mutable] |
Definition at line 135 of file VMatrix.h.
Referenced by PLearn::PreprocessingVMatrix::build_(), PLearn::VecExtendedVMatrix::build_(), PLearn::TextSenseSequenceVMatrix::build_(), PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsFileIndexVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemoveRowsVMatrix::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::DatedJoinVMatrix::build_(), PLearn::CrossReferenceVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), PLearn::ConcatRowsSubVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::BatchVMatrix::build_(), PLearn::CompactVMatrix::CompactVMatrix(), declareOptions(), PLearn::ConcatRowsVMatrix::findAllFields(), PLearn::ConcatRowsVMatrix::findCommonFields(), getFieldInfos(), hasFieldInfos(), makeDeepCopyFromShallowCopy(), saveFieldInfos(), setFieldInfos(), PLearn::SparseVMatrix::SparseVMatrix(), PLearn::TemporalHorizonVMatrix::TemporalHorizonVMatrix(), and unduplicateFieldNames().
Definition at line 136 of file VMatrix.h.
Referenced by PLearn::CompactVMatrix::CompactVMatrix(), computeStats(), loadStats(), makeDeepCopyFromShallowCopy(), PLearn::CompactVMatrix::perturb(), and saveStats().
Vec PLearn::VMatrix::get_row [mutable, private] |
Used in the 'find' method to store a row.
Definition at line 86 of file VMatrix.h.
Referenced by makeDeepCopyFromShallowCopy().
int PLearn::VMatrix::inputsize_ [mutable, protected] |
For training/testing data sets we assume each row is composed of 4 parts: an input part, a target part, and a weight part.
These fields give those parts' lengths.
Definition at line 102 of file VMatrix.h.
Referenced by PLearn::VMatrixFromDistribution::build_(), PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SubInputVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::RegularGridVMatrix::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MultiInstanceVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), PLearn::AddBagInformationVMatrix::build_(), declareOptions(), PLearn::VariableDeletionVMatrix::declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), extraFieldNames(), PLearn::LemmatizeVMatrix::getDictionary(), getExample(), PLearn::RegressionTreeRegisters::getExample(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), getExtra(), PLearn::SeparateInputVMatrix::getNewRow(), PLearn::SelectRowsMultiInstanceVMatrix::getNewRow(), PLearn::ReIndexedTargetVMatrix::getNewRow(), PLearn::RankedVMatrix::getNewRow(), PLearn::ProcessingVMatrix::getNewRow(), PLearn::OneVsAllVMatrix::getNewRow(), PLearn::MultiTargetOneHotVMatrix::getNewRow(), PLearn::LIBSVMSparseVMatrix::getNewRow(), PLearn::LemmatizeVMatrix::getNewRow(), PLearn::KNNImputationVMatrix::getNewRow(), PLearn::InfiniteMNISTVMatrix::getNewRow(), PLearn::AppendNeighborsVMatrix::getNewRow(), PLearn::LemmatizeVMatrix::getStringVal(), PLearn::LemmatizeVMatrix::getValString(), PLearn::ProcessSymbolicSequenceVMatrix::getValues(), PLearn::LemmatizeVMatrix::getValues(), inputFieldNames(), loadFieldInfos(), PLearn::ForwardVMatrix::reset_dimensions(), saveFieldInfos(), targetFieldNames(), and weightFieldNames().
int PLearn::VMatrix::length_ [mutable, protected] |
Length of the VMatrix.
Definition at line 96 of file VMatrix.h.
Referenced by PLearn::CompactVMatrix::append(), PLearn::MemoryVMatrix::appendRow(), PLearn::FileVMatrix::appendRow(), PLearn::DiskVMatrix::appendRow(), PLearn::CompressedVMatrix::appendRow(), PLearn::AsciiVMatrix::appendRow(), PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), PLearn::VMatrixFromDistribution::build_(), PLearn::PreprocessingVMatrix::build_(), PLearn::TextSenseSequenceVMatrix::build_(), PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SplitWiseValidationVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectRowsFileIndexVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RepeatVMatrix::build_(), PLearn::RegularGridVMatrix::build_(), PLearn::RealFunctionsProcessedVMatrix::build_(), PLearn::RangeVMatrix::build_(), PLearn::RandomSamplesVMatrix::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::RandomNeighborsDifferencesVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MultiInstanceVMatrix::build_(), PLearn::MovingAverageVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MemoryVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LocalNeighborsDifferencesVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::LearnerProcessedVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::InterleaveVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::IndexedVMatrix::build_(), PLearn::GramVMatrix::build_(), PLearn::GeneralizedOneHotVMatrix::build_(), PLearn::ForwardVMatrix::build_(), PLearn::FinancePreprocVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::ExtractNNetParamsVMatrix::build_(), PLearn::ExtendedVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::DictionaryVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::DatedJoinVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::ConcatRowsSubVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), PLearn::BatchVMatrix::build_(), PLearn::AsciiVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), PLearn::TextFilesVMatrix::buildIdx(), PLearn::MissingIndicatorVMatrix::buildNewRecordFormat(), PLearn::DiskVMatrix::closeCurrentFiles(), PLearn::CompressedVMatrix::compacify(), PLearn::CompactVMatrix::CompactVMatrix(), PLearn::FilteredVMatrix::computeFilteredIndices(), declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::SelectRowsVMatrix::declareOptions(), PLearn::SelectColumnsVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::ForwardVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), PLearn::ExtractNNetParamsVMatrix::declareOptions(), PLearn::RowBufferedVMatrix::dot(), PLearn::ConcatColumnsVMatrix::dot(), PLearn::CompactVMatrix::dot(), PLearn::SelectColumnsVMatrix::get(), PLearn::RowBufferedVMatrix::get(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), PLearn::LIBSVMSparseVMatrix::getExample(), PLearn::LIBSVMSparseVMatrix::getExtra(), PLearn::UpsideDownVMatrix::getNewRow(), PLearn::ProcessSymbolicSequenceVMatrix::getNewRow(), PLearn::PairsVMatrix::getNewRow(), PLearn::ConcatColumnsVMatrix::getNewRow(), PLearn::CompressedVMatrix::getNewRow(), PLearn::CompactVMatrix::getNewRow(), PLearn::AddBagInformationVMatrix::getNewRow(), PLearn::RowBufferedVMatrix::getRow(), PLearn::FileVMatrix::getSizeOnDisk(), PLearn::SelectColumnsVMatrix::getSubRow(), PLearn::RowBufferedVMatrix::getSubRow(), PLearn::ProcessSymbolicSequenceVMatrix::getValues(), PLearn::LemmatizeVMatrix::getValues(), PLearn::DictionaryVMatrix::getValues(), PLearn::CompressedVMatrix::init(), PLearn::NistDB::NistDB(), PLearn::FilteredVMatrix::openIndex(), PLearn::CompactVMatrix::perturb(), PLearn::ConcatRowsVMatrix::recomputeDimensions(), PLearn::SubVMatrix::reset_dimensions(), PLearn::ForwardVMatrix::reset_dimensions(), PLearn::RowsSubVMatrix::RowsSubVMatrix(), PLearn::SDBVMatrix::SDBVMatrix(), PLearn::TextFilesVMatrix::setMetaDataDir(), PLearn::CompactVMatrix::squareDifference(), PLearn::FileVMatrix::updateHeader(), and PLearn::PrecomputedVMatrix::usePrecomputed().
PStream PLearn::VMatrix::lockf_ [mutable, private] |
TVec<map<real,string> > PLearn::VMatrix::map_rs [mutable, protected] |
Definition at line 120 of file VMatrix.h.
Referenced by addStringMapping(), PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), PLearn::SubVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::IndexedVMatrix::fullyCheckMappings(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), init_map_sr(), makeDeepCopyFromShallowCopy(), and PLearn::StrTableVMatrix::StrTableVMatrix().
TVec<map<string,real> > PLearn::VMatrix::map_sr [mutable, protected] |
The string mapping for each field, in both directions.
Definition at line 119 of file VMatrix.h.
Referenced by addStringMapping(), PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), PLearn::SubVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::IndexedVMatrix::ensureMappingsConsistency(), PLearn::ConcatRowsVMatrix::ensureMappingsConsistency(), PLearn::IndexedVMatrix::fullyCheckMappings(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), init_map_sr(), makeDeepCopyFromShallowCopy(), and PLearn::StrTableVMatrix::StrTableVMatrix().
PPath PLearn::VMatrix::metadatadir [protected] |
Path of directory that will contain meta information on this dataset (fieldnames, cached statistics, etc...) and possibly the data itself.
Definition at line 112 of file VMatrix.h.
Referenced by PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), build_(), PLearn::TextFilesVMatrix::build_(), PLearn::LocallyPrecomputedVMatrix::build_(), declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::LocallyPrecomputedVMatrix::declareOptions(), PLearn::FilteredVMatrix::FilteredVMatrix(), PLearn::AutoSDBVMatrix::getMappings(), PLearn::TemporaryDiskVMatrix::~TemporaryDiskVMatrix(), and PLearn::TemporaryFileVMatrix::~TemporaryFileVMatrix().
time_t PLearn::VMatrix::mtime_ [private] |
time_t PLearn::VMatrix::mtime_update [private] |
Definition at line 92 of file VMatrix.h.
Referenced by build_(), and declareOptions().
int PLearn::VMatrix::targetsize_ [mutable, protected] |
Definition at line 103 of file VMatrix.h.
Referenced by PLearn::VMatrixFromDistribution::build_(), PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::RegularGridVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MultiInstanceVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), PLearn::AddBagInformationVMatrix::build_(), declareOptions(), PLearn::VariableDeletionVMatrix::declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), extraFieldNames(), getExample(), PLearn::RegressionTreeRegisters::getExample(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), PLearn::LIBSVMSparseVMatrix::getExample(), getExtra(), PLearn::SeparateInputVMatrix::getNewRow(), PLearn::SelectRowsMultiInstanceVMatrix::getNewRow(), PLearn::ReIndexedTargetVMatrix::getNewRow(), PLearn::ProcessingVMatrix::getNewRow(), PLearn::MultiTargetOneHotVMatrix::getNewRow(), PLearn::LemmatizeVMatrix::getNewRow(), loadFieldInfos(), PLearn::ForwardVMatrix::reset_dimensions(), saveFieldInfos(), targetFieldNames(), and weightFieldNames().
int PLearn::VMatrix::weightsize_ [mutable, protected] |
Definition at line 104 of file VMatrix.h.
Referenced by PLearn::VMatrixFromDistribution::build_(), PLearn::VariableDeletionVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::RegularGridVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::ConcatRowsVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), declareOptions(), PLearn::VariableDeletionVMatrix::declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), extraFieldNames(), getExample(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), getExtra(), PLearn::SeparateInputVMatrix::getNewRow(), PLearn::RealFunctionsProcessedVMatrix::getNewRow(), PLearn::ProcessingVMatrix::getNewRow(), PLearn::MultiTargetOneHotVMatrix::getNewRow(), PLearn::LemmatizeVMatrix::getNewRow(), loadFieldInfos(), PLearn::ForwardVMatrix::reset_dimensions(), saveFieldInfos(), and weightFieldNames().
int PLearn::VMatrix::width_ [protected] |
Width of the VMatrix.
Definition at line 97 of file VMatrix.h.
Referenced by PLearn::JoinVMatrix::addStatField(), PLearn::CompactVMatrix::append(), PLearn::SDBVMatrix::appendField(), PLearn::AutoSDBVMatrix::AutoSDBVMatrix(), PLearn::VMatrixFromDistribution::build_(), PLearn::PreprocessingVMatrix::build_(), PLearn::TextSenseSequenceVMatrix::build_(), PLearn::TemporalHorizonVMatrix::build_(), PLearn::SubVMatrix::build_(), PLearn::SubInputVMatrix::build_(), PLearn::SplitWiseValidationVMatrix::build_(), PLearn::SeparateInputVMatrix::build_(), PLearn::SelectRowsVMatrix::build_(), PLearn::SelectRowsMultiInstanceVMatrix::build_(), PLearn::SelectRowsFileIndexVMatrix::build_(), PLearn::SelectColumnsVMatrix::build_(), PLearn::RemapLastColumnVMatrix::build_(), PLearn::RegularGridVMatrix::build_(), PLearn::RegressionTreeRegisters::build_(), PLearn::RealFunctionsProcessedVMatrix::build_(), PLearn::RankedVMatrix::build_(), PLearn::RangeVMatrix::build_(), PLearn::RandomSamplesFromVMatrix::build_(), PLearn::RandomNeighborsDifferencesVMatrix::build_(), PLearn::PythonTableVMatrix::build_(), PLearn::PythonProcessedVMatrix::build_(), PLearn::ProcessSymbolicSequenceVMatrix::build_(), PLearn::ProcessingVMatrix::build_(), PLearn::PLearnerOutputVMatrix::build_(), PLearn::OneVsAllVMatrix::build_(), PLearn::OneHotVMatrix::build_(), PLearn::NeighborhoodImputationVMatrix::build_(), PLearn::MultiToUniInstanceSelectRandomVMatrix::build_(), PLearn::MultiTargetOneHotVMatrix::build_(), PLearn::MultiInstanceVMatrix::build_(), PLearn::MovingAverageVMatrix::build_(), PLearn::MixUnlabeledNeighbourVMatrix::build_(), PLearn::MixtureVMatrix::build_(), PLearn::MissingInstructionVMatrix::build_(), PLearn::MemoryVMatrix::build_(), PLearn::MeanImputationVMatrix::build_(), PLearn::LocalNeighborsDifferencesVMatrix::build_(), PLearn::LIBSVMSparseVMatrix::build_(), PLearn::LemmatizeVMatrix::build_(), PLearn::LearnerProcessedVMatrix::build_(), PLearn::KNNVMatrix::build_(), PLearn::InterleaveVMatrix::build_(), PLearn::InfiniteMNISTVMatrix::build_(), PLearn::IndexedVMatrix::build_(), PLearn::GramVMatrix::build_(), PLearn::GeneralizedOneHotVMatrix::build_(), PLearn::ForwardVMatrix::build_(), PLearn::FinancePreprocVMatrix::build_(), PLearn::FilteredVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::ExtractNNetParamsVMatrix::build_(), PLearn::ExtendedVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::DictionaryVMatrix::build_(), PLearn::DichotomizeVMatrix::build_(), PLearn::DatedJoinVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::ConcatColumnsVMatrix::build_(), PLearn::CompactFileVMatrix::build_(), PLearn::BinaryNumbersVMatrix::build_(), PLearn::BatchVMatrix::build_(), PLearn::AsciiVMatrix::build_(), PLearn::AppendNeighborsVMatrix::build_(), PLearn::AddBagInformationVMatrix::build_(), PLearn::MissingIndicatorVMatrix::buildNewRecordFormat(), PLearn::ByteMemoryVMatrix::ByteMemoryVMatrix(), PLearn::CompactVMatrix::CompactVMatrix(), PLearn::MeanMedianModeImputationVMatrix::computeMeanMedianModeVectors(), PLearn::MeanImputationVMatrix::computeMeanVector(), declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::SelectRowsVMatrix::declareOptions(), PLearn::SelectColumnsVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::MeanMedianModeImputationVMatrix::declareOptions(), PLearn::ForwardVMatrix::declareOptions(), PLearn::FilteredVMatrix::declareOptions(), PLearn::ExtractNNetParamsVMatrix::declareOptions(), PLearn::RowBufferedVMatrix::dot(), PLearn::CompactVMatrix::dot(), PLearn::SelectColumnsVMatrix::get(), PLearn::RowBufferedVMatrix::get(), PLearn::SelectRowsVMatrix::getDictionary(), PLearn::SelectColumnsVMatrix::getDictionary(), PLearn::ProcessSymbolicSequenceVMatrix::getDictionary(), PLearn::DictionaryVMatrix::getDictionary(), PLearn::ConcatColumnsVMatrix::getDictionary(), PLearn::AddMissingVMatrix::getDictionary(), PLearn::ProcessSymbolicSequenceVMatrix::getExample(), PLearn::RandomNeighborsDifferencesVMatrix::getNewRow(), PLearn::ProcessSymbolicSequenceVMatrix::getNewRow(), PLearn::LocalNeighborsDifferencesVMatrix::getNewRow(), PLearn::FileVMatrix::getNewRow(), PLearn::CompressedVMatrix::getNewRow(), PLearn::CompactVMatrix::getNewRow(), PLearn::CompactFileVMatrix::getNewRow(), PLearn::BinaryNumbersVMatrix::getNewRow(), PLearn::AppendNeighborsVMatrix::getNewRow(), PLearn::RowBufferedVMatrix::getRow(), PLearn::MemoryVMatrix::getRow(), PLearn::FileVMatrix::getSizeOnDisk(), PLearn::ConcatColumnsVMatrix::getString(), PLearn::ConcatColumnsVMatrix::getStringMapping(), PLearn::ConcatColumnsVMatrix::getStringVal(), PLearn::AddMissingVMatrix::getStringVal(), PLearn::SelectColumnsVMatrix::getSubRow(), PLearn::RowBufferedVMatrix::getSubRow(), PLearn::ByteMemoryVMatrix::getSubRow(), PLearn::ConcatColumnsVMatrix::getValString(), PLearn::AddMissingVMatrix::getValString(), PLearn::SelectRowsVMatrix::getValues(), PLearn::SelectColumnsVMatrix::getValues(), PLearn::ProcessSymbolicSequenceVMatrix::getValues(), PLearn::DictionaryVMatrix::getValues(), PLearn::ConcatColumnsVMatrix::getValues(), PLearn::AddMissingVMatrix::getValues(), PLearn::CompressedVMatrix::init(), PLearn::FileVMatrix::moveto(), PLearn::CompactVMatrix::perturb(), PLearn::ConcatColumnsVMatrix::put(), PLearn::ConcatRowsVMatrix::recomputeDimensions(), PLearn::SubVMatrix::reset_dimensions(), PLearn::ForwardVMatrix::reset_dimensions(), PLearn::SDBVMatrix::SDBVMatrix(), PLearn::TextFilesVMatrix::setColumnNamesAndWidth(), PLearn::SourceVMatrix::setMetaDataDir(), PLearn::CompactVMatrix::setOneHotMode(), PLearn::FileVMatrix::updateHeader(), and PLearn::OneHotVMatrix::updateNClassesAndWidth().
bool PLearn::VMatrix::writable [protected] |
Are write operations tolerated?
Definition at line 108 of file VMatrix.h.
Referenced by PLearn::DiskVMatrix::appendRow(), PLearn::ForwardVMatrix::build_(), PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), PLearn::CompactFileVMatrix::CompactFileVMatrix(), declareOptions(), PLearn::UCIDataVMatrix::declareOptions(), PLearn::SelectRowsVMatrix::declareOptions(), PLearn::PrecomputedVMatrix::declareOptions(), PLearn::ForwardVMatrix::declareOptions(), PLearn::DiskVMatrix::DiskVMatrix(), PLearn::FileVMatrix::FileVMatrix(), and PLearn::FileVMatrix::makeDeepCopyFromShallowCopy().