Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

SampleModeler Class Reference
[Modelers]

#include <samplemodeler.hpp>

Inheritance diagram for SampleModeler:

OctaneModeler_WeightVectored OctaneModeler OctaneClass List of all members.

Detailed Description

This is a sample modeler which simply ignores all 'training' information and assigns equal probability to each symbol in the parser (sometimes called a -1 order model).

Definition at line 28 of file samplemodeler.hpp.

Public Member Functions

 SampleModeler ()
 constructor

virtual ~SampleModeler ()
 destructor

virtual std::string GetName ()
 provide a unique name for the coder, used in some cases to automatically register the object with a manager

virtual std::string GetDescription ()
 optionally provide a longer (maybe 20-60 characters) description

virtual bool CreateModelUsingStream (OctaneParser *parserp, bitreader &from)
 Build a model using a stream and a parser.

virtual bool CreateModelUsingParser (OctaneParser *parserp)
 Build a model just using parser.


Member Function Documentation

virtual std::string SampleModeler::GetName  )  [inline, virtual]
 

provide a unique name for the coder, used in some cases to automatically register the object with a manager

Returns:
a short *unique* name

Reimplemented from OctaneModeler_WeightVectored.

Definition at line 38 of file samplemodeler.hpp.

00038 {return "SampleModeler";}

virtual std::string SampleModeler::GetDescription  )  [inline, virtual]
 

optionally provide a longer (maybe 20-60 characters) description

Returns:
a one line description

Reimplemented from OctaneModeler_WeightVectored.

Definition at line 39 of file samplemodeler.hpp.

00039 {return "Fixed Equal-Probability Modeler";}

virtual bool SampleModeler::CreateModelUsingStream OctaneParser parserp,
bitreader from
[inline, virtual]
 

Build a model using a stream and a parser.

Returns:
true on success.

Reimplemented from OctaneModeler.

Definition at line 44 of file samplemodeler.hpp.

References CreateModelUsingParser().

00044 {return CreateModelUsingParser(parserp);};

bool SampleModeler::CreateModelUsingParser OctaneParser parserp  )  [virtual]
 

Build a model just using parser.

This is called on startup, before any possible training, when a default parser exists.

Note:
that no input (training) stream is provider; some modelers may ignore this.
Returns:
true on success

Reimplemented from OctaneModeler.

Definition at line 16 of file samplemodeler.cpp.

References OctaneParser::GetSymbolCount(), SymbolWeightVector::NormalizeToProbabilityDistribution(), SymbolWeightVector::SetSymbolCount(), SymbolWeightVector::SetSymbolWeight(), and OctaneModeler_WeightVectored::weightvector.

Referenced by CreateModelUsingStream().

00017         {
00018         // initialize vector with proper number of symbols as specified by the parser
00019         int symbolcount=parserp->GetSymbolCount();
00020         weightvector.SetSymbolCount(symbolcount);
00021 
00022         // set them all equal
00023         for (int index=0;index<symbolcount;++index)
00024                 weightvector.SetSymbolWeight(index,1);
00025 
00026         // normalize to probability distribution
00027         weightvector.NormalizeToProbabilityDistribution();
00028 
00029         // success
00030         return true;
00031         }


The documentation for this class was generated from the following files:  
Generated on 20 May 2004 by doxygen 1.3.3