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

PLearn::RealMapping Class Reference

#include <RealMapping.h>

Inheritance diagram for PLearn::RealMapping:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef pair< RealRange, realsingle_mapping_t
typedef TVec< single_mapping_tordered_mapping_t
typedef map< RealRange, realmapping_t
typedef mapping_t::iterator iterator
typedef mapping_t::const_iterator const_iterator
typedef Object inherited

Public Member Functions

virtual string classname () const
virtual OptionListgetOptionList () const
virtual RealMappingdeepCopy (CopiesMap &copies) const
 RealMapping ()
int size () const
int length () const
void clear ()
 Removes all entries in mapping. Does not change other params.

void buildOrderedMapping ()
bool checkConsistency ()
void removeMapping (const RealRange &range)
void removeMapping (real x)
void addMapping (const RealRange &range, real val)
void setMappingForMissing (real what_missing_mapsto)
 Set mapping for missing value (by default it maps to MISSING_VALUE).

void setMappingForOther (real what_other_mapsto)
 Set mapping for any other value (by default it is kept as is).

void keepOtherAsIs ()
real map (real val) const
int binnumber (real val) const
void transform (const Vec &v) const
pair< RealRange, reallastMapping ()
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
void erase (iterator it)
bool operator== (const RealMapping &rm) const
virtual void print (ostream &out) const
virtual void write (ostream &out) const
virtual void read (istream &in)
real maxMappedToValue ()
Vec getCutPoints () const
 If all ranges in the mapping are consecutive, return the cut points between different ranges.


Static Public Member Functions

string _classname_ ()
OptionList_getOptionList_ ()
Object_new_instance_for_typemap_ ()
bool _isa_ (Object *o)
void _static_initialize_ ()

Public Attributes

mapping_t mapping
ordered_mapping_t o_mapping
real missing_mapsto
bool keep_other_as_is
real other_mapsto

Static Public Attributes

StaticInitializer _static_initializer_

Static Protected Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Member Typedef Documentation

typedef mapping_t::const_iterator PLearn::RealMapping::const_iterator
 

Definition at line 134 of file RealMapping.h.

typedef Object PLearn::RealMapping::inherited
 

Reimplemented from PLearn::Object.

Definition at line 145 of file RealMapping.h.

typedef mapping_t::iterator PLearn::RealMapping::iterator
 

Definition at line 133 of file RealMapping.h.

Referenced by buildOrderedMapping().

typedef map<RealRange, real> PLearn::RealMapping::mapping_t
 

Definition at line 132 of file RealMapping.h.

typedef TVec< single_mapping_t > PLearn::RealMapping::ordered_mapping_t
 

Definition at line 131 of file RealMapping.h.

typedef pair<RealRange, real> PLearn::RealMapping::single_mapping_t
 

Definition at line 130 of file RealMapping.h.

Referenced by PLearn::operator<().


Constructor & Destructor Documentation

PLearn::RealMapping::RealMapping  )  [inline]
 

Definition at line 148 of file RealMapping.h.

References MISSING_VALUE.


Member Function Documentation

string PLearn::RealMapping::_classname_  )  [static]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

OptionList & PLearn::RealMapping::_getOptionList_  )  [static]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

bool PLearn::RealMapping::_isa_ Object o  )  [static]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

Object * PLearn::RealMapping::_new_instance_for_typemap_  )  [static]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

void PLearn::RealMapping::_static_initialize_  )  [static]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

void PLearn::RealMapping::addMapping const RealRange range,
real  val
 

Definition at line 169 of file RealMapping.cc.

References mapping, and val.

Referenced by PLearn::StatsCollector::getAllValuesMapping(), PLearn::StatsCollector::getBinMapping(), and read().

const_iterator PLearn::RealMapping::begin  )  const [inline]
 

Definition at line 214 of file RealMapping.h.

iterator PLearn::RealMapping::begin  )  [inline]
 

Definition at line 212 of file RealMapping.h.

