PLearn 0.1
|
#include <SDBVMat.h>
Public Member Functions | |
SDBVMField (real missing_values_mapping=MISSING_VALUE, VMField::FieldType field_type=VMField::UnknownType) | |
Constructor: specifies the mapping for missing values. | |
virtual void | convertField (const SDBWithStats &sdb, const Row &theRow, const Vec &outputField) const =0 |
virtual int | fieldWidth () const =0 |
Width that the field occupies in the VMat. | |
VMField::FieldType | fieldType () const |
bool | isContinuous () const |
bool | isDiscrGeneral () const |
bool | isDiscrMonotonic () const |
bool | isDiscrFloat () const |
bool | isDate () const |
virtual SDBVMOutputCoding | getOutputCoding () const |
Protected Member Functions | |
void | convertMissing (const Vec &output) const |
Replace all MISSING_VALUEs in output vector by missing_values_mapping_. | |
Protected Attributes | |
real | missing_values_mapping_ |
VMField::FieldType | field_type_ |
Base class for preprocessing SDB==>VMatrix
This class provides basic functionality for handling generic functional transformation between SimpleDB field(s) and VMatrix segments. (A segment is defined as a part of a VMatrix row, consisting of one or more columns).
PLearn::SDBVMField::SDBVMField | ( | real | missing_values_mapping = MISSING_VALUE , |
VMField::FieldType | field_type = VMField::UnknownType |
||
) | [inline] |
Constructor: specifies the mapping for missing values.
Definition at line 156 of file SDBVMat.h.
: missing_values_mapping_(missing_values_mapping), field_type_(field_type) {}
virtual void PLearn::SDBVMField::convertField | ( | const SDBWithStats & | sdb, |
const Row & | theRow, | ||
const Vec & | outputField | ||
) | const [pure 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.
Implemented in PLearn::SDBVMFieldAsIs, PLearn::SDBVMFieldNormalize, PLearn::SDBVMFieldDivSigma, PLearn::SDBVMFieldAffine, PLearn::SDBVMFieldPosAffine, PLearn::SDBVMFieldSignedPower, PLearn::SDBVMFieldFunc1, PLearn::SDBVMFieldFunc2, PLearn::SDBVMFieldDate, PLearn::SDBVMFieldDay, PLearn::SDBVMFieldMonths, PLearn::SDBVMFieldDateDiff, PLearn::SDBVMFieldDiscrete, PLearn::SDBVMFieldDateGreater, PLearn::SDBVMFieldICBCTargets, and PLearn::SDBVMFieldICBCClassification.
void PLearn::SDBVMField::convertMissing | ( | const Vec & | output | ) | const [protected] |
Replace all MISSING_VALUEs in output vector by missing_values_mapping_.
Definition at line 285 of file SDBVMat.cc.
References i, PLearn::is_missing(), PLearn::TVec< T >::length(), and missing_values_mapping_.
Referenced by PLearn::SDBVMFieldDivSigma::convertField(), PLearn::SDBVMFieldFunc1::convertField(), PLearn::SDBVMFieldFunc2::convertField(), PLearn::SDBVMFieldSumClaims::convertField(), PLearn::SDBVMFieldMonths::convertField(), PLearn::SDBVMFieldAsIs::convertField(), PLearn::SDBVMFieldSignedPower::convertField(), PLearn::SDBVMFieldDay::convertField(), PLearn::SDBVMFieldICBCTargets::convertField(), PLearn::SDBVMFieldAffine::convertField(), PLearn::SDBVMFieldPosAffine::convertField(), PLearn::SDBVMFieldHasClaim::convertField(), and PLearn::SDBVMFieldNormalize::convertField().
{ for (int i=0;i<output.length();i++) if (is_missing(output[i])) output[i]=missing_values_mapping_; }
VMField::FieldType PLearn::SDBVMField::fieldType | ( | ) | const [inline] |
Query the kind of mapping performed by each field DiscrGeneral: arbitrary discrete values DiscrMonotonic: monotonic discrete values DiscrFloat: monotonic + some exceptions
Definition at line 177 of file SDBVMat.h.
Referenced by PLearn::SDBVMatrix::appendField().
{ return field_type_; }
virtual int PLearn::SDBVMField::fieldWidth | ( | ) | const [pure virtual] |
Width that the field occupies in the VMat.
Implemented in PLearn::SDBVMFieldAsIs, PLearn::SDBVMFieldNormalize, PLearn::SDBVMFieldDivSigma, PLearn::SDBVMFieldAffine, PLearn::SDBVMFieldPosAffine, PLearn::SDBVMFieldSignedPower, PLearn::SDBVMFieldFunc1, PLearn::SDBVMFieldFunc2, PLearn::SDBVMFieldDate, PLearn::SDBVMFieldDay, PLearn::SDBVMFieldMonths, PLearn::SDBVMFieldDateDiff, PLearn::SDBVMFieldDiscrete, PLearn::SDBVMFieldDateGreater, PLearn::SDBVMFieldICBCTargets, PLearn::SDBVMFieldHasClaim, PLearn::SDBVMFieldSumClaims, and PLearn::SDBVMFieldICBCClassification.
Referenced by PLearn::SDBVMatrix::appendField().
SDBVMOutputCoding PLearn::SDBVMField::getOutputCoding | ( | ) | const [virtual] |
Reimplemented in PLearn::SDBVMFieldDiscrete.
Definition at line 280 of file SDBVMat.cc.
References PLearn::SDBVMUnknownCoding.
{ return SDBVMUnknownCoding; }
bool PLearn::SDBVMField::isContinuous | ( | ) | const [inline] |
Definition at line 179 of file SDBVMat.h.
References PLearn::VMField::Continuous.
{ return field_type_ == VMField::Continuous; }
bool PLearn::SDBVMField::isDate | ( | ) | const [inline] |
Definition at line 183 of file SDBVMat.h.
References PLearn::VMField::Date.
{ return field_type_ == VMField::Date; }
bool PLearn::SDBVMField::isDiscrFloat | ( | ) | const [inline] |
Definition at line 182 of file SDBVMat.h.
References PLearn::VMField::DiscrFloat.
{ return field_type_ == VMField::DiscrFloat; }
bool PLearn::SDBVMField::isDiscrGeneral | ( | ) | const [inline] |
Definition at line 180 of file SDBVMat.h.
References PLearn::VMField::DiscrGeneral.
{ return field_type_ == VMField::DiscrGeneral; }
bool PLearn::SDBVMField::isDiscrMonotonic | ( | ) | const [inline] |
Definition at line 181 of file SDBVMat.h.
References PLearn::VMField::DiscrMonotonic.
{ return field_type_ == VMField::DiscrMonotonic; }
VMField::FieldType PLearn::SDBVMField::field_type_ [protected] |
real PLearn::SDBVMField::missing_values_mapping_ [protected] |
Definition at line 192 of file SDBVMat.h.
Referenced by PLearn::SDBVMFieldDate::convertField(), convertMissing(), PLearn::SDBVMFieldCodeAsIs::getDiscreteValue(), PLearn::SDBVMFieldRemapStrings::getDiscreteValue(), PLearn::SDBVMFieldDateGreater::getDiscreteValue(), PLearn::SDBVMFieldRemapReals::getDiscreteValue(), and PLearn::SDBVMFieldRemapIntervals::getDiscreteValue().