|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--COM.hugin.HAPI.NetworkModel
|
+--COM.hugin.HAPI.Domain
Instances of the Domain class represent Bayesian networks and influence diagrams in which you can propagate evidence and calculate updated beliefs and expected utilities.
| Inner Class Summary | |
static class |
Domain.Equilibrium
The Equilibrium class represents the equilibrium state of this Domain. |
static class |
Domain.EvidenceMode
The EvidenceMode class represents the mode used for propagating evidence in this Domain. |
static class |
Domain.TriangulationMethod
The TriangulationMethod class represents the triangulation method used for this Domain. |
| Inner classes inherited from class COM.hugin.HAPI.NetworkModel |
NetworkModel.Category,
NetworkModel.Constraint,
NetworkModel.Endian,
NetworkModel.Kind |
| Field Summary | |
static Domain.Equilibrium |
H_EQUILIBRIUM_MAX
Represents max equilibrium. |
static Domain.Equilibrium |
H_EQUILIBRIUM_SUM
Represents sum equilibrium. |
static Domain.EvidenceMode |
H_EVIDENCE_MODE_FAST_RETRACTION
Represents the fast retraction evidence mode used for propagating evidence in this Domain. |
static Domain.EvidenceMode |
H_EVIDENCE_MODE_NORMAL
Represents the normal evidence mode used for propagating evidence in this Domain. |
static Domain.TriangulationMethod |
H_TM_CLIQUE_SIZE
Represents the clique-size triangulation heuristic. |
static Domain.TriangulationMethod |
H_TM_CLIQUE_WEIGHT
Represents the clique-weight triangulation heuristic. |
static Domain.TriangulationMethod |
H_TM_FILL_IN_SIZE
Represents the fill-in triangulation heuristic. |
static Domain.TriangulationMethod |
H_TM_FILL_IN_WEIGHT
Represents the fill-in-weight triangulation heuristic. |
static Domain.TriangulationMethod |
H_TM_TOTAL_WEIGHT
Represents the total clique-table size triangulation algorithm. |
| Constructor Summary | |
Domain()
Constructs a new, empty Domain. |
|
Domain(java.lang.String hkbFileName)
Constructs a domain by loading the corresponding Hugin Knowledge Base (HKB) from a file. |
|
Domain(java.lang.String netFileName,
NetParseListener parseListener)
Constructs a domain from a NET file. |
|
Domain(java.lang.String netFileName,
ParseListener parseListener)
Deprecated. Replaced by Domain(String, NetParseListener). |
|
| Method Summary | |
void |
adapt()
Adapts this Domain according to the evidence entered. |
double |
approximate(double e)
Removes "near-zero" probabilities from the clique probability tables. |
boolean |
cgEvidenceIsPropagated()
Returns 'true' if the evidence on CG nodes has been propagated; otherwise, returns 'false'. |
void |
compile()
Compiles this Domain. |
void |
compile(Domain.TriangulationMethod method)
Compiles this Domain using a particular triangulation method {@see TriangulationMethod TriangulationMethod}. |
void |
compile(NodeList eliminationOrder)
Compiles this Domain using an elimination order. |
double |
compress()
Removes the zero entries from the clique and separator tables of the JunctionTrees in this Domain. |
void |
delete()
Deletes this Domain, including all Node and JunctionTrees belonging to it. |
boolean |
equilibriumIs(Domain.Equilibrium equilibrium)
Tests for Equilibrium type. |
boolean |
evidenceIsPropagated()
Tests if evidence has been propagated for this Domain. |
boolean |
evidenceModeIs(Domain.EvidenceMode evidenceMode)
Tests for evidence mode. |
boolean |
evidenceToPropagate()
Tests if evidence has been entered since the last propagation. |
double |
getApproximationConstant()
Returns the approximation constant. |
double |
getCaseCount(int c)
Returns case count for a case. |
int |
getConcurrencyLevel()
Gets the current level of concurrency. |
double |
getConflict()
Returns the conflict value. |
NodeList |
getEliminationOrder()
Returns the triangulation order. |
int |
getGrainSize()
Returns the current value of the grain size parameter. |
JunctionTreeList |
getJunctionTrees()
Returns the JunctionTrees of this Domain. |
double |
getLogLikelihood()
Returns log-likelihood of this Domain. |
double |
getLogLikelihoodTolerance()
Returns the log-likelihood tolerance for this Domain. |
double |
getLogNormalizationConstant()
Returns the log of the normalization constant. |
Table |
getMarginal(NodeList nodes)
Computes the marginal distribution for the Nodes provided as argument (which must all be chance nodes) with respect to the (imaginary) joint potential, determined by the current potentials on the JunctionTree(s) of this Domain. |
int |
getMaxNumberOfEMIterations()
Returns the maximum number of iterations allowed for the EM algorithm. |
int |
getMaxNumberOfSeparators()
Returns the maximum number of separators allowed when using the H_TM_TOTAL_WEIGHT TriangulationMethod. |
double |
getNormalizationConstant()
Retrieves the normalization constant for the most recent propagation. |
int |
getNumberOfCases()
Returns the number of data cases. |
double |
getSignificanceLevel()
Returns the significance level of the dependency tests performed during structural learning using the PC-algorithm. |
void |
initialize()
Establishes the initial values for all tables of this Domain (which must be compiled). |
boolean |
isCompiled()
Tests whether this Domain is compiled. |
boolean |
isCompressed()
Tests whether this Domain is compressed.Returns 'true' if it is; otherwise, returns 'false'. |
void |
learnStructure()
Learn the structure (graph) of the Bayesian network from data using the PC-algorithm. |
void |
learnTables()
Learns the conditional probability tables from data using the EM algorithm. |
boolean |
likelihoodIsPropagated()
Tests if likelihood evidence has been propagated for this Domain. |
int |
newCase()
Creates a new case. |
void |
parseCase(java.lang.String fileName,
ParseListener parseListener)
Parses the case stored in file fileName and enters
the associated findings into this Domain. |
void |
propagate(Domain.Equilibrium equilibrium,
Domain.EvidenceMode evidenceMode)
Establishes the specified equilibrium using the evidence mode indicated for incorporation of evidence on all JunctionTrees of this Domain. |
void |
resetInferenceEngine()
Establishes the initial state of the inference engine, which is sum-equilibrium with no evidence incorporated. |
void |
retractFindings()
Retracts (all) evidence for all nodes in this Domain. |
void |
save(java.lang.String fileName,
NetworkModel.Endian format)
Saves this Domain as a Hugin Knowledge Base (HKB) to a file. |
void |
saveCase(java.lang.String fileName)
Saves all evidence entered in this Domain in file fileName (if the file exists, it is overwritten). |
void |
saveToMemory()
Creates a copy in memory of the belief and JunctionTree tables of this Domain (which must be compiled). |
void |
seedRandom(int seed)
Seeds the pseudo-random number generator for this Domain. |
void |
seedRandom(long seed)
Deprecated. Replaced by seedRandom(int seed). |
void |
setCaseCount(int c,
double count)
Sets case count for a case. |
void |
setConcurrencyLevel(int level)
Sets the level of concurrency. |
void |
setGrainSize(int size)
Sets the grains size parameter. |
void |
setLogLikelihoodTolerance(double tolerance)
Sets the log-likelihood tolerance for this Domain. |
void |
setMaxNumberOfEMIterations(int m)
Sets the maximum number of iterations allowed for the EM algorithm. |
void |
setMaxNumberOfSeparators(int m)
Sets the maximum number of separators allowed when using the H_TM_TOTAL_WEIGHT TriangulationMethod. |
void |
setNumberOfCases(int size)
Sets the number of cases. |
void |
setSignificanceLevel(double alpha)
Sets the significance level of the dependency tests performed during structural learning using the PC-algorithm. |
void |
simulate()
Generates a sample configuration from the joint distribution represented by the JunctionTree(s) of this Domain. |
boolean |
tablesToPropagate()
Tests for new node tables. |
void |
triangulate(Domain.TriangulationMethod method)
Transforms the graph of this Domain into a triangulated graph. |
void |
triangulateWithOrder(NodeList order)
Transforms a network into a triangulated graph using a specified elimination order. |
void |
unCompile()
Uncompiles this Domain. |
void |
writeNet(java.lang.String fileName)
Deprecated. Replaced by saveAsNet(). |
| Methods inherited from class COM.hugin.HAPI.NetworkModel |
closeLogFile,
generateTables,
getAttribute,
getAttributes,
getFileName,
getLogFile,
getNodeByName,
getNodes,
getNodeSize,
getUserData,
INFINITY,
openLogFile,
openLogFile,
saveAsNet,
setAttribute,
setNodeSize,
setUserData |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final Domain.Equilibrium H_EQUILIBRIUM_SUM
propagate(Equilibrium, EvidenceMode).public static final Domain.Equilibrium H_EQUILIBRIUM_MAX
propagate(Equilibrium, EvidenceMode).public static final Domain.EvidenceMode H_EVIDENCE_MODE_NORMAL
public static final Domain.EvidenceMode H_EVIDENCE_MODE_FAST_RETRACTION
public static final Domain.TriangulationMethod H_TM_CLIQUE_SIZE
public static final Domain.TriangulationMethod H_TM_CLIQUE_WEIGHT
public static final Domain.TriangulationMethod H_TM_FILL_IN_SIZE
public static final Domain.TriangulationMethod H_TM_FILL_IN_WEIGHT
public static final Domain.TriangulationMethod H_TM_TOTAL_WEIGHT
setMaxNumberOfSeparators(int).| Constructor Detail |
public Domain()
throws ExceptionHugin
public Domain(java.lang.String hkbFileName)
throws ExceptionHugin
hkbFileName - the name of the HKB file (a String).
public Domain(java.lang.String netFileName,
NetParseListener parseListener)
throws ExceptionHugin
netFileName - a string containing the name of the NET file.parseListener - the NetParseListener used for handling
parse errors.
public Domain(java.lang.String netFileName,
ParseListener parseListener)
throws ExceptionHugin
Domain(String, NetParseListener).
| Method Detail |
public void delete()
throws ExceptionObjectNotAlive,
ExceptionHugin
public double approximate(double e)
throws ExceptionObjectNotAlive
epsilon - the threshold value. Maximal probability
mass to eradicate from each clique.
public boolean cgEvidenceIsPropagated()
throws ExceptionObjectNotAlive
public void compile()
throws ExceptionObjectNotAlive,
ExceptionHugin
triangulate or triangulateWithOrder. If the
domain already is triangulated, nothing is changed. The Domain
must contain at least one chance or decision node.
public void compile(NodeList eliminationOrder)
throws ExceptionObjectNotAlive,
ExceptionHugin
eliminationOrder - an ordered NodeList used as basis for
constructing the triangulated graph (and in turn the
JunctionTree).
public void compile(Domain.TriangulationMethod method)
throws ExceptionObjectNotAlive,
ExceptionHugin
method - the triangulation method used.
public double compress()
throws ExceptionObjectNotAlive
public boolean equilibriumIs(Domain.Equilibrium equilibrium)
throws ExceptionObjectNotAlive
equilibrium - the type of Equilibrium to test for.
public boolean evidenceIsPropagated()
throws ExceptionObjectNotAlive
public boolean evidenceModeIs(Domain.EvidenceMode evidenceMode)
throws ExceptionObjectNotAlive
evidenceMode - the type of EvidenceMode to test for.
public boolean evidenceToPropagate()
throws ExceptionObjectNotAlive
public double getApproximationConstant()
throws ExceptionObjectNotAlive
public double getConflict()
throws ExceptionHugin,
ExceptionObjectNotAlive
public NodeList getEliminationOrder()
throws ExceptionObjectNotAlive
public JunctionTreeList getJunctionTrees()
throws ExceptionObjectNotAlive
public Table getMarginal(NodeList nodes)
throws ExceptionObjectNotAlive,
ExceptionHugin
nodes - a NodeList containing the Nodes over
which to compute the marginal.
public double getNormalizationConstant()
throws ExceptionObjectNotAlive
public void initialize()
throws ExceptionHugin,
ExceptionObjectNotAlive
public boolean isCompiled()
throws ExceptionObjectNotAlive
public boolean isCompressed()
throws ExceptionObjectNotAlive
public boolean likelihoodIsPropagated()
throws ExceptionObjectNotAlive
public void propagate(Domain.Equilibrium equilibrium,
Domain.EvidenceMode evidenceMode)
throws ExceptionObjectNotAlive,
ExceptionHugin
equilibrium - Equilibrium type. The normal Equilibrium
type is Domain.H_EQUILIBRIUM_SUM.evidenceMode - EvidenceMode type. The normal EvidenceMode
type is Domain.H_EVIDENCE_MODE_NORMAL.
public void resetInferenceEngine()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void retractFindings()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void save(java.lang.String fileName,
NetworkModel.Endian format)
throws ExceptionObjectNotAlive,
ExceptionHugin
fileName - the name of the file to which the HKB is saved.format - byte-order in the saved file.
public void saveToMemory()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void writeNet(java.lang.String fileName)
throws ExceptionObjectNotAlive,
ExceptionHugin
public void simulate()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void seedRandom(int seed)
throws ExceptionObjectNotAlive,
ExceptionHugin
seed - the seed number.
public void seedRandom(long seed)
throws ExceptionObjectNotAlive,
ExceptionHugin
public boolean tablesToPropagate()
throws ExceptionObjectNotAlive
public void triangulate(Domain.TriangulationMethod method)
throws ExceptionObjectNotAlive,
ExceptionHugin
tm - the TriangulationMethod used.
public void triangulateWithOrder(NodeList order)
throws ExceptionObjectNotAlive,
ExceptionHugin
order - a NodeList containing the Nodes of the network
in the order of elimination.
public void unCompile()
throws ExceptionObjectNotAlive,
ExceptionHugin
compile(),
triangulate(TriangulationMethod), and triangulateWithOrder(NodeList). Note that any references to
objects within the compiled structure (e.g., Cliques and
JunctionTrees) are invalidated by a call to uncompile(). Also
note that many of the editing functions automatically performs
an uncompile() operation. When this happens, the domain must be
compiled (using compile()) before it can be
used for inference.
public void setConcurrencyLevel(int level)
throws ExceptionObjectNotAlive
level - the level of concurrency.
public void setGrainSize(int size)
throws ExceptionObjectNotAlive
The initial value of the grain size parameter is 10000.
size - the grain size.
public int getConcurrencyLevel()
throws ExceptionObjectNotAlive
setConcurrencyLevel
public int getGrainSize()
throws ExceptionObjectNotAlive
public double getLogNormalizationConstant()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setNumberOfCases(int size)
throws ExceptionObjectNotAlive,
ExceptionHugin
public int newCase()
throws ExceptionObjectNotAlive,
ExceptionHugin
public int getNumberOfCases()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setCaseCount(int c,
double count)
throws ExceptionObjectNotAlive,
ExceptionHugin
c - the case for which to set the count.count - the multiplicity of 'c'.
public double getCaseCount(int c)
throws ExceptionObjectNotAlive,
ExceptionHugin
c - the case for which to get the count.
public void learnTables()
throws ExceptionObjectNotAlive,
ExceptionHugin
public double getLogLikelihood()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setLogLikelihoodTolerance(double tolerance)
throws ExceptionObjectNotAlive,
ExceptionHugin
public double getLogLikelihoodTolerance()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setMaxNumberOfEMIterations(int m)
throws ExceptionObjectNotAlive,
ExceptionHugin
public int getMaxNumberOfEMIterations()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void adapt()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void learnStructure()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setSignificanceLevel(double alpha)
throws ExceptionObjectNotAlive,
ExceptionHugin
alpha - the significance level.
public double getSignificanceLevel()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void setMaxNumberOfSeparators(int m)
throws ExceptionObjectNotAlive,
ExceptionHugin
public int getMaxNumberOfSeparators()
throws ExceptionObjectNotAlive,
ExceptionHugin
public void parseCase(java.lang.String fileName,
ParseListener parseListener)
throws ExceptionObjectNotAlive,
ExceptionHugin
fileName and enters
the associated findings into this Domain. All existing
evidence in the Domain is retracted before entering the case
findings.fileName - the name of the file containing the case.parseListener - the ParseListener used for handling
parse errors.
public void saveCase(java.lang.String fileName)
throws ExceptionObjectNotAlive,
ExceptionHugin
fileName (if the file exists, it is overwritten).fileName - the name of the file in which the case is going
to be saved.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||