|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.co.agena.minerva.model.extendedbn.ExtendedNode
uk.co.agena.minerva.model.extendedbn.NumericalEN
uk.co.agena.minerva.model.extendedbn.ContinuousEN
public abstract class ContinuousEN
Field Summary | |
---|---|
protected boolean |
continueToDynamicallyDiscretise
This flag is set/unset during the DD propagation. |
protected double[] |
ddRelativeSumWidthEntropyErrors
This is the relative sum entropy errors for this node. |
protected boolean |
dynamicallyDiscretisable
This indicates whether the node is dynamically discretisable. |
protected double |
entropyConvergenceThreshold
|
protected static java.lang.String[] |
supportedFunctionTypes
|
protected boolean |
uniformJustSet
This flag monitors whether a uniform distribution has just been automatically set on a node after it's type was changed and/or DD was enabled. |
Fields inherited from interface uk.co.agena.minerva.util.model.Writable |
---|
FIELD_SEPARATOR |
Constructor Summary | |
---|---|
ContinuousEN()
Default constructor. |
|
ContinuousEN(NameDescription name,
uk.co.agena.minerva.model.corebn.CoreBN connBn)
Creates a new ContinuousEN with the supplied name and connected Core BN. |
|
ContinuousEN(NameDescription name,
java.lang.String connNodeId,
uk.co.agena.minerva.model.corebn.CoreBN connBn)
Constructs a ContinuousEN with the specified name, connected node ID and connected BN. |
Method Summary | |
---|---|
void |
addDDRelativeSumWidthEntropyError(double newWidthEntropyErrorValue)
Add the argument entropy error value to the end of the list and moves the rest along by one, removing the oldest. |
void |
addRangeNotToBeSplit(Range doNotSplit)
|
boolean[] |
areNeighboringStatesDisceteValues(int stateIndex)
For any given stateIndex, this method checks if the adjacent/neighbouring states are discreteValue states. |
void |
cloneTypeSpecific(ExtendedNode oldEXN)
Data specific to the ContinuousEN node type is cloned from the specified old node into this one. |
protected java.lang.String |
constructExtraFieldString()
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be written out. |
ExtendedNode |
copy(java.lang.Class type)
Creates a shallow copy of this ExtendedNode by copying references to all of its data into a new instance of the supplied node type. |
protected DataPoint |
createDataPointFromExtendedState(ExtendedState es,
double value)
Creates a DataPoint from the supplied ExtendedState and probability value. |
DataSet |
createDataSetForExtendedStates()
Create a DatsSet from the Extended States of this node. |
DataSet |
createDataSetFromNumericValue(double value,
NameDescription name)
Takes the supplied value and creates a DataSet (the first) of likelihood evidence based upon where the value falls with respect to the ExtendedNode's ExtendedStates. |
protected DataSet |
createEmptyDataSet()
Creates a DataSet containing Ranges that correspond to the ExtendedStates in this ContinuousIntervalEN. |
void |
createLogStates(boolean updateCoreNPTSizes)
Creates all the log states for this node. |
void |
createLogStates(double from,
double to,
boolean updateCoreNPTSizes)
Creates the log states for this node between the argument doubles. |
ExtendedState |
createNewExtendedState(int index)
Creates a new ExtendedState, all the way to the core. |
ExtendedState |
createNewExtendedState(int index,
boolean updateCoreNPTSizes)
|
void |
extendedStateRangesForValue(double valueToInclude,
int percentageBufferSize,
boolean insertLogStates,
boolean updateCoreNPTSizes)
This method should extended the state ranges of this node to allow the value supplied in the argument to be included. |
protected int |
getClosestMedianStateIndex(int indexOfES,
DataSet marginals)
|
double[] |
getDdRelativeSumWidthEntropyErrors()
|
double[] |
getDisceteValues()
Returns a double[] of all the discrete values in this node - that is the states which have an range of 0. |
double[] |
getDisceteValuesStateIndexes()
Returns a int[] of all the discrete values state indexes in this node - that is the states which have an range of 0. |
double |
getEntropyConvergenceThreshold()
|
double |
getFirstBound()
|
protected int |
getIndexOfStateThatContains(double value,
boolean upperBoundIsExclusive)
Returns the index of the state that contains the specified value. |
double |
getLastBound()
|
java.util.List |
getRangesNotToBeSplit()
|
java.lang.Object |
getSamplesForState(int index,
boolean boundsOnly)
Returns a set of values that are sampled from the state at the supplied index. |
protected java.lang.Object |
getSamplesForState(int index,
boolean boundsOnly,
int numberOfSamples)
Returns a set of samples from the range of the state in question. |
static int |
getSampleSize()
|
double |
getScaledTargetValue()
Returns the scaled target value. |
java.lang.String[] |
getSupportedFunctionTypes()
Returns a list of the function classes supported by this node type. |
java.lang.String |
getTargetValueAsString()
Returns the target value of this ContinuousIntervalEN as a String. |
Range |
getTargetValueRange(boolean scaledInfinities)
Returns the Range in which the target value has to lie. |
ExtendedState |
insertExtendedState(int index,
Range r)
Inserts a state with the supplied range at the specified index. |
ExtendedState |
insertExtendedState(int index,
Range r,
boolean resizeCoreNPTs)
Inserts a state with the supplied range at the specified index. |
void |
insertStatesForValues(double[] valuesToInsert,
boolean discreteValueStates,
boolean updateCoreNPTSizes,
boolean allowExtensionToRange)
This method will insert these double values into this node. |
boolean |
isContinueToDynamicallyDiscretise()
|
boolean |
isDynamicallyDiscretisable()
|
boolean |
isSimulationNode()
|
boolean |
isStateSplitable(int stateindex)
This method checks if the state at the given stateindex is splitable. |
boolean |
isUniformJustSet()
|
ExtendedState |
mergeExtendedStates(int startIndex,
int endIndex)
|
ExtendedState |
mergeExtendedStates(int startIndex,
int endIndex,
boolean resizeCoreNPTs)
|
protected java.util.List |
performSplit(Range rangeToSplit,
int numDivisions)
|
protected void |
processExtraFields(java.util.StringTokenizer extraFields,
double localVersion)
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be read in. |
java.util.List |
replaceState(int index,
int numDivisions)
Takes the state at the specified index and replaces it with the required number of new states. |
java.util.List |
replaceState(int index,
int numDivisions,
boolean updateCoreNPTSizes)
Takes the state at the specified index and replaces it with the required number of new states. |
void |
resetRangesNotToBeSplitList()
Clears the list of ranges that should not be split. |
void |
setContinueToDynamicallyDiscretise(boolean continueToDynamicallyDiscretise)
|
void |
setDdRelativeSumWidthEntropyErrors(double[] ddRelativeSumWidthEntropyError)
|
void |
setDynamicallyDiscretisable(boolean dynamicallyDiscretisable)
|
void |
setEntropyConvergenceThreshold(double entropyConvergenceThreshold)
|
void |
setNameOfIntervalDataPoint(IntervalDataPoint idp)
|
void |
setNameOfStateUsingRange(ExtendedState es,
Range r)
|
static void |
setSampleSize(int sampleSize)
|
void |
setSimulationNode(boolean simulationNode)
Sets (or unsets) this node as a simulation node. |
void |
setTargetValueFromString(java.lang.String text)
Sets the target value of this ContinuousIntervalEN using the supplied String. |
void |
setUniform()
Sets the ExtendedNodeFunction to be a simple Uniform. |
void |
setUniformJustSet(boolean uniformJustSet)
|
void |
truncateStates(double lowerCutoff,
double upperCutoff)
Manipulates the ExtendedStates so that the new first one has the specified lower bound and the last one has the specified upper bound. |
Methods inherited from class uk.co.agena.minerva.model.extendedbn.NumericalEN |
---|
fillArraysUsingAbsolutes, fillArraysUsingIntervals, mean, median, percentile, standardDeviation, variance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static java.lang.String[] supportedFunctionTypes
protected boolean dynamicallyDiscretisable
protected double[] ddRelativeSumWidthEntropyErrors
protected double entropyConvergenceThreshold
protected boolean continueToDynamicallyDiscretise
protected boolean uniformJustSet
Constructor Detail |
---|
public ContinuousEN()
public ContinuousEN(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn) throws ExtendedBNException
name
- the name of the nodeconnBn
- the Core BN to which it is connect
ExtendedBNException
public ContinuousEN(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn) throws ExtendedBNException
name
- the name of the NumericalENconnNodeId
- the ID of the connected node in the underlying BN.connBn
- a reference to the underlying CoreBN
ExtendedBNException
- if there is a problem creating the nodeMethod Detail |
---|
public static int getSampleSize()
public static void setSampleSize(int sampleSize)
sampleSize
- The sampleSize to set.public boolean isSimulationNode()
public void setSimulationNode(boolean simulationNode)
simulationNode
- true if the node is being made a simulation node, false if notpublic boolean isDynamicallyDiscretisable()
public void setDynamicallyDiscretisable(boolean dynamicallyDiscretisable)
dynamicallyDiscretisable
- The dynamicallyDiscretisable to set.protected java.lang.String constructExtraFieldString()
ExtendedNode
constructExtraFieldString
in class ExtendedNode
protected void processExtraFields(java.util.StringTokenizer extraFields, double localVersion)
ExtendedNode
processExtraFields
in class ExtendedNode
public double[] getDdRelativeSumWidthEntropyErrors()
public void setDdRelativeSumWidthEntropyErrors(double[] ddRelativeSumWidthEntropyError) throws ExtendedBNException
ddSumEntropyError
- The ddSumEntropyError to set.
ExtendedBNException
public void addDDRelativeSumWidthEntropyError(double newWidthEntropyErrorValue)
newEntropyErrorValue
- public boolean isContinueToDynamicallyDiscretise()
public void setContinueToDynamicallyDiscretise(boolean continueToDynamicallyDiscretise)
continueToDynamicallyDiscretise
- The continueToDynamicallyDiscretise to set.public void addRangeNotToBeSplit(Range doNotSplit)
doNotSplit
- public java.util.List getRangesNotToBeSplit()
public void resetRangesNotToBeSplitList()
public DataSet createDataSetFromNumericValue(double value, NameDescription name) throws ExtendedBNException
createDataSetFromNumericValue
in class NumericalEN
value
- the value entered as an observationname
- the name of the DataSet derived from the Scenario name
ExtendedBNException
- if there is a problem creating the DataSetpublic java.lang.String getTargetValueAsString()
getTargetValueAsString
in class ExtendedNode
public void setTargetValueFromString(java.lang.String text)
setTargetValueFromString
in class ExtendedNode
text
- the target value of this ContinuousIntervalEN as a Stringpublic Range getTargetValueRange(boolean scaledInfinities) throws ExtendedBNException
getTargetValueRange
in class ExtendedNode
ExtendedBNException
- if there is a problem creating the Rangepublic double getScaledTargetValue() throws ExtendedBNException
getScaledTargetValue
in class ExtendedNode
ExtendedBNException
- if there is a problem when trying to smoothe the state rangesprotected int getClosestMedianStateIndex(int indexOfES, DataSet marginals) throws MinervaRangeException
indexOfES
- marginals
-
MinervaRangeException
protected DataPoint createDataPointFromExtendedState(ExtendedState es, double value) throws ExtendedBNException
createDataPointFromExtendedState
in class ExtendedNode
es
- the ExtendedState whose information is used to create the DataPoint.value
- the probability value that will appear in the DataPoint
ExtendedBNException
- if there is a problem creating the DataPointprotected DataSet createEmptyDataSet() throws ExtendedBNException
ExtendedBNException
- if there is a problem creating the DataSetpublic void cloneTypeSpecific(ExtendedNode oldEXN) throws ExtendedBNException
cloneTypeSpecific
in class ExtendedNode
oldEXN
- The ExtendedNode the specific type data must be cloned from.
ExtendedBNException
public ExtendedNode copy(java.lang.Class type) throws ExtendedBNException
copy
in class ExtendedNode
type
- the type of node that will be created
ExtendedBNException
ExtendedNodeCreationException
- if there is a problem during creationpublic void setUniform()
public boolean isUniformJustSet()
public void setUniformJustSet(boolean uniformJustSet)
public ExtendedState mergeExtendedStates(int startIndex, int endIndex) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException, MinervaRangeException
ExtendedNodeMethodNotSupportedException
ExtendedBNException
MinervaRangeException
public ExtendedState mergeExtendedStates(int startIndex, int endIndex, boolean resizeCoreNPTs) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException, MinervaRangeException
ExtendedNodeMethodNotSupportedException
ExtendedBNException
MinervaRangeException
public ExtendedState insertExtendedState(int index, Range r) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException
index
- where to add the stater
- the range that the state will have
ExtendedNodeMethodNotSupportedException
ExtendedBNException
public ExtendedState insertExtendedState(int index, Range r, boolean resizeCoreNPTs) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException
index
- where to add the stater
- the range that the state will haveresizeCoreNPTs
- if false the the cores NPTs will not resize, this can be postponed until later.
ExtendedNodeMethodNotSupportedException
ExtendedBNException
public ExtendedState createNewExtendedState(int index) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException
ExtendedNode
createNewExtendedState
in class ExtendedNode
ExtendedBNException
ExtendedNodeMethodNotSupportedException
public ExtendedState createNewExtendedState(int index, boolean updateCoreNPTSizes) throws ExtendedNodeMethodNotSupportedException, ExtendedBNException
ExtendedNodeMethodNotSupportedException
ExtendedBNException
public DataSet createDataSetForExtendedStates() throws ExtendedStateException
createDataSetForExtendedStates
in class ExtendedNode
ExtendedStateException
public java.util.List replaceState(int index, int numDivisions) throws ExtendedStateException
replaceState
in class ExtendedNode
index
- the index of the state to splitnumDivisions
- the number of divisions it should be split into
ExtendedStateException
public java.util.List replaceState(int index, int numDivisions, boolean updateCoreNPTSizes) throws ExtendedStateException
index
- the index of the state to splitnumDivisions
- the number of divisions it should be split into
ExtendedStateException
public void setNameOfStateUsingRange(ExtendedState es, Range r)
protected java.util.List performSplit(Range rangeToSplit, int numDivisions) throws MinervaRangeException
MinervaRangeException
public java.lang.String[] getSupportedFunctionTypes()
getSupportedFunctionTypes
in class ExtendedNode
public void insertStatesForValues(double[] valuesToInsert, boolean discreteValueStates, boolean updateCoreNPTSizes, boolean allowExtensionToRange) throws MinervaRangeException, ExtendedNodeMethodNotSupportedException, ExtendedBNException
valuesToInsert
-
MinervaRangeException
ExtendedBNException
ExtendedNodeMethodNotSupportedException
public double getEntropyConvergenceThreshold()
public void setEntropyConvergenceThreshold(double entropyConvergenceThreshold)
entropyConvergenceThreshold
- The entropyConvergenceThreshold to set.public void truncateStates(double lowerCutoff, double upperCutoff) throws ExtendedStateException
lowerCutoff
- the new lower bound of the first stateupperCutoff
- the new upper bound of the last state
ExtendedStateException
protected int getIndexOfStateThatContains(double value, boolean upperBoundIsExclusive)
value
- the value being sought
public double getFirstBound()
public double getLastBound()
public void setNameOfIntervalDataPoint(IntervalDataPoint idp)
public void extendedStateRangesForValue(double valueToInclude, int percentageBufferSize, boolean insertLogStates, boolean updateCoreNPTSizes) throws ExtendedStateException, MinervaRangeException
valueToInclude
-
ExtendedStateException
MinervaRangeException
public boolean isStateSplitable(int stateindex)
i
-
public java.lang.Object getSamplesForState(int index, boolean boundsOnly) throws ExtendedStateException
ExtendedNode
getSamplesForState
in class ExtendedNode
index
- the index of the state that is to be sampledboundsOnly
- TODO
ExtendedStateException
protected java.lang.Object getSamplesForState(int index, boolean boundsOnly, int numberOfSamples) throws ExtendedStateException
index
- the index of the state to samplenumberOfSamples
- the number of samples to take
ExtendedStateNotFoundException
- if there is no state at the supplied index
ExtendedStateException
public double[] getDisceteValues()
getDisceteValues
in class NumericalEN
public double[] getDisceteValuesStateIndexes()
public boolean[] areNeighboringStatesDisceteValues(int stateIndex)
stateIndex
-
public void createLogStates(boolean updateCoreNPTSizes) throws ExtendedBNException, ExtendedStateException, MinervaRangeException
node
-
ExtendedBNException
ExtendedStateException
MinervaRangeException
public void createLogStates(double from, double to, boolean updateCoreNPTSizes) throws ExtendedBNException, ExtendedStateException, MinervaRangeException
node
- from
- to
-
ExtendedBNException
ExtendedStateException
MinervaRangeException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |