|
CFEngine API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.recommender.algorithms.Experimental.ContinuousBayesNet
In-memory representation of a Bayesian network with decision trees at each node. Includes functionality to load a Bayesian network from a file, and for this reason implements the Application interface from the XP XML parser. It also depends on the xp.jar library. Methods that lack comments are the implementation of the Application interface. These are effectively callbacks, made public so that they're accessible to the XP parser.
Field Summary | |
(package private) java.lang.StringBuffer |
cdataCdata
|
(package private) java.util.List[] |
children
|
(package private) java.lang.Integer |
currVariable
|
(package private) ContinuousDecisionTree[] |
decisionTrees
|
(package private) ContinuousDecisionTree |
dtree
|
(package private) java.lang.StringBuffer |
elementCdata
|
(package private) boolean |
inCdata
|
(package private) boolean |
inDecisionTree
|
(package private) java.io.PrintStream |
out
|
(package private) DocumentParser |
parser
|
Constructor Summary | |
ContinuousBayesNet(int maxVar,
java.lang.String filename)
Construct a new Bayesian network. |
Method Summary | |
void |
characterData(CharacterDataEvent characterData)
|
void |
comment(CommentEvent e)
|
void |
endCdataSection(EndCdataSectionEvent e)
|
void |
endDocument()
|
void |
endDocumentTypeDeclaration(EndDocumentTypeDeclarationEvent e)
|
void |
endElement(EndElementEvent endElement)
|
void |
endEntityReference(EndEntityReferenceEvent e)
|
void |
endProlog(EndPrologEvent e)
|
java.util.Iterator |
getChildren(int var)
Get an iterator of all children of the specified variable. |
float |
getProb(int var,
float state,
float[] allStates)
Get the probability that a specified variable is in a specified state given the state of every other variable. |
void |
load(java.io.InputStream in)
Begin parsing an xmod file from the specified InputStream. |
void |
markupDeclaration(MarkupDeclarationEvent e)
|
void |
processingInstruction(ProcessingInstructionEvent e)
|
void |
startCdataSection(StartCdataSectionEvent e)
|
void |
startDocument()
|
void |
startDocumentTypeDeclaration(StartDocumentTypeDeclarationEvent e)
|
void |
startElement(StartElementEvent startElement)
|
void |
startEntityReference(StartEntityReferenceEvent e)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
DocumentParser parser
java.io.PrintStream out
boolean inDecisionTree
boolean inCdata
java.lang.StringBuffer elementCdata
java.lang.StringBuffer cdataCdata
ContinuousDecisionTree[] decisionTrees
ContinuousDecisionTree dtree
java.lang.Integer currVariable
java.util.List[] children
Constructor Detail |
public ContinuousBayesNet(int maxVar, java.lang.String filename)
maxVar
- highest variable index used by the network. This
could be inferred from the file, but it's easier if it's known
ahead of time.filename
- path and filename of the Bayesian network model.
The expected file format is .xmod, as output by the WinMine
toolkit, with decision trees at each node.Method Detail |
public java.util.Iterator getChildren(int var)
var
- index of the variable whose children we want.public float getProb(int var, float state, float[] allStates)
var
- index of the variable in questionstate
- variable state of which to calculate the probabilityallStates
- array containing the state of each variable
in this network. Simply returns the approviate value from
the variable's probability distribution in its decision tree.
This method does not do inference, not even Markov-blanket
inference. The caller is expected to implement that.public void load(java.io.InputStream in)
public void startDocument()
public void endProlog(EndPrologEvent e)
public void startElement(StartElementEvent startElement)
public void characterData(CharacterDataEvent characterData)
public void endElement(EndElementEvent endElement)
public void endDocument()
public void startCdataSection(StartCdataSectionEvent e)
public void endCdataSection(EndCdataSectionEvent e)
public void processingInstruction(ProcessingInstructionEvent e)
public void comment(CommentEvent e)
public void startEntityReference(StartEntityReferenceEvent e)
public void endEntityReference(EndEntityReferenceEvent e)
public void startDocumentTypeDeclaration(StartDocumentTypeDeclarationEvent e)
public void endDocumentTypeDeclaration(EndDocumentTypeDeclarationEvent e)
public void markupDeclaration(MarkupDeclarationEvent e)
|
CFEngine API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |