Java Doc for BayesNet.java in  » Science » weka » weka » classifiers » bayes » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » weka » weka.classifiers.bayes 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   weka.classifiers.Classifier
      weka.classifiers.bayes.BayesNet

All known Subclasses:   weka.classifiers.bayes.net.BIFReader,  weka.classifiers.bayes.net.BayesNetGenerator,
BayesNet
public class BayesNet extends Classifier implements OptionHandler,WeightedInstancesHandler,Drawable,AdditionalMeasureProducer(Code)
Bayes Network learning using various search algorithms and quality measures.
Base class for a Bayes Network classifier. Provides datastructures (network structure, conditional probability distributions, etc.) and facilities common to Bayes Network learning algorithms like K2 and B.

For more information see:

http://www.cs.waikato.ac.nz/~remco/weka.pdf

Valid options are:

 -D
 Do not use ADTree data structure
 
 -B <BIF file>
 BIF file to compare with
 
 -Q weka.classifiers.bayes.net.search.SearchAlgorithm
 Search algorithm
 
 -E weka.classifiers.bayes.net.estimate.SimpleEstimator
 Estimator algorithm
 

author:
   Remco Bouckaert (rrb@xm.co.nz)
version:
   $Revision: 1.30 $


Field Summary
 ADNodem_ADTree
     Datastructure containing ADTree representation of the database.
 BayesNetEstimatorm_BayesNetEstimator
     Search algorithm used for learning the structure of a network.
 Discretizem_DiscretizeFilter
    
public  Estimator[][]m_Distributions
     The attribute estimators containing CPTs.
public  Instancesm_Instances
    
 ReplaceMissingValuesm_MissingValuesFilter
    
protected  intm_NumClasses
    
protected  ParentSet[]m_ParentSets
     The parent sets.
 SearchAlgorithmm_SearchAlgorithm
     Search algorithm used for learning the structure of a network.
 booleanm_bUseADTree
    
 intm_nNonDiscreteAttribute
    
protected  BIFReaderm_otherBayesNet
     Bayes network to compare the structure with.
final static  longserialVersionUID
    


Method Summary
public  StringBIFFileTipText()
    
 StringXMLNormalize(String sStr)
     XMLNormalize converts the five standard XML entities in a string g.e.
public  voidbuildClassifier(Instances instances)
     Generates the classifier.
public  voidbuildStructure()
     buildStructure determines the network structure/graph of the network.
public  double[]countsForInstance(Instance instance)
     Calculates the counts for Dirichlet distribution for the class membership probabilities for the given test instance.
public  double[]distributionForInstance(Instance instance)
     Calculates the class membership probabilities for the given test instance.
public  EnumerationenumerateMeasures()
     Returns an enumeration of the measure names.
public  voidestimateCPTs()
     estimateCPTs estimates the conditional probability tables for the Bayes Net using the network structure.
public  StringestimatorTipText()
     This will return a string describing the BayesNetEstimator.
public  ADNodegetADTree()
     get ADTree strucrture containing efficient representation of counts.
public  StringgetBIFFile()
    
public  CapabilitiesgetCapabilities()
     Returns default capabilities of the classifier.
public  intgetCardinality(int iNode)
    
public  Estimator[][]getDistributions()
     Get full set of estimators.
public  BayesNetEstimatorgetEstimator()
    
public  doublegetMeasure(String measureName)
    
public  StringgetName()
    
public  StringgetNodeName(int iNode)
    
public  StringgetNodeValue(int iNode, int iValue)
    
public  intgetNrOfNodes()
    
public  intgetNrOfParents(int iNode)
    
public  String[]getOptions()
     Gets the current settings of the classifier.
public  intgetParent(int iNode, int iParent)
     get node index of a parent of a node in the network structure
Parameters:
  iNode - index of the node
Parameters:
  iParent - index of the parents, e.g., 0 is the first parent, 1 the second parent, etc.
public  intgetParentCardinality(int iNode)
    
public  ParentSetgetParentSet(int iNode)
    
public  ParentSet[]getParentSets()
     Get full set of parent sets.
public  doublegetProbability(int iNode, int iParent, int iValue)
     get particular probability of the conditional probability distribtion of a node given its parents.
public  SearchAlgorithmgetSearchAlgorithm()
    
public  booleangetUseADTree()
    
public  StringglobalInfo()
     This will return a string describing the classifier.
public  Stringgraph()
     Returns a BayesNet graph in XMLBIF ver 0.3 format.
public  intgraphType()
     Returns the type of graph this classifier represents.
public  voidinitCPTs()
    
public  voidinitStructure()
     Init structure initializes the structure to an empty graph or a Naive Bayes graph (depending on the -N flag).
