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

PLearn::SDBVMFieldDiscrete Class Reference

A field that recodes its source field according to an OutputCoder object. More...

#include <SDBVMat.h>

Inheritance diagram for PLearn::SDBVMFieldDiscrete:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SDBVMFieldDiscrete (SDBVMSource source, int num_classes=0, real missing_values_mapping=MISSING_VALUE, SDBVMOutputCoding oc=SDBVMNumeric, VMField::FieldType ft=VMField::DiscrGeneral)
 SDBVMFieldDiscrete (SDBVMSource source, SDBVMOutputCoder *oc, int num_classes=0, real missing_values_mapping=MISSING_VALUE, VMField::FieldType ft=VMField::DiscrGeneral)
 Version of the constructor that takes an OutputCoder object.

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.

virtual SDBVMOutputCoding getOutputCoding () const
virtual real getDiscreteValue (const SDBWithStats &sdb, const Row &row) const =0
int getNumClasses () const
 Return the number of possible discrete values from 0 to N-1.

void setNumClasses (int)
 Call this function to set the number of classes (don't play with num_classes_ directly ==> important).

void setOutputCoder (SDBVMOutputCoder *oc)
 Set the currently-active output coder (captures ownership of passed object).


Protected Attributes

int num_classes_
 must be >0 for one-hot coding

PSDBVMOutputCoder output_coder_
 perform actual formatting


Private Types

typedef SDBVMFieldSource1 inherited

Detailed Description

A field that recodes its source field according to an OutputCoder object.

Definition at line 604 of file SDBVMat.h.


Member Typedef Documentation

typedef SDBVMFieldSource1 PLearn::SDBVMFieldDiscrete::inherited [private]
 

Reimplemented from PLearn::SDBVMFieldSource1.

Reimplemented in PLearn::SDBVMFieldDateGreater, PLearn::SDBVMFieldCodeAsIs, PLearn::SDBVMFieldRemapReals, PLearn::SDBVMFieldRemapStrings, PLearn::SDBVMFieldRemapIntervals, and PLearn::SDBVMFieldMultiDiscrete.

Definition at line 606 of file SDBVMat.h.

Referenced by SDBVMFieldDiscrete().


Constructor & Destructor Documentation

PLearn::SDBVMFieldDiscrete::SDBVMFieldDiscrete SDBVMSource  source,
int  num_classes = 0,
real  missing_values_mapping = MISSING_VALUE,
SDBVMOutputCoding  oc = SDBVMNumeric,
VMField::FieldType  ft = VMField::DiscrGeneral
 

All constructors now specify the number of classes (between 0 and n-1), and whether one_hot output coding is desired (true) or direct integer codes (false, the default). By default, num_classes is not known at construction time, and must be set by derived classes. A remapping for missing values can also be provided.

Definition at line 588 of file SDBVMat.cc.

References inherited, and output_coder_.

PLearn::SDBVMFieldDiscrete::SDBVMFieldDiscrete SDBVMSource  source,
SDBVMOutputCoder oc,
int  num_classes = 0,
real  missing_values_mapping = MISSING_VALUE,
VMField::FieldType  ft = VMField::DiscrGeneral
 

Version of the constructor that takes an OutputCoder object.

Definition at line 597 of file SDBVMat.cc.

References output_coder_.


Member Function Documentation

void PLearn::SDBVMFieldDiscrete::convertField const SDBWithStats sdb,
const Row row,
const Vec output
const [virtual]
 

This function is implemented as a call to a virtual function getDiscreteValue(), followed by a call to setOutput of the OutputCoder.

Implements PLearn::SDBVMField.

Reimplemented in PLearn::SDBVMFieldDateGreater.

Definition at line 605 of file SDBVMat.cc.

References getDiscreteValue(), output_coder_, and PLearn::Vec.

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

Width that the field occupies in the VMat.

Implements PLearn::SDBVMField.

Reimplemented in PLearn::SDBVMFieldDateGreater.

Definition at line 612 of file SDBVMat.cc.

References output_coder_.

virtual real PLearn::SDBVMFieldDiscrete::getDiscreteValue const SDBWithStats sdb,
const Row row
const [pure virtual]
 

This function must be overridden in derived classes to get the correctly-mapped discrete value obtained from the SDB. The semantics prescribe missing values to be remapped to missing_values_mapping_.

Implemented in PLearn::SDBVMFieldDateGreater, PLearn::SDBVMFieldCodeAsIs, PLearn::SDBVMFieldRemapReals, PLearn::SDBVMFieldRemapStrings, PLearn::SDBVMFieldRemapIntervals, and PLearn::SDBVMFieldMultiDiscrete.

Referenced by convertField().

int PLearn::SDBVMFieldDiscrete::getNumClasses  )  const [inline]
 

Return the number of possible discrete values from 0 to N-1.

Definition at line 645 of file SDBVMat.h.

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

Reimplemented from PLearn::SDBVMField.

Definition at line 617 of file SDBVMat.cc.

References output_coder_, and PLearn::SDBVMOutputCoding.

void PLearn::SDBVMFieldDiscrete::setNumClasses int   ) 
 

Call this function to set the number of classes (don't play with num_classes_ directly ==> important).

Definition at line 622 of file SDBVMat.cc.

References num_classes_, and output_coder_.

void PLearn::SDBVMFieldDiscrete::setOutputCoder SDBVMOutputCoder oc  )  [inline]
 

Set the currently-active output coder (captures ownership of passed object).

Definition at line 653 of file SDBVMat.h.


Member Data Documentation

int PLearn::SDBVMFieldDiscrete::num_classes_ [protected]
 

must be >0 for one-hot coding

Definition at line 657 of file SDBVMat.h.

Referenced by setNumClasses().

PSDBVMOutputCoder PLearn::SDBVMFieldDiscrete::output_coder_ [protected]
 

perform actual formatting

Definition at line 658 of file SDBVMat.h.

Referenced by convertField(), fieldWidth(), getOutputCoding(), SDBVMFieldDiscrete(), and setNumClasses().


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