Referenced by buildOrderedMapping().

int PLearn::RealMapping::binnumber real  val  )  const
 

Definition at line 182 of file RealMapping.cc.

References PLearn::is_missing(), mapping, and val.

void PLearn::RealMapping::buildOrderedMapping  ) 
 

Definition at line 147 of file RealMapping.cc.

References PLearn::TVec< T >::begin(), begin(), PLearn::TVec< T >::end(), end(), iterator, o_mapping, PLearn::TVec< T >::push_back(), and PLearn::TVec< T >::resize().

bool PLearn::RealMapping::checkConsistency  ) 
 

Definition at line 321 of file RealMapping.cc.

References mapping, and PLearn::max().

string PLearn::RealMapping::classname  )  const [virtual]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

void PLearn::RealMapping::clear  )  [inline]
 

Removes all entries in mapping. Does not change other params.

Definition at line 158 of file RealMapping.h.

Referenced by read().

void PLearn::RealMapping::declareOptions OptionList ol  )  [static, protected]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::Object.

Definition at line 138 of file RealMapping.cc.

References PLearn::declareOption(), and PLearn::OptionList.

RealMapping * PLearn::RealMapping::deepCopy CopiesMap copies  )  const [virtual]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

const_iterator PLearn::RealMapping::end  )  const [inline]
 

Definition at line 218 of file RealMapping.h.

iterator PLearn::RealMapping::end  )  [inline]
 

Definition at line 216 of file RealMapping.h.

Referenced by buildOrderedMapping().

void PLearn::RealMapping::erase iterator  it  )  [inline]
 

Definition at line 220 of file RealMapping.h.

Vec PLearn::RealMapping::getCutPoints  )  const
 

If all ranges in the mapping are consecutive, return the cut points between different ranges.

e.g.: [0,1[ [1, 5[ [5, 10] ]10, 15]--> <0,1,5,10,15>.

Definition at line 310 of file RealMapping.cc.

References PLearn::TVec< T >::first(), length(), and mapping.

OptionList & PLearn::RealMapping::getOptionList  )  const [virtual]
 

Reimplemented from PLearn::Object.

Definition at line 52 of file RealMapping.cc.

void PLearn::RealMapping::keepOtherAsIs  )  [inline]
 

Definition at line 192 of file RealMapping.h.

pair<RealRange, real> PLearn::RealMapping::lastMapping  )  [inline]
 

Definition at line 204 of file RealMapping.h.

Referenced by PLearn::StatsCollector::getBinMapping().

int PLearn::RealMapping::length  )  const [inline]
 

Definition at line 155 of file RealMapping.h.

Referenced by PLearn::ConditionalStatsCollector::findrange(), and getCutPoints().

real PLearn::RealMapping::map real  val  )  const
 

Definition at line 155 of file RealMapping.cc.

References PLearn::is_missing(), keep_other_as_is, mapping, missing_mapsto, other_mapsto, and val.

Referenced by PLearn::ConditionalStatsCollector::findrange(), and transform().

real PLearn::RealMapping::maxMappedToValue  ) 
 

Definition at line 127 of file RealMapping.cc.

References mapping, and PLearn::max().

bool PLearn::RealMapping::operator== const RealMapping rm  )  const
 

Definition at line 114 of file RealMapping.cc.

References keep_other_as_is, mapping, missing_mapsto, other_mapsto, and PLearn::rm().

void PLearn::RealMapping::print ostream &  out  )  const [virtual]
 

Prints a human-readable, short (not necessarily complete) description of this object instance (default prints info()). This is what is called by operator<< on Object

Reimplemented from PLearn::Object.

Definition at line 206 of file RealMapping.cc.

References PLearn::endl(), PLearn::is_missing(), keep_other_as_is, mapping, missing_mapsto, and other_mapsto.

void PLearn::RealMapping::read istream &  in  )  [virtual]
 