public  EnumerationlistOptions()
    
public static  voidmain(String[] argv)
     Main method for testing this class.
public  doublemeasureAICScore()
    
public  doublemeasureBDeuScore()
    
public  doublemeasureBayesScore()
    
public  doublemeasureDivergence()
    
public  doublemeasureEntropyScore()
    
public  doublemeasureExtraArcs()
    
public  doublemeasureMDLScore()
    
public  doublemeasureMissingArcs()
    
public  doublemeasureReversedArcs()
    
 InstancesnormalizeDataSet(Instances instances)
    
 InstancenormalizeInstance(Instance instance)
    
public static  String[]partitionOptions(String[] options)
     Returns the secondary set of options (if any) contained in the supplied options array.
public  StringsearchAlgorithmTipText()
    
public  voidsetBIFFile(String sBIFFile)
    
public  voidsetEstimator(BayesNetEstimator newBayesNetEstimator)
    
public  voidsetOptions(String[] options)
     Parses a given list of options.
public  voidsetSearchAlgorithm(SearchAlgorithm newSearchAlgorithm)
     Set the SearchAlgorithm used in searching for network structures.
public  voidsetUseADTree(boolean bUseADTree)
    
public  StringtoString()
     Returns a description of the classifier.
public  StringtoXMLBIF03()
     Returns a description of the classifier in XML BIF 0.3 format.
public  voidupdateClassifier(Instance instance)
     Updates the classifier with the given instance.
public  StringuseADTreeTipText()
    

Field Detail
m_ADTree
ADNode m_ADTree(Code)
Datastructure containing ADTree representation of the database. This may result in more efficient access to the data.



m_BayesNetEstimator
BayesNetEstimator m_BayesNetEstimator(Code)
Search algorithm used for learning the structure of a network.



m_DiscretizeFilter
Discretize m_DiscretizeFilter(Code)
filter used to quantize continuous variables, if any *



m_Distributions
public Estimator[][] m_Distributions(Code)
The attribute estimators containing CPTs.



m_Instances
public Instances m_Instances(Code)
The dataset header for the purposes of printing out a semi-intelligible model



m_MissingValuesFilter
ReplaceMissingValues m_MissingValuesFilter(Code)
filter used to fill in missing values, if any *



m_NumClasses
protected int m_NumClasses(Code)
The number of classes



m_ParentSets
protected ParentSet[] m_ParentSets(Code)
The parent sets.



m_SearchAlgorithm
SearchAlgorithm m_SearchAlgorithm(Code)
Search algorithm used for learning the structure of a network.



m_bUseADTree
boolean m_bUseADTree(Code)
Use the experimental ADTree datastructure for calculating contingency tables



m_nNonDiscreteAttribute
int m_nNonDiscreteAttribute(Code)
attribute index of a non-nominal attribute



m_otherBayesNet
protected BIFReader m_otherBayesNet(Code)
Bayes network to compare the structure with.



serialVersionUID
final static long serialVersionUID(Code)
for serialization





Method Detail
BIFFileTipText
public String BIFFileTipText()(Code)
a string to describe the BIFFile.



XMLNormalize
String XMLNormalize(String sStr)(Code)
XMLNormalize converts the five standard XML entities in a string g.e. the string V&D's is returned as V&D's
Parameters:
  sStr - string to normalize normalized string



buildClassifier
public void buildClassifier(Instances instances) throws Exception(Code)
Generates the classifier.
Parameters:
  instances - set of instances serving as training data
throws:
  Exception - if the classifier has not been generatedsuccessfully



buildStructure
public void buildStructure() throws Exception(Code)
buildStructure determines the network structure/graph of the network. The default behavior is creating a network where all nodes have the first node as its parent (i.e., a BayesNet that behaves like a naive Bayes classifier). This method can be overridden by derived classes to restrict the class of network structures that are acceptable.
throws:
  Exception - in case of an error



countsForInstance
public double[] countsForInstance(Instance instance) throws Exception(Code)
Calculates the counts for Dirichlet distribution for the class membership probabilities for the given test instance.
Parameters:
  instance - the instance to be classified counts for Dirichlet distribution for class probability
throws:
  Exception - if there is a problem generating the prediction



distributionForInstance
public double[] distributionForInstance(Instance instance) throws Exception(Code)
Calculates the class membership probabilities for the given test instance.
Parameters:
  instance - the instance to be classified predicted class probability distribution
throws:
  Exception - if there is a problem generating the prediction



enumerateMeasures
public Enumeration enumerateMeasures()(Code)
Returns an enumeration of the measure names. Additional measures must follow the naming convention of starting with "measure", eg. double measureBlah() an enumeration of the measure names



