|
PLearn 0.1
|
Normalize the field (subtract the mean then divide by standard dev) More...
#include <SDBVMat.h>


Public Member Functions | |
| SDBVMFieldNormalize (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 |
Normalize the field (subtract the mean then divide by standard dev)
typedef SDBVMFieldSource1 PLearn::SDBVMFieldNormalize::inherited [private] |
Reimplemented from PLearn::SDBVMFieldSource1.
| PLearn::SDBVMFieldNormalize::SDBVMFieldNormalize | ( | SDBVMSource | source, |
| real | missing_values_mapping = MISSING_VALUE |
||
| ) | [inline] |
Definition at line 354 of file SDBVMat.h.
: inherited(source,missing_values_mapping,VMField::Continuous) {}
| void PLearn::SDBVMFieldNormalize::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 312 of file SDBVMat.cc.
References PLearn::SDBVMField::convertMissing(), PLearn::SDBVMSource::getFieldStat(), PLearn::SDBVMSource::getValue(), PLearn::FieldStat::mean(), PLearn::SDBVMFieldSource1::source_, PLearn::FieldStat::stddev(), and x.
{
real x = source_.getValue(sdb,row);
const FieldStat& stat = source_.getFieldStat(sdb,row);
output[0] = (x - stat.mean()) / stat.stddev();
convertMissing(output);
}

| int PLearn::SDBVMFieldNormalize::fieldWidth | ( | ) | const [virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 321 of file SDBVMat.cc.
{
return 1;
}
1.7.4