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

PLearn::SDBVMFieldRemapStrings Class Reference

#include <SDBVMat.h>

Inheritance diagram for PLearn::SDBVMFieldRemapStrings:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SDBVMFieldRemapStrings (SDBVMSource source, const string &mappings, real other_values_mapping=MISSING_VALUE, real missing_values_mapping=MISSING_VALUE, SDBVMOutputCoding oc=SDBVMNumeric, VMField::FieldType ft=VMField::DiscrGeneral)
 This constructor accepts an explicitly-specified mappings string.

 SDBVMFieldRemapStrings (SDBVMSource source, const FieldStat &field_stat, real other_values_mapping=MISSING_VALUE, real missing_values_mapping=MISSING_VALUE, SDBVMOutputCoding oc=SDBVMNumeric, VMField::FieldType ft=VMField::DiscrGeneral)
virtual real getDiscreteValue (const SDBWithStats &sdb, const Row &row) const
 Perform the actual remapping.


Static Public Member Functions

StringMap getStringMapping (const string &mappings)
 This parses the remapping string and returns a map.


Protected Attributes

StringMap string_mapping_
real other_values_mapping_

Private Types

typedef SDBVMFieldDiscrete inherited
typedef map< string, realStringMap

Detailed Description

A field that remaps a finite set of strings onto discrete integers. The format of "mappings" is a string of the form: "string_0 value_0 string_1 value_1 ... string_N value_N" where the string_i cannot contain spaces, and the space is the delimiter between strings and values. If none of the "string_X" is seen then the "other_values_mapping" value is obtained. If the SDB contains a MISSING_VALUE then the "missing_values_mapping" is given.

Definition at line 768 of file SDBVMat.h.


Member Typedef Documentation

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

Reimplemented from PLearn::SDBVMFieldDiscrete.

Definition at line 770 of file SDBVMat.h.

Referenced by SDBVMFieldRemapStrings().

typedef map<string,real> PLearn::SDBVMFieldRemapStrings::StringMap [private]
 

Definition at line 771 of file SDBVMat.h.

Referenced by getStringMapping().


Constructor & Destructor Documentation

PLearn::SDBVMFieldRemapStrings::SDBVMFieldRemapStrings SDBVMSource  source,
const string mappings,
real  other_values_mapping = MISSING_VALUE,
real  missing_values_mapping = MISSING_VALUE,
SDBVMOutputCoding  oc = SDBVMNumeric,
VMField::FieldType  ft = VMField::DiscrGeneral
 

This constructor accepts an explicitly-specified mappings string.

Definition at line 761 of file SDBVMat.cc.

References inherited, and string_mapping_.

PLearn::SDBVMFieldRemapStrings::SDBVMFieldRemapStrings SDBVMSource  source,
const FieldStat field_stat,
real  other_values_mapping = MISSING_VALUE,
real  missing_values_mapping = MISSING_VALUE,
SDBVMOutputCoding  oc = SDBVMNumeric,
VMField::FieldType  ft = VMField::DiscrGeneral
 

This constructor accepts mappings coming from a FieldStat. Note that the "hasmissing" field of the FieldStat is not automatically taken into account, and you must provide a missing_values_mapping here by yourself. The mapping is not modified in any way by the presence of missing values.

Definition at line 776 of file SDBVMat.cc.

References string_mapping_, and PLearn::FieldStat::symbolid.


Member Function Documentation

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

Perform the actual remapping.

Implements PLearn::SDBVMFieldDiscrete.

Definition at line 795 of file SDBVMat.cc.

References PLearn::SDBVMSource::getValue(), PLearn::FieldValue::isMissing(), other_values_mapping_, PLearn::space_to_underscore(), and string_mapping_.

SDBVMFieldRemapStrings::StringMap PLearn::SDBVMFieldRemapStrings::getStringMapping const string mappings  )  [static]
 

This parses the remapping string and returns a map.

The maximum target value in the map is set into the last (reference) argument.

Definition at line 742 of file SDBVMat.cc.

References StringMap.


Member Data Documentation

real PLearn::SDBVMFieldRemapStrings::other_values_mapping_ [protected]
 

Definition at line 804 of file SDBVMat.h.

Referenced by getDiscreteValue().

StringMap PLearn::SDBVMFieldRemapStrings::string_mapping_ [protected]
 

Definition at line 803 of file SDBVMat.h.

Referenced by getDiscreteValue(), and SDBVMFieldRemapStrings().


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