Sleipnir
Public Member Functions
Sleipnir::CPCLPair Class Reference

Encapsulates a CPCL paired with a quantization file. More...

#include <datapair.h>

Inheritance diagram for Sleipnir::CPCLPair:
Sleipnir::CPCLPairImpl Sleipnir::CPairImpl Sleipnir::CPCL Sleipnir::CPCLImpl

Public Member Functions

bool Open (const char *szDatafile, size_t iSkip)
 Open the given data file as a PCL and load discretization bin edges from an accompanying QUANT file.
size_t Quantize (float dValue, size_t iExperiment) const
 Return the discretized form of the given value using the PCL pair's current bin edges.
void Quantize ()
unsigned char GetValues (size_t iExperiment) const
 Returns the number of discrete values taken by this PCL pair.

Detailed Description

Encapsulates a CPCL paired with a quantization file.

A PCL pair consists of a CPCL paired with quantization information. This information is generally stored in a QUANT file with the same name and location as the PCL. For example, a PCL file named data.pcl and a QUANT file named data.quant might reside in the same directory; these would be loaded together as a CPCLPair. The discretization information from the QUANT can be used to convert continuous values in the PCL into discrete values, e.g. for use with a Bayes net.

Unlike a CDataPair, a PCL's QUANT file should contain one line per experiment. Each line is the equivalent of one standard QUANT file, i.e. it contains tab delimited bin edges in increasing order, the largest of which is ignored. This allows the values for individual experiments to be discretized differently if so desired.

Remarks:
The number of lines in the QUANT file must equal the number of experiments in the PCL file.
See also:
IBayesNet::Evaluate

Definition at line 192 of file datapair.h.


Member Function Documentation

unsigned char Sleipnir::CPCLPair::GetValues ( size_t  iExperiment) const [inline]

Returns the number of discrete values taken by this PCL pair.

Returns:
Number of discrete values taken by this PCL pair.
Remarks:
Equivalent to number of bins in the PCL pair and number of bin edges in the QUANT file.
See also:
SetQuants | Quantize

Definition at line 211 of file datapair.h.

bool Sleipnir::CPCLPair::Open ( const char *  szDatafile,
size_t  iSkip 
)

Open the given data file as a PCL and load discretization bin edges from an accompanying QUANT file.

Parameters:
szDatafileFilename from which PCL is loaded.
iSkipNumber of columns to skip between the ID and experiments.
Returns:
True if PCL pair was generated successfully.
See also:
CPCL::Open

Definition at line 464 of file datapair.cpp.

References Sleipnir::CPCL::GetExperiments(), and Sleipnir::CPCL::Open().

size_t Sleipnir::CPCLPair::Quantize ( float  dValue,
size_t  iExperiment 
) const

Return the discretized form of the given value using the PCL pair's current bin edges.

Parameters:
dValueContinuous value to be discretized.
iExperimentExperiment index whose bin edges should be used for discretization.
Returns:
Discretized version of the given value, less than the number of bins; -1 if the given value is not finite.
See also:
CDataPair::Quantize

Definition at line 505 of file datapair.cpp.

References Sleipnir::CMeta::Quantize().


The documentation for this class was generated from the following files: