DSL_equationEvaluation

<< Click to Display Table of Contents >>

Navigation:  Reference Manual > Node values >

DSL_equationEvaluation

Header file: valequationevaluation.h

class DSL_equationEvaluation : public DSL_nodeVal

DSL_equationEvaluation class is derived from DSL_nodeVal. DSL_equationEvaluation is always associated with equation nodes, which have definitions of DSL_equation type.

The value is represented either by samples, or when sampling algorithm could not be invoked given the current network evidence, by discretized beliefs. During the lifetime of DSL_equationEvaluation object, its representation can change. Call IsDiscretized to determine which representation is used.

The only evidence type that can be set on DSL_equationEvaluation is continous evidence.


virtual int GetType() const;

Overridden method from DSL_nodeVal. Returns DSL_EQUATIONEVALUATION.


virtual int GetMean(double& mean) const;

Overridden method from DSL_nodeVal. Writes the mean value of the node to the mean output parameter. Returns DSL_OKAY on success, or a negative error code on failure.


virtual int GetStdDev(double& stddev) const;

Overridden method from DSL_nodeVal. Writes the standard deviation of the node's marginal probability distribution to the stddev output parameter. Returns DSL_OKAY on success, or a negative error code on failure.


virtual int GetEvidence(double &evidence) const;

Overridden method from DSL_nodeVal. Writes node evidence in its output evidence parameter. Returns DSL_OKAY on success, or a negative error code on failure.


virtual int SetEvidence(double evidence);

Overridden method from DSL_nodeVal. Sets the evidence as a continuous number. Returns DSL_OKAY on success, or a negative error code on failure.


virtual int ClearEvidence();

Overridden method from DSL_nodeVal. Removes the evidence from the node. Returns DSL_OKAY on success, or a negative error code on failure.


virtual int ClearEvidence();

Overridden method from DSL_nodeVal. Removes the propagated evidence from the node. Returns DSL_OKAY on success, or a negative error code on failure.


bool IsDiscretized() const;

Returns true if node value is discretized.


const DSL_Dmatrix& GetDiscBeliefs() const;

Returns a reference to the discretized beliefs stored in one-dimensional DSL_Dmatrix. If the matrix is non-empty, the equation was evaluated over a temporary discrete network and contains no samples. Therefore, all sample-related methods should not be called and the only information about node probabilities is contained in the beliefs vector. GetMean and GetStdDev will return the mean and standard deviation based on the discretized beliefs and the node's discretization intervals.


const std::vector<double>& GetSamples() const;

Returns a reference to the vector of samples generated for the node during stochastic inference. The size of the vector is no larger than a value passed to DSL_network::SetNumberOfSamples. If outlier rejection was enabled by DSL_network::EnableRejectOutlierSamples, some of the samples may be rejected if their value does not fall inside the bounds specified for the node with DSL_equation::SetBounds.


bool HasSamplesOutOfBounds() const;

Returns true if the node's value has samples out of bounds. If outlier rejection was enabled by DSL_network::EnableRejectOutlierSamples, the samples out of bounds are not recorded, and HasSamplesOutOfBounds will return false.


void GetStats(double &mean, double &stddev, double &vmin, double &vmax) const;

If node value is sample-based, writes mean, standard deviation, minimum and maximum to its output parameters.


int GetHistogram(double lo, double hi, int binCount, std::vector<int> &histogram) const;

Calculates the number of samples that fall into evenly spaced bins between lo and hi. Returns DSL_OKAY, or a negative error code on failure.


void SamplingStart(int samplesToReserve=0);

void AddSample(double sample);

int SamplingEnd();

Methods invoked by sampling algorithms to record samples.