PLearn 0.1
|
Take the positive part of the field, followed by affine transformation: y = a*max(x,0)+b. More...
#include <SDBVMat.h>
Public Member Functions | |
SDBVMFieldPosAffine (SDBVMSource source, real a, real b=0.0, 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. | |
Protected Attributes | |
real | a_ |
real | b_ |
Private Types | |
typedef SDBVMFieldSource1 | inherited |
Take the positive part of the field, followed by affine transformation: y = a*max(x,0)+b.
typedef SDBVMFieldSource1 PLearn::SDBVMFieldPosAffine::inherited [private] |
Reimplemented from PLearn::SDBVMFieldSource1.
PLearn::SDBVMFieldPosAffine::SDBVMFieldPosAffine | ( | SDBVMSource | source, |
real | a, | ||
real | b = 0.0 , |
||
real | missing_values_mapping = MISSING_VALUE |
||
) | [inline] |
void PLearn::SDBVMFieldPosAffine::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 370 of file SDBVMat.cc.
References a_, b_, PLearn::SDBVMField::convertMissing(), PLearn::SDBVMSource::getValue(), PLearn::max(), and PLearn::SDBVMFieldSource1::source_.
{ output[0] = a_ * std::max(real(source_.getValue(sdb,row)), real(0.)) + b_; convertMissing(output); }
int PLearn::SDBVMFieldPosAffine::fieldWidth | ( | ) | const [virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 377 of file SDBVMat.cc.
{
return 1;
}
real PLearn::SDBVMFieldPosAffine::a_ [protected] |
Definition at line 419 of file SDBVMat.h.
Referenced by convertField().
real PLearn::SDBVMFieldPosAffine::b_ [protected] |
Definition at line 419 of file SDBVMat.h.
Referenced by convertField().