estimateCPTs
public void estimateCPTs() throws Exception(Code)
estimateCPTs estimates the conditional probability tables for the Bayes Net using the network structure.
throws:
  Exception - in case of an error



estimatorTipText
public String estimatorTipText()(Code)
This will return a string describing the BayesNetEstimator. The string.



getADTree
public ADNode getADTree()(Code)
get ADTree strucrture containing efficient representation of counts. ADTree strucrture



getBIFFile
public String getBIFFile()(Code)
Get name of network in BIF file to compare with BIF file name



getCapabilities
public Capabilities getCapabilities()(Code)
Returns default capabilities of the classifier. the capabilities of this classifier



getCardinality
public int getCardinality(int iNode)(Code)
get number of values a node can take
Parameters:
  iNode - index of the node cardinality of the specified node



getDistributions
public Estimator[][] getDistributions()(Code)
Get full set of estimators. estimators;



getEstimator
public BayesNetEstimator getEstimator()(Code)
Get the BayesNetEstimator used for calculating the CPTs the BayesNetEstimator used.



getMeasure
public double getMeasure(String measureName)(Code)
Returns the value of the named measure
Parameters:
  measureName - the name of the measure to query for its value the value of the named measure
throws:
  IllegalArgumentException - if the named measure is not supported



getName
public String getName()(Code)
get name of the Bayes network name of the Bayes net



getNodeName
public String getNodeName(int iNode)(Code)
get name of a node in the Bayes network
Parameters:
  iNode - index of the node name of the specified node



getNodeValue
public String getNodeValue(int iNode, int iValue)(Code)
get name of a particular value of a node
Parameters:
  iNode - index of the node
Parameters:
  iValue - index of the value cardinality of the specified node



getNrOfNodes
public int getNrOfNodes()(Code)
get number of nodes in the Bayes network number of nodes



getNrOfParents
public int getNrOfParents(int iNode)(Code)
get number of parents of a node in the network structure
Parameters:
  iNode - index of the node number of parents of the specified node



getOptions
public String[] getOptions()(Code)
Gets the current settings of the classifier. an array of strings suitable for passing to setOptions



getParent
public int getParent(int iNode, int iParent)(Code)
get node index of a parent of a node in the network structure
Parameters:
  iNode - index of the node
Parameters:
  iParent - index of the parents, e.g., 0 is the first parent, 1 the second parent, etc. node index of the iParent's parent of the specified node



getParentCardinality
public int getParentCardinality(int iNode)(Code)
get number of values the collection of parents of a node can take
Parameters:
  iNode - index of the node cardinality of the parent set of the specified node



getParentSet
public ParentSet getParentSet(int iNode)(Code)
get the parent set of a node
Parameters:
  iNode - index of the node Parent set of the specified node.



getParentSets
public ParentSet[] getParentSets()(Code)
Get full set of parent sets. parent sets;



getProbability
public double getProbability(int iNode, int iParent, int iValue)(Code)
get particular probability of the conditional probability distribtion of a node given its parents.
Parameters:
  iNode - index of the node
Parameters:
  iParent - index of the parent set, 0 <= iParent <= getParentCardinality(iNode)
Parameters:
  iValue - index of the value, 0 <= iValue <= getCardinality(iNode) probability



getSearchAlgorithm
public SearchAlgorithm getSearchAlgorithm()(Code)
Get the SearchAlgorithm used as the search algorithm the SearchAlgorithm used as the search algorithm



getUseADTree
public boolean getUseADTree()(Code)
Method declaration whether ADTree structure is used or not



globalInfo
public String globalInfo()(Code)
This will return a string describing the classifier. The string.



graph
public String graph() throws Exception(Code)
Returns a BayesNet graph in XMLBIF ver 0.3 format. String representing this BayesNet in XMLBIF ver 0.3
throws:
  Exception - in case BIF generation fails



graphType
public int graphType()(Code)
Returns the type of graph this classifier represents. Drawable.TREE



initCPTs
public void initCPTs() throws Exception(Code)
initializes the conditional probabilities
throws:
  Exception - in case of an error



initStructure
public void initStructure() throws Exception(Code)
Init structure initializes the structure to an empty graph or a Naive Bayes graph (depending on the -N flag).
throws:
  Exception - in case of an error



listOptions
public Enumeration listOptions()(Code)
Returns an enumeration describing the available options an enumeration of all the available options



main
public static void main(String[] argv)(Code)
Main method for testing this class.
Parameters:
  argv - the options



measureAICScore
public double measureAICScore()(Code)



measureBDeuScore
public double measureBDeuScore()(Code)



