|
PLearn 0.1
|
Do the following : y = x^a. More...
#include <SDBVMat.h>


Public Member Functions | |
| SDBVMFieldSignedPower (SDBVMSource source, real a, 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_ |
Private Types | |
| typedef SDBVMFieldSource1 | inherited |
typedef SDBVMFieldSource1 PLearn::SDBVMFieldSignedPower::inherited [private] |
Reimplemented from PLearn::SDBVMFieldSource1.
| PLearn::SDBVMFieldSignedPower::SDBVMFieldSignedPower | ( | SDBVMSource | source, |
| real | a, | ||
| real | missing_values_mapping = MISSING_VALUE |
||
| ) | [inline] |
| void PLearn::SDBVMFieldSignedPower::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 386 of file SDBVMat.cc.
References a_, PLearn::SDBVMField::convertMissing(), PLearn::SDBVMSource::getValue(), PLearn::mypow(), PLearn::SDBVMFieldSource1::source_, and x.
{
real x = source_.getValue(sdb,row);
real sign_x = x>=0.0 ? 1.0 : -1.0;
output[0] = sign_x * mypow(x*sign_x, a_);
convertMissing(output);
}

| int PLearn::SDBVMFieldSignedPower::fieldWidth | ( | ) | const [virtual] |
Width that the field occupies in the VMat.
Implements PLearn::SDBVMField.
Definition at line 395 of file SDBVMat.cc.
{
return 1;
}
real PLearn::SDBVMFieldSignedPower::a_ [protected] |
Definition at line 444 of file SDBVMat.h.
Referenced by convertField().
1.7.4