PLearn 0.1
|
Computed year*12+(month-1) More...
#include <SDBVMat.h>
Public Member Functions | |
SDBVMFieldMonths (SDBVMSource source, real missing_values_mapping=MISSING_VALUE) | |
virtual void | convertField (const SDBWithStats &sdb, const Row &row, const Vec &output) const |
virtual int | fieldWidth () const |
Width that the field occupies in the VMat. | |
Private Types | |
typedef SDBVMFieldSource1 | inherited |
typedef SDBVMFieldSource1 PLearn::SDBVMFieldMonths::inherited [private] |
Reimplemented from PLearn::SDBVMFieldSource1.
PLearn::SDBVMFieldMonths::SDBVMFieldMonths | ( | SDBVMSource | source, |
real | missing_values_mapping = MISSING_VALUE |
||
) | [inline] |
Definition at line 544 of file SDBVMat.h.
: inherited(source,missing_values_mapping,VMField::Continuous) {}
void PLearn::SDBVMFieldMonths::convertField | ( | const SDBWithStats & | sdb, |
const Row & | theRow, | ||
const Vec & | outputField | ||
) | const [virtual] |
Given a database row, convert the appropriate parts to a (preallocated) output vector of the correct width (given by fieldWidth). Replace MISSING_VALUEs by missing_values_mapping.
Implements PLearn::SDBVMField.
Definition at line 490 of file SDBVMat.cc.
References PLearn::SDBVMField::convertMissing(), d, PLearn::float_to_date(), PLearn::SDBVMSource::getValue(), PLearn::PDate::month, PLearn::SDBVMFieldSource1::source_, and PLearn::PDate::year.
{ real realval = source_.getValue(sdb,row); PDate d = float_to_date(realval); output[0] = d.year*12 + (d.month-1); convertMissing(output); }
int PLearn::SDBVMFieldMonths::fieldWidth | ( | ) | const [virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 499 of file SDBVMat.cc.
{
return 1;
}