DEPRECATED (use the declareOption / build_ mecanism instead, that provides automatic serialization) The read method is the counterpart of the write method. It should be able to reconstruct an object that has been previously written with the write method. The current implementation automatically decides whether to call newread() (which is based on the new declareOptions/build mechanism) or oldread() for backward compatibility (if the header is of the form <classname>).

Reimplemented from PLearn::Object.

Definition at line 227 of file RealMapping.cc.

References addMapping(), clear(), PLearn::PStream::get(), keep_other_as_is, missing_mapsto, MISSING_VALUE, PLearn::peekAfterSkipBlanks(), PLERROR, PLearn::RealRange::read(), PLearn::readFooter(), PLearn::readHeader(), PLearn::removeblanks(), setMappingForMissing(), setMappingForOther(), PLearn::upperstring(), val, and PLearn::ws().

void PLearn::RealMapping::removeMapping real  x  )  [inline]
 

Definition at line 173 of file RealMapping.h.

References PLWARNING, PLearn::RealRange::RealRange(), and x.

void PLearn::RealMapping::removeMapping const RealRange range  )  [inline]
 

Definition at line 164 of file RealMapping.h.

References PLWARNING.

Referenced by PLearn::StatsCollector::getBinMapping().

void PLearn::RealMapping::setMappingForMissing real  what_missing_mapsto  )  [inline]
 

Set mapping for missing value (by default it maps to MISSING_VALUE).

Definition at line 185 of file RealMapping.h.

Referenced by read().

void PLearn::RealMapping::setMappingForOther real  what_other_mapsto  )  [inline]
 

Set mapping for any other value (by default it is kept as is).

Definition at line 189 of file RealMapping.h.

Referenced by PLearn::StatsCollector::getBinMapping(), and read().

int PLearn::RealMapping::size  )  const [inline]
 

Definition at line 154 of file RealMapping.h.

Referenced by PLearn::StatsCollector::getBinMapping().

void PLearn::RealMapping::transform const Vec v  )  const
 

Definition at line 195 of file RealMapping.cc.

References PLearn::TVec< T >::data(), PLearn::TVec< T >::length(), map(), and PLearn::Vec.

void PLearn::RealMapping::write ostream &  out  )  const [virtual]
 

DEPRECATED (use the declareOption / build_ mecanism instead, that provides automatic serialization) The write method should write a complete description of the object to the given stream, that should be enough to later reconstruct it. (a somewhat human-readable ascii format is usually preferred). The new default version simply calls newwrite(...) which simply writes all the "options" declared in declareOptions, so there is no need to overload write in subclasses. Old classes that still overload write should progressively be moved to the new declareOptions/build mechanism.

Reimplemented from PLearn::Object.

Definition at line 220 of file RealMapping.cc.

References PLearn::print(), PLearn::writeFooter(), and PLearn::writeHeader().


Member Data Documentation

StaticInitializer PLearn::RealMapping::_static_initializer_ [static]
 

Reimplemented from PLearn::Object.

bool PLearn::RealMapping::keep_other_as_is
 

Definition at line 141 of file RealMapping.h.

Referenced by PLearn::StatsCollector::getAllValuesMapping(), map(), operator==(), print(), and read().

mapping_t PLearn::RealMapping::mapping
 

Definition at line 135 of file RealMapping.h.

Referenced by addMapping(), binnumber(), checkConsistency(), getCutPoints(), map(), maxMappedToValue(), operator==(), and print().

real PLearn::RealMapping::missing_mapsto
 

Definition at line 140 of file RealMapping.h.

Referenced by map(), operator==(), print(), and read().

ordered_mapping_t PLearn::RealMapping::o_mapping
 

Definition at line 139 of file RealMapping.h.

Referenced by buildOrderedMapping().

real PLearn::RealMapping::other_mapsto
 

Definition at line 142 of file RealMapping.h.

Referenced by PLearn::StatsCollector::getAllValuesMapping(), map(), operator==(), and print().


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