uk.co.agena.minerva.model.extendedbn
Class NumericalEN

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedNode
      extended by uk.co.agena.minerva.model.extendedbn.NumericalEN
All Implemented Interfaces:
java.lang.Comparable, java.util.EventListener, ExtendedNodeListener, ExtendedStateListener, Identifiable, Nameable, Writable
Direct Known Subclasses:
ContinuousEN, DiscreteRealEN

public abstract class NumericalEN
extends ExtendedNode

This is an abstract class representing all ExtendedNodes that have numerical states.


Field Summary
 
Fields inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
actOnMarginalsChangedEvent, answerable, connBn, connectableInputNode, connectableOutputNode, connNodeId, CONTINUOUS_INTERVAL_E_N, CURRENT_FUNCTION_STRING, currentNodeFunction, currentParentModelNodeAltId, currentPartitionedModelNodeFunctions, currentPartitionedParentModelNodeAltIds, currentPartitionedParentModelNodes, DEFAULT_FUNCTION_STRING, defaultNodeFunction, defaultParentModelNodeAltId, defaultPartitionedModelNodeFunctions, defaultPartitionedParentModelNodeAltIds, defaultPartitionedParentModelNodes, DELTA, DISCRETE_REAL_E_N, EDITABLE_NODE_FUNCTION, EDITABLE_NPT, EDITABLE_PARENT_STATE_FUNCTIONS, extendedStates, functionMode, id, inputNodeReceivedMarginals, LABELLED_E_N, name, nptReCalcRequired, nptSynchronisedWithFormula, NUMERICAL_E_N, PROBS_NOT_EDITABLE, reportable, supportedFunctionTypes, targetValue, targetValuePresent, version, visible
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
NumericalEN()
          Default constructor.