measureBayesScore
public double measureBayesScore()(Code)



measureDivergence
public double measureDivergence()(Code)



measureEntropyScore
public double measureEntropyScore()(Code)



measureExtraArcs
public double measureExtraArcs()(Code)



measureMDLScore
public double measureMDLScore()(Code)



measureMissingArcs
public double measureMissingArcs()(Code)



measureReversedArcs
public double measureReversedArcs()(Code)



normalizeDataSet
Instances normalizeDataSet(Instances instances) throws Exception(Code)
ensure that all variables are nominal and that there are no missing values
Parameters:
  instances - data set to check and quantize and/or fill in missing values filtered instances
throws:
  Exception - if a filter (Discretize, ReplaceMissingValues) fails



normalizeInstance
Instance normalizeInstance(Instance instance) throws Exception(Code)
ensure that all variables are nominal and that there are no missing values
Parameters:
  instance - instance to check and quantize and/or fill in missing values filtered instance
throws:
  Exception - if a filter (Discretize, ReplaceMissingValues) fails



partitionOptions
public static String[] partitionOptions(String[] options)(Code)
Returns the secondary set of options (if any) contained in the supplied options array. The secondary set is defined to be any options after the first "--" but before the "-E". These options are removed from the original options array.
Parameters:
  options - the input array of options the array of secondary options



searchAlgorithmTipText
public String searchAlgorithmTipText()(Code)
a string to describe the SearchAlgorithm.



setBIFFile
public void setBIFFile(String sBIFFile)(Code)
Set name of network in BIF file to compare with
Parameters:
  sBIFFile - the name of the BIF file



setEstimator
public void setEstimator(BayesNetEstimator newBayesNetEstimator)(Code)
Set the Estimator Algorithm used in calculating the CPTs
Parameters:
  newBayesNetEstimator - the Estimator to use.



setOptions
public void setOptions(String[] options) throws Exception(Code)
Parses a given list of options.

Valid options are:

 -D
 Do not use ADTree data structure
 
 -B <BIF file>
 BIF file to compare with
 
 -Q weka.classifiers.bayes.net.search.SearchAlgorithm
 Search algorithm
 
 -E weka.classifiers.bayes.net.estimate.SimpleEstimator
 Estimator algorithm
 

Parameters:
  options - the list of options as an array of strings
throws:
  Exception - if an option is not supported



setSearchAlgorithm
public void setSearchAlgorithm(SearchAlgorithm newSearchAlgorithm)(Code)
Set the SearchAlgorithm used in searching for network structures.
Parameters:
  newSearchAlgorithm - the SearchAlgorithm to use.



setUseADTree
public void setUseADTree(boolean bUseADTree)(Code)
Set whether ADTree structure is used or not
Parameters:
  bUseADTree - true if an ADTree structure is used



toString
public String toString()(Code)
Returns a description of the classifier. a description of the classifier as a string.



toXMLBIF03
public String toXMLBIF03()(Code)
Returns a description of the classifier in XML BIF 0.3 format. See http://www-2.cs.cmu.edu/~fgcozman/Research/InterchangeFormat/ for details on XML BIF. an XML BIF 0.3 description of the classifier as a string.



updateClassifier
public void updateClassifier(Instance instance) throws Exception(Code)
Updates the classifier with the given instance.
Parameters:
  instance - the new training instance to include in the model
throws:
  Exception - if the instance could not be incorporated inthe model.



useADTreeTipText
public String useADTreeTipText()(Code)
a string to describe the UseADTreeoption.



Fields inherited from weka.classifiers.Classifier
protected boolean m_Debug(Code)(Java Doc)

Methods inherited from weka.classifiers.Classifier
abstract public void buildClassifier(Instances data) throws Exception(Code)(Java Doc)
public double classifyInstance(Instance instance) throws Exception(Code)(Java Doc)
public String debugTipText()(Code)(Java Doc)
public double[] distributionForInstance(Instance instance) throws Exception(Code)(Java Doc)
public static Classifier forName(String classifierName, String[] options) throws Exception(Code)(Java Doc)
public Capabilities getCapabilities()(Code)(Java Doc)
public boolean getDebug()(Code)(Java Doc)
public String[] getOptions()(Code)(Java Doc)
public Enumeration listOptions()(Code)(Java Doc)
public static Classifier[] makeCopies(Classifier model, int num) throws Exception(Code)(Java Doc)
public static Classifier makeCopy(Classifier model) throws Exception(Code)(Java Doc)
protected static void runClassifier(Classifier classifier, String[] options)(Code)(Java Doc)
public void setDebug(boolean debug)(Code)(Java Doc)
public void setOptions(String[] options) throws Exception(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.