edu::tum::cs::bayesnets::learning::CPTLearner Class Reference

Inheritance diagram for edu::tum::cs::bayesnets::learning::CPTLearner:
Inheritance graph
[legend]

List of all members.

Classes

class  ExampleCounter

Public Member Functions

void addClusterer (String nodeName, Clusterer clusterer) throws Exception
 CPTLearner (DomainLearner dl) throws Exception
 CPTLearner (BeliefNetworkEx bn)
void learn (Map< String, String > data) throws Exception
void learn (Instances instances) throws Exception
void learn (ResultSet rs) throws Exception
void setUniformDefault (boolean value)

Protected Member Functions

void end_learning ()

Protected Attributes

Clusterer[] clusterers
ExampleCounter[] counters
boolean uniformDefault

Static Package Functions

 [static initializer]

Static Package Attributes

static final Logger logger = Logger.getLogger(CPTLearner.class)

Private Member Functions

void init ()

Detailed Description

learns the conditional probability tables for all nodes in a Bayesian network when given a set of examples. CPTs are learnt by initializing all the table values to zero and incrementing individual values whenever a corresponding example is passed. In the end, probablities are obtained by means of normalization.

Author:
Dominik Jain

Definition at line 26 of file bayesnets/learning/CPTLearner.java.


Constructor & Destructor Documentation

edu::tum::cs::bayesnets::learning::CPTLearner::CPTLearner ( BeliefNetworkEx  bn  )  [inline]

constructs a CPTLearner object from a BeliefNetworkEx object

Parameters:
bn 

Definition at line 54 of file bayesnets/learning/CPTLearner.java.

edu::tum::cs::bayesnets::learning::CPTLearner::CPTLearner ( DomainLearner  dl  )  throws Exception [inline]

constructs a CPTLearner object from a DomainLearner. If you consecutively want to learn domains and CPTs, you should make use of this constructor, because it relieves you of the burden of having to pass the clusterers that categorize instances for certain domains manually (duplicate domains are taken into consideration, i.e. clusterers will be reused appropriately).

Parameters:
dl the domain learner
Exceptions:
Exception 

Definition at line 76 of file bayesnets/learning/CPTLearner.java.


Member Function Documentation

edu::tum::cs::bayesnets::learning::CPTLearner::[static initializer] (  )  [inline, static, package]
void edu::tum::cs::bayesnets::learning::CPTLearner::addClusterer ( String  nodeName,
Clusterer  clusterer 
) throws Exception [inline]

learns all the examples in a fipm.data.QueryResult (otherwise analogous to learn(ResultSet))

Parameters:
res the query result containing the data for a set of examples
Exceptions:
Exception tells the CPTLearner to use a clusterer to categorize instances (i.e. example outcomes) for a certain node.
Parameters:
nodeName the name of the node
clusterer the clusterer to use for categorization
Exceptions:
Exception if the name of the node is invalid

Definition at line 397 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::end_learning (  )  [inline, protected, virtual]

normalizes the CPTs (is called by finish and should not be called)

Implements edu::tum::cs::bayesnets::learning::Learner.

Definition at line 409 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::init (  )  [inline, private]

initializes the array of clusterers (initially an array of null references) and the array of example counters (one for each node)

Definition at line 99 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::learn ( Map< String, String >  data  )  throws Exception [inline]

learns an example from a Map<String,String>. This is the only learning method without using BeliefNetworkEx#getAttributeNameForNode(String).

Parameters:
data a Map containing the data for one example. The names of all the random variables (nodes) in the network must be found in the set of keys of the hash map.
Exceptions:
Exception if required keys are missing from the HashMap

Definition at line 301 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::learn ( Instances  instances  )  throws Exception [inline]

learns all the examples in the instances. Each instance in the instances represents one example. All the random variables (nodes) in the network need to be found in each instance as columns that are named accordingly, i.e. for each random variable, there must be an attribute with a matching name in the instance.

Parameters:
instances the instances
Exceptions:
Exception if the result set is empty
SQLException particularly if there is no matching column for one of the node names

Definition at line 197 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::learn ( ResultSet  rs  )  throws Exception [inline, virtual]

learns all the examples in the result set. Each row in the result set represents one example. All the random variables (nodes) in the network need to be found in each result row as columns that are named accordingly, i.e. for each random variable, there must be a column with a matching name in the result set.

Parameters:
rs the result set
Exceptions:
Exception if the result set is empty
SQLException particularly if there is no matching column for one of the node names

Implements edu::tum::cs::bayesnets::learning::Learner.

Definition at line 117 of file bayesnets/learning/CPTLearner.java.

void edu::tum::cs::bayesnets::learning::CPTLearner::setUniformDefault ( boolean  value  )  [inline]

controls how to finalize a column of the CPT when there were no examples (i.e. all of the column's entries are zero); By default, the zeros are kept

Parameters:
value If true, use a uniform distribution for such columns; otherwise leave the column as it was (all zeros)

Definition at line 63 of file bayesnets/learning/CPTLearner.java.


Member Data Documentation

an array of clusterers - one for each node; for nodes that do not use clustering to determine the index of the domain, the entry is null

Definition at line 43 of file bayesnets/learning/CPTLearner.java.

an array of example counter objects - one for each node in the network

Definition at line 38 of file bayesnets/learning/CPTLearner.java.

final Logger edu::tum::cs::bayesnets::learning::CPTLearner::logger = Logger.getLogger(CPTLearner.class) [static, package]

The logger for this class.

Definition at line 30 of file bayesnets/learning/CPTLearner.java.

controls how to finalize a column of the CPT for which there were no examples (i.e. all of the column entries are 0); If true, assume a uniform distribution, otherwise keep the zeros.

Definition at line 48 of file bayesnets/learning/CPTLearner.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations


srldb
Author(s): Dominik Jain, Stefan Waldherr, Moritz Tenorth
autogenerated on Fri Jan 11 09:58:39 2013