#include <SDBVMat.h>
Inheritance diagram for PLearn::SDBVMOutputCoder:
Public Member Functions | |
SDBVMOutputCoder (SDBVMOutputCoding oc=SDBVMNumeric, real missing_values_mapping=MISSING_VALUE) | |
virtual | ~SDBVMOutputCoder () |
virtual SDBVMOutputCoding | getOutputCoding () const |
--- State accessors and mutators Return current output coding in effect | |
virtual void | setNumClasses (int n_classes) |
Specify the number of classes if something like one-hot coding is desired. | |
virtual int | getNumClasses () const |
Return the current number of classes; this can be zero if only straight numeric coding is desired. | |
virtual void | setMissingValuesMapping (real missing_values_mapping) |
Specify a mapping for missing values passed to setOutput. | |
virtual real | getMissingValuesMapping () const |
Return current missing values mapping. | |
virtual int | fieldWidth () const |
Return the field width required by the selected coding and the number of classes. | |
virtual void | setOutput (real output_value, const Vec &output_field) const |
Code the given real value into the vector; obviously, if one-hot-like coding is desired, a reasonable integer should be passed. | |
Static Public Member Functions | |
template<class Mapping> int | getNumClasses (const Mapping &mapping, real other_values_mapping, real missing_values_mapping) |
int | handleOtherAndMissing (bool all_int, int candidate_max, real other_values_mapping, real missing_values_mapping) |
Called by getNumClasses to handle special mappings. | |
Protected Attributes | |
SDBVMOutputCoding | output_coding_ |
int | num_classes_ |
must be >0 for one-hot coding | |
real | missing_values_mapping_ |
|
Definition at line 49 of file SDBVMat.cc. |
|
Definition at line 55 of file SDBVMat.cc. |
|
Return the field width required by the selected coding and the number of classes.
Definition at line 139 of file SDBVMat.cc. References num_classes_, output_coding_, PLERROR, PLearn::SDBVMNumeric, PLearn::SDBVMOneHot, and PLearn::SDBVMOneHotMinus1. |
|
Return current missing values mapping.
Definition at line 78 of file SDBVMat.cc. References missing_values_mapping_. |
|
Utility function to derive the number of classes given a generic mapping: This function iterates over all targets of a mapping, and notes whether the mapped values are all non-negative integers; if so, it returns one more than the largest encountered integer. Otherwise, it returns zero. If other_values_mapping or missing_values_mapping is MISSING_VALUE, the number of classes is not affected. Note that other_values_mapping can be taken into account by this function, but is not otherwise handled by this class; this special mapping must be handled by other classes. Definition at line 165 of file SDBVMat.cc. References handleOtherAndMissing(). |
|
Return the current number of classes; this can be zero if only straight numeric coding is desired.
Definition at line 68 of file SDBVMat.cc. References num_classes_. |
|
--- State accessors and mutators Return current output coding in effect
Definition at line 58 of file SDBVMat.cc. References output_coding_, and PLearn::SDBVMOutputCoding. |
|
Called by getNumClasses to handle special mappings.
Definition at line 185 of file SDBVMat.cc. References PLearn::is_missing(). Referenced by getNumClasses(). |
|
Specify a mapping for missing values passed to setOutput.
Definition at line 73 of file SDBVMat.cc. References missing_values_mapping_. |
|
Specify the number of classes if something like one-hot coding is desired.
Definition at line 63 of file SDBVMat.cc. References num_classes_. |
|
Code the given real value into the vector; obviously, if one-hot-like coding is desired, a reasonable integer should be passed.
Definition at line 83 of file SDBVMat.cc. References PLearn::TVec< T >::fill(), PLearn::is_missing(), MISSING_VALUE, missing_values_mapping_, num_classes_, output_coding_, PLERROR, PLearn::SDBVMNumeric, PLearn::SDBVMOneHot, PLearn::SDBVMOneHotMinus1, and PLearn::Vec. |
|
Definition at line 136 of file SDBVMat.h. Referenced by getMissingValuesMapping(), setMissingValuesMapping(), and setOutput(). |
|
must be >0 for one-hot coding
Definition at line 135 of file SDBVMat.h. Referenced by fieldWidth(), getNumClasses(), setNumClasses(), and setOutput(). |
|
Definition at line 134 of file SDBVMat.h. Referenced by fieldWidth(), getOutputCoding(), and setOutput(). |