Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::SDBVMOutputCoder Class Reference

#include <SDBVMat.h>

Inheritance diagram for PLearn::SDBVMOutputCoder:

Inheritance graph
[legend]
Collaboration diagram for PLearn::SDBVMOutputCoder:

Collaboration graph
[legend]
List of all members.

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_

Constructor & Destructor Documentation

PLearn::SDBVMOutputCoder::SDBVMOutputCoder SDBVMOutputCoding  oc = SDBVMNumeric,
real  missing_values_mapping = MISSING_VALUE
 

Definition at line 49 of file SDBVMat.cc.

PLearn::SDBVMOutputCoder::~SDBVMOutputCoder  )  [virtual]
 

Definition at line 55 of file SDBVMat.cc.


Member Function Documentation

int PLearn::SDBVMOutputCoder::fieldWidth  )  const [virtual]
 

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.

real PLearn::SDBVMOutputCoder::getMissingValuesMapping  )  const [virtual]
 

Return current missing values mapping.

Definition at line 78 of file SDBVMat.cc.

References missing_values_mapping_.

template<class Mapping>
int PLearn::SDBVMOutputCoder::getNumClasses const Mapping &  mapping,
real  other_values_mapping,
real  missing_values_mapping
[static]
 

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().

int PLearn::SDBVMOutputCoder::getNumClasses  )  const [virtual]
 

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_.

SDBVMOutputCoding PLearn::SDBVMOutputCoder::getOutputCoding  )  const [virtual]
 

--- State accessors and mutators Return current output coding in effect

Definition at line 58 of file SDBVMat.cc.

References output_coding_, and PLearn::SDBVMOutputCoding.

int PLearn::SDBVMOutputCoder::handleOtherAndMissing bool  all_int,
int  candidate_max,
real  other_values_mapping,
real  missing_values_mapping
[static]
 

Called by getNumClasses to handle special mappings.

Definition at line 185 of file SDBVMat.cc.

References PLearn::is_missing().

Referenced by getNumClasses().

void PLearn::SDBVMOutputCoder::setMissingValuesMapping real  missing_values_mapping  )  [virtual]
 

Specify a mapping for missing values passed to setOutput.

Definition at line 73 of file SDBVMat.cc.

References missing_values_mapping_.

void PLearn::SDBVMOutputCoder::setNumClasses int  n_classes  )  [virtual]
 

Specify the number of classes if something like one-hot coding is desired.

Definition at line 63 of file SDBVMat.cc.

References num_classes_.

void PLearn::SDBVMOutputCoder::setOutput real  output_value,
const Vec output_field
const [virtual]
 

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.


Member Data Documentation

real PLearn::SDBVMOutputCoder::missing_values_mapping_ [protected]
 

Definition at line 136 of file SDBVMat.h.

Referenced by getMissingValuesMapping(), setMissingValuesMapping(), and setOutput().

int PLearn::SDBVMOutputCoder::num_classes_ [protected]
 

must be >0 for one-hot coding

Definition at line 135 of file SDBVMat.h.

Referenced by fieldWidth(), getNumClasses(), setNumClasses(), and setOutput().

SDBVMOutputCoding PLearn::SDBVMOutputCoder::output_coding_ [protected]
 

Definition at line 134 of file SDBVMat.h.

Referenced by fieldWidth(), getOutputCoding(), and setOutput().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:22:48 2004 for PLearn by doxygen 1.3.7