#include <VMatrix.h>
Inheritance diagram for PLearn::VMatrix:
Public Member Functions | |
VMatrix () | |
VMatrix (int the_length, int the_width) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
void | init_map_sr () const |
void | defineSizes (int inputsize, int targetsize, int weightsize=0) |
void | copySizesFrom (VMat m) |
Copy the values of inputsize, targetsize and weightsize from the source matrix m. | |
bool | looksTheSameAs (VMat m) |
Return true iif it looks like the same matrix, i.e. it has same sizes, width and length. | |
int | inputsize () const |
int | targetsize () const |
int | weightsize () const |
bool | hasWeights () const |
virtual void | getExample (int i, Vec &input, Vec &target, real &weight) |
Default version calls getSubRow based on inputsize_ targetsize_ and weightsize_ But exotic subclasses may construct, input, target and weight however they please. | |
void | setFieldInfos (const Array< VMField > &finfo) |
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", ... i.e. their column index. | |
VMField & | getFieldInfos (int fieldindex) const |
void | declareField (int fieldindex, const string &fieldname, VMField::FieldType fieldtype=VMField::UnknownType) |
void | declareFieldNames (TVec< string > fnames) |
returns the column index corresponding to a fieldname < or -1 if the name was not found | |
int | fieldIndex (const string &fieldname) const |
This first calls fieldIndex to try and get the index corresponding to the given string. | |
int | getFieldIndex (const string &fieldname_or_num) const |
< conversion to int will be returned (or a PLEARNERROR issued if this fails). | |
string | fieldName (int fieldindex) const |
TVec< string > | fieldNames () const |
void | unduplicateFieldNames () |
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 (ostream &out) const |
void | printFieldInfo (ostream &out, int fieldnum) const |
void | printFieldInfo (ostream &out, const string &fieldname_or_num) const |
string | fieldheader (int elementcharwidth=8) |
void | saveFieldInfos () const |
void | loadFieldInfos () const |
void | setSFIFFilename (int col, string ext, string filepath="") |
void | setSFIFFilename (string fieldname, string ext, string filepath="") |
string | getSFIFFilename (int col, string ext) |
string | getSFIFFilename (string fieldname, string ext) |
bool | isSFIFDirect (int col, string ext) |
bool | isSFIFDirect (string fieldname, string ext) |
void | saveAllStringMappings () |
void | saveStringMappings (int col, string 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 if the string doesn'a already have an associated value, it will be associated with value -100-number_of_strings_already_in_the_map | |
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 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 all string mapping for column i | |
void | loadStringMapping (int col) |
loads the appropriate string map file for column 'col' | |
void | loadAllStringMappings () |
loads the appropriate string map file for every column | |
void | copyStringMappingsFrom (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->value mapping for field 'fld' | |
virtual const map< real, string > & | getRealToStringMapping (int col) const |
returns the value->string mapping for field 'fld' | |
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 | computeStats () |
bool | hasStats () const |
void | saveStats (const string &filename) const |
void | loadStats (const string &filename) |
virtual void | setMetaDataDir (const string &the_metadatadir) |
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. | |
bool | hasMetaDataDir () const |
Returns true if a metadatadir was set. | |
string | getMetaDataDir () const |
Throws a PLERROR if no metadatadir was set. | |
void | lockMetaDataDir () const |
Locks the metadata directory by creating a .lock file inside it. | |
void | unlockMetaDataDir () const |
Removes the .lock file inside the metadatadir. | |
string | getAlias () const |
returns the 'alias' for this dataset. | |
void | setAlias (const string &the_alias) |
TVec< StatsCollector > | getStats () const |
returns the unconditonal statistics for the given field | |
StatsCollector & | getStats (int fieldnum) const |
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 void | save (const string &filename) const |
returns the cooccurence statistics conditioned on the given field (within the ranges returned by getRanges() ) The results are cached in file stats#.psave (where # stands for the condfield index) | |
virtual void | savePMAT (const string &pmatfile) const |
virtual void | saveDMAT (const string &dmatdir) const |
virtual void | saveAMAT (const string &amatfile, bool verbose=true, bool no_header=false) const |
Save the content of the matrix in the AMAT ASCII format into a file. | |
int | width () const |
int | length () const |
bool | isWritable () const |
string | resolveFieldInfoLink (string target, string source) |
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 | setMtime (time_t t) |
Sets the "last modification" time for this matrix For matrices on disk, this should be called by the constructor to reflect the mtime of the disk files. | |
virtual real | get (int i, int j) const |
returns element (i,j) | |
virtual void | put (int i, int j, real value) |
sets element (i,j) to value | |
virtual void | getSubRow (int i, int j, Vec v) const |
fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive) | |
virtual void | putSubRow (int i, int j, Vec v) |
virtual void | appendRow (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() if i>= length(), it will call appendRow with 0 filled rows as many times as necessary before it can append row i | |
virtual void | getRow (int i, Vec v) const |
copies row i into v (which must have appropriate length equal to the VMat's width) | |
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) | |
virtual bool | find (const Vec &input, real tolerance, int *i=0) const |
Return true iff the input vector is in this VMat (we compare only the input part). | |
virtual Mat | toMat () const |
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 | |
virtual VMat | subMat (int i, int j, int l, int w) |
virtual real | dot (int i1, int i2, int inputsize) const |
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). | |
operator Mat () const | |
virtual void | getRow (int i, VarArray &inputs) const |
Assigns the value of the Vars in the list (the total size of all the vars in the list must equal width() ). | |
void | print (ostream &out) const |
virtual void | oldwrite (ostream &out) const |
virtual void | oldread (istream &in) |
DEPRECATED For backward compatibility with old saved object. | |
PLEARN_DECLARE_ABSTRACT_OBJECT (VMatrix) | |
void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
virtual void | evaluateKernel (Ker ker, int v1_startcol, int v1_ncols, const Vec &v2, const Vec &result, int startrow=0, int nrows=-1) const |
virtual real | evaluateKernelSum (Ker ker, int v1_startcol, int v1_ncols, const Vec &v2, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
returns sum_i [ ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ] | |
virtual real | evaluateKernelWeightedTargetSum (Ker ker, int v1_startcol, int v1_ncols, const Vec &v2, int t_startcol, int t_ncols, Vec &targetsum, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
targetsum := sum_i [ m(i).subVec(t_startcol,t_ncols) * ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ] and returns sum_i [ ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ] | |
virtual TVec< pair< real, int > > | evaluateKernelTopN (int N, Ker ker, int v1_startcol, int v1_ncols, const Vec &v2, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
virtual TVec< pair< real, int > > | evaluateKernelBottomN (int N, Ker ker, int v1_startcol, int v1_ncols, const Vec &v2, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
same as evaluateKernelTopN but will look for the N smallest values instead of top values. | |
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 |
virtual void | accumulateXtX (int X_startcol, int X_ncols, Mat &result, int startrow=0, int nrows=-1, int ignore_this_row=-1) const |
virtual void | evaluateSumOfFprop (Func f, Vec &output_result, int nsamples=-1) |
compute fprop or fbprop of a sumOf operation | |
virtual void | evaluateSumOfFbprop (Func f, Vec &output_result, Vec &output_gradient, int nsamples=-1) |
virtual | ~VMatrix () |
Static Public Member Functions | |
void | declareOptions (OptionList &ol) |
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) | |
Public Attributes | |
Array< VMField > | fieldinfos |
Array< VMFieldStat > | fieldstats |
Protected Attributes | |
int | length_ |
int | width_ |
time_t | mtime_ |
int | inputsize_ |
int | targetsize_ |
int | weightsize_ |
bool | writable |
string | metadatadir |
Path of directory (possibly relative to DBDIR) that will contain meta information on this dataset (fieldnames, cached statistics, etc...) and possibly the data itself. | |
string | alias_ |
TVec< StatsCollector > | field_stats |
stats[i] contains stats for field #i | |
TVec< map< string, real > > | map_sr |
TVec< map< real, string > > | map_rs |
Private Types | |
typedef Object | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. | |
Private Attributes | |
FILE * | lockf_ |
Vec | get_row |
.lock file in metadatadir 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 |
Definition at line 65 of file VMatrix.h.
|
|
Definition at line 76 of file VMatrix.cc. |
|
Definition at line 82 of file VMatrix.cc. |
|
Definition at line 1085 of file VMatrix.cc. |
|
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 1287 of file VMatrix.cc. References PLearn::externalProductAcc(), getSubRow(), length_, and x. |
|
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 1270 of file VMatrix.cc. References PLearn::externalProductAcc(), getSubRow(), length_, and x. |
|
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'a already have an associated value, it will be associated with value -100-number_of_strings_already_in_the_map
Definition at line 492 of file VMatrix.cc. References addStringMapping(), PLearn::TVec< map< string, real > >::find(), init_map_sr(), map_sr, and val. |
|
adds a string<->real mapping
Definition at line 485 of file VMatrix.cc. References init_map_sr(), map_rs, map_sr, and val. Referenced by addStringMapping(). |
|
This method must be implemented for matrices that are allowed to grow.
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompressedVMatrix, PLearn::DiskVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, and PLearn::MemoryVMatrix. Definition at line 932 of file VMatrix.cc. References PLERROR. Referenced by forcePutRow(), and putOrAppendRow(). |
|
|
|
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 990 of file VMatrix.cc. |
|
Reimplemented in PLearn::ForwardVMatrix. Definition at line 313 of file VMatrix.cc. References fieldstats, getRow(), length(), and width(). |
|
Copy the values of inputsize, targetsize and weightsize from the source matrix m.
Definition at line 659 of file VMatrix.cc. References defineSizes(). |
|
Copy all string mappings from a given VMat.
Definition at line 799 of file VMatrix.cc. References map_rs, map_sr, PLERROR, PLearn::TVec< map< string, real > >::resize(), PLearn::TVec< map< real, string > >::resize(), setStringMapping(), PLearn::VMat::width(), and width_. |
|
Definition at line 362 of file VMatrix.cc. References getFieldInfos(). Referenced by declareFieldNames(). |
|
returns the column index corresponding to a fieldname < or -1 if the name was not found
Definition at line 365 of file VMatrix.cc. References declareField(), PLearn::TVec< T >::length(), PLERROR, and width(). |
|
|
Definition at line 139 of file VMatrix.h. References defineSizes(), inputsize_, targetsize_, and weightsize_. Referenced by copySizesFrom(), and defineSizes(). |
|
deletes all string mapping for column i
Definition at line 580 of file VMatrix.cc. References PLearn::Object::classname(), PLearn::TVec< map< real, string > >::clear(), PLearn::TVec< map< string, real > >::clear(), init_map_sr(), map_rs, map_sr, PLERROR, PLearn::TVec< map< real, string > >::size(), and PLearn::TVec< map< string, real > >::size(). Referenced by loadStringMapping(). |
|
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::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::OneHotVMatrix, PLearn::RemoveRowsVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SparseVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 1015 of file VMatrix.cc. References PLearn::dot(), dotrow_1, getSubRow(), PLearn::TVec< T >::length(), and PLearn::TVec< T >::resize(). |
|
Definition at line 476 of file VMatrix.h. References PLearn::dot(), and width(). |
|
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::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::OneHotVMatrix, PLearn::RemoveRowsVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::SparseVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 1006 of file VMatrix.cc. References PLearn::dot(), dotrow_1, dotrow_2, getSubRow(), and PLearn::TVec< T >::resize(). |
|
This will compute for this vmat m a result vector (whose length must be tha same as m's) s.t. result[i] = ker( m(i).subVec(v1_startcol,v1_ncols) , v2) i.e. the kernel value betweeen each (sub)row of m and v2 Reimplemented in PLearn::ForwardVMatrix. Definition at line 1180 of file VMatrix.cc. References getSubRow(), PLearn::TVec< T >::length(), length_, and PLERROR. |
|
same as evaluateKernelTopN but will look for the N smallest values instead of top values. results are sorted with smallest kernel value first Reimplemented in PLearn::ForwardVMatrix. Definition at line 1250 of file VMatrix.cc. References PLearn::BottomNI< T >::getBottomN(), getSubRow(), length_, PLearn::BottomNI< T >::sort(), and PLearn::BottomNI< T >::update(). |
|
returns sum_i [ ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ]
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1196 of file VMatrix.cc. References getSubRow(), and length_. |
|
This will return the Top N kernel evaluated values (between vmat (sub)rows and v2) and their associated row_index. Result is returned as a vector of length N of pairs (kernel_value,row_index) Results are sorted with largest kernel value first Reimplemented in PLearn::ForwardVMatrix. Definition at line 1233 of file VMatrix.cc. References getSubRow(), PLearn::TopNI< T >::getTopN(), length_, PLearn::TopNI< T >::sort(), and PLearn::TopNI< T >::update(). |
|
targetsum := sum_i [ m(i).subVec(t_startcol,t_ncols) * ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ] and returns sum_i [ ker( m(i).subVec(v1_startcol,v1_ncols) , v2) ]
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1213 of file VMatrix.cc. References PLearn::TVec< T >::clear(), getSubRow(), length_, and PLearn::multiplyAcc(). |
|
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1322 of file VMatrix.cc. References PLearn::TVec< T >::clear(), getRow(), PLearn::TVec< T >::length(), length(), and width(). |
|
compute fprop or fbprop of a sumOf operation
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1300 of file VMatrix.cc. References PLearn::TVec< T >::clear(), getRow(), PLearn::TVec< T >::length(), length(), and width(). |
|
Definition at line 354 of file VMatrix.cc. |
|
This first calls fieldIndex to try and get the index corresponding to the given string.
Definition at line 182 of file VMatrix.cc. References getFieldInfos(), and width(). Referenced by getFieldIndex(). |
|
Definition at line 191 of file VMatrix.h. References fieldName(), and getFieldInfos(). Referenced by fieldName(), PLearn::VMat::fieldName(), fieldNames(), getSFIFFilename(), isSFIFDirect(), saveAMAT(), and setSFIFFilename(). |
|
Definition at line 173 of file VMatrix.cc. References fieldName(), and width(). |
|
|
|
Definition at line 197 of file VMatrix.h. References fieldStat(), and fieldstats. Referenced by fieldStat(). |
|
Definition at line 196 of file VMatrix.h. References fieldType(). |
|
Definition at line 195 of file VMatrix.h. References getFieldInfos(). Referenced by fieldType(). |
|
Reimplemented in PLearn::ForwardVMatrix, and PLearn::MemoryVMatrix. Definition at line 926 of file VMatrix.cc. |
|
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. Definition at line 1036 of file VMatrix.cc. References get_row, getSubRow(), inputsize(), length(), PLearn::TVec< T >::length(), PLERROR, PLearn::powdistance(), and PLearn::TVec< T >::resize(). |
|
For matrices stored on disk, this should flush all pending buffered write operations.
Reimplemented in PLearn::DiskVMatrix, and PLearn::FileVMatrix. Definition at line 937 of file VMatrix.cc. |
|
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 950 of file VMatrix.cc. References appendRow(), PLearn::TVec< T >::clear(), length(), putRow(), and width(). |
|
|
returns the 'alias' for this dataset. The alias is a short name that can be used as part of a filename containing results related to this VMat. Definition at line 323 of file VMatrix.h. References alias_. |
|
copies column i into v (which must have appropriate length equal to the VMat's length)
Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::VMatrixFromDistribution. Definition at line 880 of file VMatrix.cc. References get(), length(), PLearn::TVec< T >::length(), and PLERROR. Referenced by PLearn::VMat::getColumn(). |
|
Default version calls getSubRow based on inputsize_ targetsize_ and 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. Definition at line 289 of file VMatrix.cc. References get(), getSubRow(), inputsize_, PLERROR, PLearn::TVec< T >::resize(), targetsize_, and weightsize_. Referenced by PLearn::VMat::getExample(). |
|
< conversion to int will be returned (or a PLEARNERROR issued if this fails).
Definition at line 191 of file VMatrix.cc. References fieldIndex(), PLERROR, PLearn::toint(), and width(). Referenced by PLearn::VMat::getFieldIndex(), and printFieldInfo(). |
|
Definition at line 178 of file VMatrix.h. References getFieldInfos(). |
|
If no fieldnames have been set, will set default field names to "0", "1", "2", ... i.e. their column index.
Definition at line 127 of file VMatrix.cc. References PLearn::append_slash(), fieldinfos, fname, getMetaDataDir(), hasMetaDataDir(), PLearn::isfile(), loadFieldInfos(), PLearn::TVec< VMField >::resize(), PLearn::TVec< VMField >::size(), PLearn::tostring(), and width(). Referenced by PLearn::FileVMatrix::build_(), PLearn::DiskVMatrix::build_(), declareField(), fieldIndex(), fieldName(), fieldType(), PLearn::ConcatRowsVMatrix::fullyCheckMappings(), getFieldInfos(), printFieldInfo(), saveDMAT(), savePMAT(), and unduplicateFieldNames(). |
|
copies the submatrix starting at i,j into m (which must have appropriate length and width)
Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, PLearn::SubVMatrix, and PLearn::VMatrixFromDistribution. Definition at line 964 of file VMatrix.cc. References getSubRow(), length(), PLearn::TMat< T >::length(), PLearn::Mat, PLERROR, width(), and PLearn::TMat< T >::width(). Referenced by PLearn::operator<<(), and toMat(). |
|
Throws a PLERROR if no metadatadir was set.
Definition at line 731 of file VMatrix.cc. References metadatadir. Referenced by PLearn::VVMatrix::build_(), getFieldInfos(), getRanges(), getSFIFFilename(), getStats(), isSFIFDirect(), loadFieldInfos(), loadStringMapping(), PLearn::FilteredVMatrix::openIndex(), saveFieldInfos(), setSFIFFilename(), and PLearn::PrecomputedVMatrix::usePrecomputed(). |
|
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 setMtime(t) (see below). Definition at line 389 of file VMatrix.h. References mtime_. Referenced by PLearn::MovingAverageVMatrix::build_(), PLearn::CumVMatrix::build_(), getStats(), PLearn::VVMatrix::isPrecomputedAndUpToDate(), PLearn::FilteredVMatrix::openIndex(), PLearn::SourceVMatrix::setMetaInfoFromSource(), and PLearn::vmatmain(). |
|
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 832 of file VMatrix.cc. References PLearn::computeRanges(), getMetaDataDir(), getStats(), PLearn::isfile(), length(), PLearn::load(), PLearn::save(), and slash. |
|
returns the value->string mapping for field 'fld'
Reimplemented in PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 641 of file VMatrix.cc. References init_map_sr(), and map_rs. |
|
Assigns the value of the Vars in the list (the total size of all the vars in the list must equal width() ).
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1025 of file VMatrix.cc. |
|
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::MemoryVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectRowsFileIndexVMatrix, and PLearn::VMatrixFromDistribution. Definition at line 908 of file VMatrix.cc. References getSubRow(), PLearn::TVec< T >::length(), PLERROR, and width(). Referenced by computeStats(), evaluateSumOfFbprop(), evaluateSumOfFprop(), getRow(), print(), saveAMAT(), saveDMAT(), and savePMAT(). |
|
Definition at line 457 of file VMatrix.cc. References getMetaDataDir(), PLearn::isfile(), PLearn::makeFileNameValid(), resolveFieldInfoLink(), and slash. |
|
Definition at line 452 of file VMatrix.cc. References fieldName(), and getSFIFFilename(). Referenced by getSFIFFilename(), isSFIFDirect(), loadStringMapping(), and saveAllStringMappings(). |
|
Definition at line 330 of file VMatrix.h. References getStats(). |
|
returns the unconditonal statistics for the given field
Definition at line 811 of file VMatrix.cc. References PLearn::computeStats(), field_stats, getMetaDataDir(), getMtime(), PLearn::isfile(), PLearn::load(), PLearn::mtime(), PLWARNING, PLearn::save(), and slash. Referenced by getRanges(), getStats(), and printFieldInfo(). |
|
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, and PLearn::TemporalHorizonVMatrix. Definition at line 618 of file VMatrix.cc. References get(), getValString(), PLearn::tostring(), and val. |
|
returns the string->value mapping for field 'fld'
Reimplemented in PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 633 of file VMatrix.cc. References init_map_sr(), and map_sr. Referenced by saveStringMappings(). |
|
returns value associated with a string (or MISSING_VALUE if there's no association for this string)
Reimplemented in PLearn::ConcatColumnsVMatrix, PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 608 of file VMatrix.cc. References PLearn::TVec< map< string, real > >::end(), PLearn::TVec< map< string, real > >::find(), PLearn::TVec< map< string, real > >::length(), map_sr, and MISSING_VALUE. |
|
fills v with the subrow i lying between columns j (inclusive) and j+v.length() (exclusive)
Reimplemented in PLearn::NistDB, PLearn::KernelVMatrix, PLearn::ByteMemoryVMatrix, PLearn::ConcatRowsSubVMatrix, PLearn::ConcatRowsVMatrix, PLearn::ForwardVMatrix, PLearn::InterleaveVMatrix, PLearn::KernelVMatrix, PLearn::MemoryVMatrix, PLearn::RemoveRowsVMatrix, PLearn::RowBufferedVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, PLearn::ShiftAndRescaleVMatrix, PLearn::SubVMatrix, PLearn::UniformVMatrix, PLearn::VMatrixFromDistribution, and PLearn::VVMatrix. Definition at line 893 of file VMatrix.cc. References get(), k, and PLearn::TVec< T >::length(). Referenced by accumulateXtX(), accumulateXtY(), dot(), evaluateKernel(), evaluateKernelBottomN(), evaluateKernelSum(), evaluateKernelTopN(), evaluateKernelWeightedTargetSum(), find(), getExample(), getMat(), getRow(), and PLearn::VMat::getSubRow(). |
|
returns the string associated with value val for field# col. Or returns "" if no string is associated. Reimplemented in PLearn::AutoSDBVMatrix, PLearn::ConcatColumnsVMatrix, PLearn::ForwardVMatrix, PLearn::JoinVMatrix, PLearn::SelectColumnsVMatrix, PLearn::SelectRowsFileIndexVMatrix, PLearn::SelectRowsVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 595 of file VMatrix.cc. References PLearn::TVec< map< real, string > >::end(), PLearn::TVec< map< real, string > >::find(), init_map_sr(), PLearn::is_missing(), map_rs, and val. Referenced by getString(). |
|
returns true if fieldinfos have been set
Definition at line 153 of file VMatrix.cc. References fieldinfos, and PLearn::TVec< VMField >::size(). Referenced by PLearn::MovingAverageVMatrix::build_(), PLearn::ForwardVMatrix::build_(), PLearn::CumVMatrix::build_(), PLearn::SourceVMatrix::setMetaDataDir(), and PLearn::SourceVMatrix::setMetaInfoFromSource(). |
|
Returns true if a metadatadir was set.
Definition at line 304 of file VMatrix.h. References metadatadir. Referenced by getFieldInfos(), loadStringMapping(), lockMetaDataDir(), and PLearn::PrecomputedVMatrix::setMetaDataDir(). |
|
Definition at line 294 of file VMatrix.h. References fieldstats, and PLearn::TVec< VMFieldStat >::size(). |
|
Definition at line 152 of file VMatrix.h. References weightsize_. |
|
|
Definition at line 149 of file VMatrix.h. References inputsize_. Referenced by PLearn::PLearnerOutputVMatrix::build_(), find(), PLearn::KNNVMatrix::getNewRow(), looksTheSameAs(), and PLearn::VMat::subMatRows(). |
|
Definition at line 477 of file VMatrix.cc. References getMetaDataDir(), getSFIFFilename(), PLearn::makeFileNameValid(), and slash. |
|
Definition at line 472 of file VMatrix.cc. References fieldName(), and isSFIFDirect(). Referenced by isSFIFDirect(). |
|
Definition at line 369 of file VMatrix.h. References writable. |
|
|
loads the appropriate string map file for every column
Definition at line 741 of file VMatrix.cc. References PLearn::Object::classname(), loadStringMapping(), and width(). |
|
Definition at line 385 of file VMatrix.cc. References PLearn::append_slash(), fieldinfos, getMetaDataDir(), PLearn::pgetline(), PLERROR, PLearn::TVec< VMField >::resize(), PLearn::split(), PLearn::toint(), and width(). Referenced by getFieldInfos(). |
|
Definition at line 325 of file VMatrix.cc. References fieldstats, PLERROR, PLWARNING, PLearn::Array< VMFieldStat >::read(), PLearn::TVec< VMFieldStat >::resize(), PLearn::TVec< VMFieldStat >::size(), and width(). |
|
loads the appropriate string map file for column 'col'
Definition at line 753 of file VMatrix.cc. References c_str(), deleteStringMapping(), fname, PLearn::force_mkdir(), getMetaDataDir(), getSFIFFilename(), hasMetaDataDir(), init_map_sr(), PLearn::isfile(), map_rs, map_sr, PLERROR, slash, and val. Referenced by loadAllStringMappings(). |
|
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). Definition at line 690 of file VMatrix.cc. References PLearn::append_slash(), c_str(), PLearn::endl(), PLearn::force_mkdir(), PLearn::getHost(), PLearn::getPid(), PLearn::getUser(), hasMetaDataDir(), PLearn::loadFileAsString(), lockf_, metadatadir, PLearn::pathexists(), and PLERROR. |
|
Return true iif it looks like the same matrix, i.e. it has same sizes, width and length.
Definition at line 666 of file VMatrix.cc. References inputsize(), PLearn::VMat::length(), length(), targetsize(), weightsize(), PLearn::VMat::width(), and width(). |
|
|
DEPRECATED For backward compatibility with old saved object.
Reimplemented from PLearn::Object. Reimplemented in PLearn::ForwardVMatrix. Definition at line 1075 of file VMatrix.cc. References length_, PLearn::readField(), PLearn::readFooter(), PLearn::readHeader(), and width_. |
|
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1065 of file VMatrix.cc. References length_, width_, PLearn::writeField(), PLearn::writeFooter(), and PLearn::writeHeader(). |
|
Definition at line 481 of file VMatrix.h. References toMat(). |
|
|
|
Prints a human-readable, short (not necessarily complete) description of this object instance (default prints info()). This is what is called by operator<< on Object Reimplemented from PLearn::Object. Definition at line 1055 of file VMatrix.cc. References PLearn::endl(), getRow(), length(), and width(). Referenced by PLearn::VMat::print(). |
|
Definition at line 275 of file VMatrix.cc. References getFieldIndex(), and printFieldInfo(). |
|
Definition at line 213 of file VMatrix.cc. References PLearn::endl(), PLearn::VMField::fieldtype, getFieldInfos(), getStats(), PLearn::StatsCollector::max(), PLearn::StatsCollector::mean(), PLearn::StatsCollector::min(), PLearn::VMField::name, PLearn::StatsCollector::nmissing(), PLearn::StatsCollector::nnonmissing(), PLERROR, PLearn::StatsCollector::stddev(), and PLearn::StatsCollector::sum(). Referenced by printFieldInfo(), and printFields(). |
|
Definition at line 280 of file VMatrix.cc. References PLearn::endl(), printFieldInfo(), and width(). |
|
sets element (i,j) to value
Reimplemented in PLearn::AsciiVMatrix, PLearn::BatchVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, PLearn::IndexedVMatrix, PLearn::MemoryVMatrix, PLearn::SubVMatrix, and PLearn::TemporalHorizonVMatrix. Definition at line 875 of file VMatrix.cc. References PLERROR. Referenced by putSubRow(). |
|
copies matrix m at position i,j of this VMat
Reimplemented in PLearn::ConcatRowsVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::SubVMatrix. Definition at line 977 of file VMatrix.cc. References length(), PLearn::TMat< T >::length(), PLERROR, putSubRow(), width(), and PLearn::TMat< T >::width(). |
|
will call putRow if i<length() and appendRow if i==length()
Definition at line 940 of file VMatrix.cc. References appendRow(), length(), PLERROR, and putRow(). |
|
Reimplemented in PLearn::AsciiVMatrix, PLearn::CompactVMatrix, PLearn::DiskVMatrix, PLearn::ForwardVMatrix, and PLearn::MemoryVMatrix. Definition at line 917 of file VMatrix.cc. References PLearn::TVec< T >::length(), PLERROR, putSubRow(), and width(). Referenced by fill(), forcePutRow(), putOrAppendRow(), and savePMAT(). |
|
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::CompactVMatrix, PLearn::FileVMatrix, PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::SubVMatrix. Definition at line 899 of file VMatrix.cc. References k, PLearn::TVec< T >::length(), and put(). |
|
remove all string mappings
Definition at line 509 of file VMatrix.cc. References PLearn::TVec< map< real, string > >::clear(), PLearn::TVec< map< string, real > >::clear(), init_map_sr(), map_rs, map_sr, and width(). |
|
remove all string mappings of a given field
Definition at line 519 of file VMatrix.cc. References PLearn::TVec< map< real, string > >::clear(), PLearn::TVec< map< string, real > >::clear(), init_map_sr(), map_rs, and map_sr. |
|
removes a string mapping
Definition at line 557 of file VMatrix.cc. References PLearn::find(), PLearn::TVec< map< string, real > >::find(), init_map_sr(), map_rs, map_sr, map_sr, and val. |
|
|
Definition at line 407 of file VMatrix.cc. References PLearn::isdir(), PLearn::isfile(), PLearn::loadFileAsString(), PLearn::removeblanks(), resolveFieldInfoLink(), and slash. Referenced by getSFIFFilename(), and resolveFieldInfoLink(). |
|
returns the cooccurence statistics conditioned on the given field (within the ranges returned by getRanges() ) The results are cached in file stats#.psave (where # stands for the condfield index)
Reimplemented from PLearn::Object. Reimplemented in PLearn::ForwardVMatrix. Definition at line 1088 of file VMatrix.cc. References savePMAT(). Referenced by PLearn::VMat::save(). |
|
Definition at line 529 of file VMatrix.cc. References fname, getSFIFFilename(), saveStringMappings(), and width(). |
|
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. Definition at line 1136 of file VMatrix.cc. References PLearn::endl(), fieldName(), getRow(), k, length(), PLERROR, PLearn::space_to_underscore(), PLearn::ProgressBar::update(), and width(). |
|
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1115 of file VMatrix.cc. References PLearn::DiskVMatrix::appendRow(), PLearn::force_rmdir(), getFieldInfos(), getRow(), length(), setFieldInfos(), and width(). |
|
Definition at line 373 of file VMatrix.cc. References PLearn::append_slash(), PLearn::endl(), fieldinfos, getMetaDataDir(), PLearn::TVec< VMField >::length(), PLERROR, and PLearn::TVec< VMField >::size(). Referenced by PLearn::FinancePreprocVMatrix::build_(), PLearn::FileVMatrix::FileVMatrix(), savePMAT(), PLearn::DiskVMatrix::~DiskVMatrix(), and PLearn::FileVMatrix::~FileVMatrix(). |
|
Reimplemented in PLearn::ForwardVMatrix. Definition at line 1091 of file VMatrix.cc. References fieldinfos, getFieldInfos(), getRow(), length(), PLERROR, putRow(), saveFieldInfos(), setFieldInfos(), PLearn::TVec< VMField >::size(), and width(). Referenced by save(). |
|
Definition at line 340 of file VMatrix.cc. References PLearn::endl(), fieldstats, PLERROR, PLearn::TVec< VMFieldStat >::size(), and PLearn::Array< VMFieldStat >::write(). |
|
Definition at line 539 of file VMatrix.cc. References PLearn::endl(), fname, PLearn::force_mkdir_for_file(), getStringToRealMapping(), PLERROR, and PLearn::rm(). Referenced by saveAllStringMappings(). |
|
Definition at line 324 of file VMatrix.h. References alias_, and setAlias(). Referenced by setAlias(). |
|
Definition at line 148 of file VMatrix.cc. References fieldinfos. Referenced by saveDMAT(), and savePMAT(). |
|
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::PrecomputedVMatrix, PLearn::ProcessingVMatrix, and PLearn::SourceVMatrix. Definition at line 646 of file VMatrix.cc. References PLearn::abspath(), PLearn::force_mkdir(), metadatadir, and PLERROR. Referenced by build_(). |
|
Sets the "last modification" time for this matrix For matrices on disk, this should be called by the constructor to reflect the mtime of the disk files.
Definition at line 394 of file VMatrix.h. References mtime_, and setMtime(). Referenced by setMtime(). |
|
Definition at line 436 of file VMatrix.cc. References c_str(), PLearn::endl(), PLearn::force_mkdir_for_file(), getMetaDataDir(), PLearn::makeFileNameValid(), PLearn::rm(), and slash. |
|
Definition at line 430 of file VMatrix.cc. References fieldName(), and setSFIFFilename(). Referenced by setSFIFFilename(). |
|
overwrite the string<->real mapping with this one (and build the reverse mapping)
Definition at line 570 of file VMatrix.cc. References PLearn::TVec< map< string, real > >::begin(), PLearn::TVec< map< real, string > >::clear(), PLearn::TVec< map< real, string > >::first(), init_map_sr(), map_rs, map_sr, and map_sr. Referenced by copyStringMappingsFrom(). |
|
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 1000 of file VMatrix.cc. Referenced by PLearn::VMat::subMat(), PLearn::VMat::subMatColumns(), and PLearn::VMat::subMatRows(). |
|
Definition at line 150 of file VMatrix.h. References targetsize_. Referenced by PLearn::KNNVMatrix::getNewRow(), looksTheSameAs(), and PLearn::VMat::subMatRows(). |
|
returns a Mat with the same data as this VMat The default version of this method copies the data in a fresh Mat created in memory 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. Reimplemented in PLearn::ForwardVMatrix, PLearn::MemoryVMatrix, and PLearn::VMatrixFromDistribution. Definition at line 993 of file VMatrix.cc. References getMat(), length(), and width(). Referenced by operator Mat(), PLearn::VMat::operator Mat(), and PLearn::VMat::toMat(). |
|
Definition at line 158 of file VMatrix.cc. References fieldinfos, getFieldInfos(), PLearn::tostring(), and width(). Referenced by PLearn::ConcatColumnsVMatrix::build_(). |
|
Removes the .lock file inside the metadatadir. It will throw a PLearnError if this object did not hold the lock. Definition at line 721 of file VMatrix.cc. References PLearn::append_slash(), lockf_, metadatadir, PLERROR, and PLearn::rm(). |
|
Definition at line 151 of file VMatrix.h. References weightsize_. Referenced by PLearn::KNNVMatrix::getNewRow(), looksTheSameAs(), and PLearn::VMat::subMatRows(). |
|
|
Definition at line 105 of file VMatrix.h. Referenced by getAlias(), and setAlias(). |
|
Used in the default dot(i,j) method to store the i-th and j-th rows.
Definition at line 79 of file VMatrix.h. Referenced by dot(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 80 of file VMatrix.h. Referenced by dot(), and makeDeepCopyFromShallowCopy(). |
|
stats[i] contains stats for field #i
Definition at line 108 of file VMatrix.h. Referenced by getStats(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 121 of file VMatrix.h. Referenced by getFieldInfos(), hasFieldInfos(), loadFieldInfos(), makeDeepCopyFromShallowCopy(), saveFieldInfos(), savePMAT(), setFieldInfos(), and unduplicateFieldNames(). |
|
Definition at line 122 of file VMatrix.h. Referenced by computeStats(), fieldStat(), hasStats(), loadStats(), makeDeepCopyFromShallowCopy(), and saveStats(). |
|
.lock file in metadatadir Used in the 'find' method to store a row.
Definition at line 76 of file VMatrix.h. Referenced by find(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 93 of file VMatrix.h. Referenced by defineSizes(), getExample(), and inputsize(). |
|
Definition at line 84 of file VMatrix.h. Referenced by accumulateXtX(), accumulateXtY(), evaluateKernel(), evaluateKernelBottomN(), evaluateKernelSum(), evaluateKernelTopN(), evaluateKernelWeightedTargetSum(), length(), oldread(), and oldwrite(). |
|
Definition at line 73 of file VMatrix.h. Referenced by lockMetaDataDir(), and unlockMetaDataDir(). |
|
Definition at line 112 of file VMatrix.h. Referenced by addStringMapping(), copyStringMappingsFrom(), deleteStringMapping(), getRealToStringMapping(), getValString(), init_map_sr(), loadStringMapping(), makeDeepCopyFromShallowCopy(), removeAllStringMappings(), removeColumnStringMappings(), removeStringMapping(), and setStringMapping(). |
|
Definition at line 111 of file VMatrix.h. Referenced by addStringMapping(), copyStringMappingsFrom(), deleteStringMapping(), getStringToRealMapping(), getStringVal(), init_map_sr(), loadStringMapping(), makeDeepCopyFromShallowCopy(), removeAllStringMappings(), removeColumnStringMappings(), removeStringMapping(), and setStringMapping(). |
|
Path of directory (possibly relative to DBDIR) that will contain meta information on this dataset (fieldnames, cached statistics, etc...) and possibly the data itself.
Definition at line 102 of file VMatrix.h. Referenced by build_(), getMetaDataDir(), hasMetaDataDir(), lockMetaDataDir(), setMetaDataDir(), and unlockMetaDataDir(). |
|
Definition at line 86 of file VMatrix.h. Referenced by getMtime(), and setMtime(). |
|
Definition at line 94 of file VMatrix.h. Referenced by defineSizes(), getExample(), and targetsize(). |
|
Definition at line 95 of file VMatrix.h. Referenced by defineSizes(), getExample(), hasWeights(), and weightsize(). |
|
Definition at line 85 of file VMatrix.h. Referenced by copyStringMappingsFrom(), oldread(), oldwrite(), and width(). |
|
Definition at line 98 of file VMatrix.h. Referenced by isWritable(). |