NumericalEN(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs a NumericalEN with the specified name and connected BN.
NumericalEN(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs a NumericalEN with the specified name, connected node ID and connected BN.
 
Method Summary
abstract  DataSet createDataSetFromNumericValue(double value, NameDescription name)
          Takes the supplied value and creates a DataSet of hard evidence i.e.
protected  void fillArraysUsingAbsolutes(double[] xVals, double[] pXs)
          Fills the two specified arrays with numerical values and their associated probabilities using the node marginals.
protected  void fillArraysUsingIntervals(Range[] xIntervals, double[] pXs)
          Fills the two specified arrays with Ranges and their associated probabilities using the node marginals.
 double[] getDisceteValues()
          Returns a double[] of all the discrete values in this node.
 double mean()
          Calculates the mean of the marginals for this ExtendedNode.
 double median()
          Calculates the median of the marginals for this ExtendedNode.
 double percentile(double perc)
          Calculates the specified percentile of the marginals for this ExtendedNode.
 double standardDeviation()
          Calculates the standard deviation of the marginals for this ExtendedNode.
 double variance()
          Calculates the variance of the marginals for this ExtendedNode.
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
addChild, addExpressionVariable, addExtendedNodeListener, addExtendedState, addExtendedState, addExtendedStates, addParent, cloneTypeSpecific, compareTo, configureDefaultExtendedStates, constructExtraFieldString, containsFunctionOfType, containsOnlyStatisticalFunctions, copy, createDataPointFromExtendedState, createDataSetForExtendedStates, createExtendedStates, createNewExtendedState, cropFunctions, enterDistributionOfEvidence, enterDistributionOfEvidence, enterHardEvidence, enterHardEvidence, extendedNodeAttributeChanged, extendedNodeConnBNNotFound, extendedNodeConnNodeIdChanged, extendedNodeInconsistentEvidenceEntered, extendedNodeMarginalsChanged, extendedNodeNameDescriptionChanged, extendedNodeStateNameChanged, extendedNodeStatesReplaced, extendedNodeVariableAdded, extendedNodeVariableRemoved, extendedNodeVisibleAttributeChanged, extendedStateAdded, extendedStateNameDescriptionChanged, extendedStateRemoved, fireMarginalsChangedEvent, getActOnMarginalsChangedEvent, getAnswerable, getConcreteNodeName, getConcreteNodeType, getConcreteNodeTypeNames, getConnBn, getConnNodeId, getCoreBNNodeEquivalents, getCurrentNodeFunction, getCurrentParentModelNodeAltId, getCurrentPartitionedModelNodeFunctions, getCurrentPartitionedParentModelNodeAltIds, getCurrentPartitionedParentModelNodes, getDefaultNodeFunction, getDefaultParentModelNodeAltId, getDefaultPartitionedModelNodeFunctions, getDefaultPartitionedParentModelNodeAltIds, getDefaultPartitionedParentModelNodes, getExpression, getExpressionVariables, getExtendedState, getExtendedStateAtIndex, getExtendedStates, getExtendedStateShortNames, getExtendedStateWithName, getExtendedStateWithShortDesc, getFunctionMode, getHardEvidence, getId, getInputNodeRecivedMarginalsAsEvidenceDS, getLastSavedPriorIndex, getMarginals, getName, getNextExtendedStateId, getNodeType, getNotes, getNPT, getNPTPopulationMethodAsString, getNPTSize, getNumberOfStateCombsForModelNodes, getPartitionedExpressionModelNodes, getPartitionedExpressions, getReportable, getRowMajorNPT, getSamplesForState, getSavedPriors, getScaledTargetValue, getSuitableMessagePassingNodes, getSupportedFunctionTypes, getTargetValue, getTargetValueAsString, getTargetValueRange, getTargetValueRangeAsString, getTotalNumberOfExtendedFunctions, getVersion, getVisible, hasParents, isChangeStatesOnInputNodeIfRequired, isConnectableInputNode, isConnectableOutputNode, isInputNodeReceivedMarginals, isInputNodeRecivedMarginalsAsEvidence, isNptReCalcRequired, isNptSynchronisedWithFormula, isTargetValuePresent, isTemporaryNodeOrderFlag, mode, nodeChanged, processExtraFields, read, recalculateConnStateIndices, removeAllFurtherSavedPriors, removeExpressionVariable, removeExtendedNodeListener, removeExtendedState, replaceState, replicateNodeStates, revert2savedPrior, savePrior, setActOnMarginalsChangedEvent, setAnswerable, setChangeStatesOnInputNodeIfRequired, setConnBn, setConnectableInputNode, setConnectableOutputNode, setConnNodeId, setCurrentNodeFunction, setCurrentParentModelNodeAltId, setCurrentPartitionedModelNodeFunctions, setCurrentPartitionedParentModelNodeAltIds, setCurrentPartitionedParentModelNodes, setDefaultNodeFunction, setDefaultParentModelNodeAltId, setDefaultPartitionedModelNodeFunctions, setDefaultPartitionedParentModelNodeAltIds, setDefaultPartitionedParentModelNodes, setExpression, setExpressionVariables, setExtendedStates, setExtendedStates, setFunctionMode, setId, setInputNodeReceivedMarginals, setInputNodeRecivedMarginalsAsEvidence, setInputNodeRecivedMarginalsAsEvidenceDS, setName, setNotes, setNPT, setNPT, setNPT, setNPTForSingleModelParentNode, setNptReCalcRequired, setNptSynchronisedWithFormula, setPartitionedExpressionModelNodes, setPartitionedExpressions, setReportable, setSavedPriors, setTargetValue, setTargetValueFromString, setTargetValuePresent, setTemporaryNodeOrderFlag, setupActionForMarginalsChangedEvent, setVersion, setVisible, storeFunctionsCorrectly, toString, updateConnNodeId, updateExpressionVariable, updateFunctionsParentConnNodeId, updateFunctionType, usedInCurrentExpression, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumericalEN

public NumericalEN()
Default constructor.


NumericalEN

public NumericalEN(NameDescription name,
                   uk.co.agena.minerva.model.corebn.CoreBN connBn)
            throws ExtendedBNException
Constructs a NumericalEN with the specified name and connected BN.

Parameters:
name - the name of the NumericalEN
connBn - a reference to the underlying BN
Throws:
ExtendedBNException - if there is a problem creating the NumericalEN

NumericalEN

public NumericalEN(NameDescription name,
                   java.lang.String connNodeId,
                   uk.co.agena.minerva.model.corebn.CoreBN connBn)
            throws ExtendedBNException
Constructs a NumericalEN with the specified name, connected node ID and connected BN.

Parameters:
name - the name of the NumericalEN
connNodeId - the ID of the connected node in the underlying BN. Note that this ID is a String since different BN implementations use different types of ID and String is the most general way of storing such different IDs.
connBn - a reference to the underlying BN
Throws:
ExtendedBNException - if there is a problem creating the NumericalEN
Method Detail

mean

public double mean()
            throws ExtendedBNException
Calculates the mean of the marginals for this ExtendedNode.

Returns:
the mean value
Throws:
ExtendedBNException - if there is a problem calculating the mean

standardDeviation

public double standardDeviation()
                         throws ExtendedBNException
Calculates the standard deviation of the marginals for this ExtendedNode.

Returns:
the standard deviation value
Throws:
ExtendedBNException - if there is a problem calculating the standard deviation

variance

public double variance()
                throws ExtendedBNException
Calculates the variance of the marginals for this ExtendedNode.

Returns:
the variance value
Throws:
ExtendedBNException - if there is a problem calculating the variance

median

public double median()
              throws ExtendedBNException
Calculates the median of the marginals for this ExtendedNode.

Returns:
the median value
Throws:
ExtendedBNException - if there is a problem calculating the median

percentile

public double percentile(double perc)
                  throws ExtendedBNException
Calculates the specified percentile of the marginals for this ExtendedNode.

Parameters:
perc - the required percentile
Returns:
the percentile value
Throws:
ExtendedBNException - if there is a problem calculating the percentile

createDataSetFromNumericValue

public abstract DataSet createDataSetFromNumericValue(double value,
                                                      NameDescription name)
                                               throws ExtendedBNException
Takes the supplied value and creates a DataSet of hard evidence i.e. containing one DataPoint corresponding to an observed value.

Parameters:
value - the value entered as an observation
Returns:
the newly-created DataSet
Throws:
ExtendedBNException - if there are problems creating the DataSet

fillArraysUsingAbsolutes

protected void fillArraysUsingAbsolutes(double[] xVals,
                                        double[] pXs)
                                 throws ExtendedBNException
Fills the two specified arrays with numerical values and their associated probabilities using the node marginals. For example, the xVals array might end up containing [1, 2, 3] and the pXs array might end up containing [0.5, 0.3, 0.2].

Parameters:
xVals - the array to be filled with numerical values
pXs - the array to be filled with probabilities
Throws:
ExtendedBNException - if there is a problem accessing the marginals or looking up an ExtendedState

fillArraysUsingIntervals

protected void fillArraysUsingIntervals(Range[] xIntervals,
                                        double[] pXs)
                                 throws ExtendedBNException
Fills the two specified arrays with Ranges and their associated probabilities using the node marginals. For example, the xVals array might end up containing [0 - 1, 1 - 2, 2 - 3] and the pXs array might end up containing [0.5, 0.3, 0.2].

Parameters:
xIntervals - the array to be filled with Ranges
pXs - the array to be filled with probabilities
Throws:
ExtendedBNException - if there is a problem filling the arrays

getDisceteValues

public double[] getDisceteValues()
Returns a double[] of all the discrete values in this node. Overriden in the ContinousEN class.

Returns:


Copyright © 2006 Agena Ltd. All Rights Reserved.