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

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

List of all members.

Classes

class  ClusteredDomain

Public Member Functions

 DomainLearner (BeliefNetworkEx bn)
 DomainLearner (BeliefNetwork bn)
 DomainLearner (BeliefNetwork bn, String[] directDomains, ClusteredDomain[] clusteredDomains, ClusterNamer namer, String[][] duplicateDomains)
 DomainLearner (BeliefNetworkEx bn, String[] directDomains, ClusteredDomain[] clusteredDomains, ClusterNamer namer, String[][] duplicateDomains) throws Exception
SimpleKMeans[] getClusterers () throws Exception
void learn (Map< String, String > data) throws Exception
void learn (Instances instances) throws Exception, SQLException
void learn (ResultSet rs) throws Exception, SQLException
void sortClusteredDomains ()

Protected Member Functions

void end_learning () throws Exception
BeliefNode[] getBeliefNodes (String[] names)
void sortClusteredDomain (BeliefNode node, SimpleKMeans clusterer)

Protected Attributes

Attribute attrValue
Instances[] clusterData
ClusterNamer< SimpleKMeans > clusterNamer
HashSet<?>[] directDomainData
BeliefNode[] directDomains
boolean verbose = false

Package Attributes

ClusteredDomain[] clusteredDomains
SimpleKMeans[] clusterers
String[][] duplicateDomains

Private Member Functions

void init (BeliefNode[] directDomains, ClusteredDomain[] clusteredDomains, ClusterNamer< SimpleKMeans > namer, String[][] duplicateDomains)

Detailed Description

learns domains for a certain set of nodes in a Bayesian network when given a set of examples to learn from. The domains of discrete variables can be learnt directly (i.e. the set of outcomes found in the examples becomes the new domain); the domains of continuous variables can be learnt using clustering. For clustering, WEKA's SimpleKMeans clustering algorithm is used, which yields a Gaussian distribution for each cluster (i.e. expected value (centroid) and standard deviation).

Author:
Dominik Jain

Definition at line 25 of file bayesnets/learning/DomainLearner.java.


Constructor & Destructor Documentation

edu::tum::cs::bayesnets::learning::DomainLearner::DomainLearner ( BeliefNetworkEx  bn,
String[]  directDomains,
ClusteredDomain[]  clusteredDomains,
ClusterNamer  namer,
String  duplicateDomains[][] 
) throws Exception [inline]

constructs a DomainLearner object from a BeliefNetworkEx object

Parameters:
bn the belief network
directDomains an array of strings containing the names of nodes for which the domains are to be learnt directly from the set of examples (i.e. every value that occurs in the examples is also a possible outcome in the domain); may be null
clusteredDomains an array of ClusteredDomain objects, where each object contains information on a node whose domain is to be learnt via clustering; may be null
namer the namer that is to be used for naming clusters (may be null if no clustered domains are specified)
duplicateDomains an array of arrays of strings specifying domains that can be transferred from one node to another; may be null. If several nodes essentially share the same domain, the domain need only be learnt for one of the nodes; the learnt domain can then be transferred to the other nodes once the learning is complete. Each item in the array is an array of strings, where the first item is the name of the node for which the domain will be learnt and all subsequent items are the names of nodes to which the learnt domain is to be transferred.
Exceptions:
Exception 

Definition at line 135 of file bayesnets/learning/DomainLearner.java.

edu::tum::cs::bayesnets::learning::DomainLearner::DomainLearner ( BeliefNetwork  bn,
String[]  directDomains,
ClusteredDomain[]  clusteredDomains,
ClusterNamer  namer,
String  duplicateDomains[][] 
) [inline]

constructs a DomainLearner object from a BeliefNetwork object

Parameters:
bn the belief network
directDomains an array of strings containing the names of nodes for which the domains are to be learnt directly from the set of examples (i.e. every value that occurs in the examples is also a possible outcome in the domain)
clusteredDomains an array of ClusteredDomain objects, where each object contains information on a node whose domain is to be learnt via clustering
namer the namer that is to be used for naming clusters (may be null if no clustered domains are specified)
duplicateDomains an array of arrays of strings specifying domains that can be transferred from one node to another. If several nodes essentially share the same domain, the domain need only be learnt for one of the nodes; the learnt domain can then be transferred to the other nodes once the learning is complete. Each item in the array is an array of strings, where the first item is the name of the node for which the domain will be learnt and all subsequent items are the names of nodes to which the learnt domain is to be transferred.
Exceptions:
Exception 

Definition at line 171 of file bayesnets/learning/DomainLearner.java.

edu::tum::cs::bayesnets::learning::DomainLearner::DomainLearner ( BeliefNetwork  bn  )  [inline]

constructs a DomainLearner where the domains of all nodes are to be learnt directly from the set of examples (i.e. every value that occurs in the examples is also a possible outcome in the domain)

Parameters:
bn the belief network

Definition at line 186 of file bayesnets/learning/DomainLearner.java.

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

constructs a DomainLearner where the domains of all nodes are to be learnt directly from the set of examples (i.e. every value that occurs in the examples is also a possible outcome in the domain)

Parameters:
bn the belief network

Definition at line 198 of file bayesnets/learning/DomainLearner.java.


Member Function Documentation

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

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 performs the clustering (if some domains are to be learnt by clustering) and applies all the new domains. (This method is called by finish(), which should be called when all the examples have been passed.)

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

Reimplemented in edu::tum::cs::srl::bayesnets::learning::DomainLearner.

Definition at line 419 of file bayesnets/learning/DomainLearner.java.

BeliefNode [] edu::tum::cs::bayesnets::learning::DomainLearner::getBeliefNodes ( String[]  names  )  [inline, protected]

Definition at line 203 of file bayesnets/learning/DomainLearner.java.

SimpleKMeans [] edu::tum::cs::bayesnets::learning::DomainLearner::getClusterers (  )  throws Exception [inline]

returns the array clusterers for all the nodes whose domains were to be learned by clustering

Returns:
the array of clusterers. It is ordered according to the array of "clustered domains" that was passed at construction.
Exceptions:
Exception 

Definition at line 476 of file bayesnets/learning/DomainLearner.java.

void edu::tum::cs::bayesnets::learning::DomainLearner::init ( BeliefNode[]  directDomains,
ClusteredDomain[]  clusteredDomains,
ClusterNamer< SimpleKMeans >  namer,
String  duplicateDomains[][] 
) [inline, private]

Definition at line 210 of file bayesnets/learning/DomainLearner.java.

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

learns an example from a HashMap<String,String>.

Parameters:
data a HashMap containing the data for one example. The names of the random variables (nodes) for which the domains are to be learnt 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 333 of file bayesnets/learning/DomainLearner.java.

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

learns all the examples in the result set. Each row in the result set represents one example. All the random variables (nodes) that have been scheduled for learning in the constructor need to be found in each result row as columns that are named accordingly, i.e. for each random variable for which the domain is to be learnt, 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

Definition at line 297 of file bayesnets/learning/DomainLearner.java.

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

learns all the examples in the result set. Each row in the result set represents one example. All the random variables (nodes) that have been scheduled for learning in the constructor need to be found in each result row as columns that are named accordingly, i.e. for each random variable for which the domain is to be learnt, 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 256 of file bayesnets/learning/DomainLearner.java.

void edu::tum::cs::bayesnets::learning::DomainLearner::sortClusteredDomain ( BeliefNode  node,
SimpleKMeans  clusterer 
) [inline, protected]

sorts the domain of the given node, for which the given clusterer has been learnt, in ascending order of cluster centroid

Parameters:
node 
clusterer 

Definition at line 517 of file bayesnets/learning/DomainLearner.java.

void edu::tum::cs::bayesnets::learning::DomainLearner::sortClusteredDomains (  )  [inline]

sorts the domains that were learned via clustering in ascending order of cluster centroid. Attention: Do not use the clusterers returned by getClusterers() after this function has been called because the indices returned by clusterInstance will otherwise be wrong! In particular, never conduct CPT-learning after calling this function. (You may, of course, call this function after the CPT-learning has been completed.)

Definition at line 489 of file bayesnets/learning/DomainLearner.java.


Member Data Documentation

Definition at line 41 of file bayesnets/learning/DomainLearner.java.

an array of instance collections for clustering; one collection is to hold all the instances that were encountered for one of the nodes whose domains are learnt via clustering. Each entry in the array corresponds to an entry in clusteredDomains.

Definition at line 39 of file bayesnets/learning/DomainLearner.java.

an array of ClusteredDomain objects, where each object contains information on a node whose domain is to be learnt via clustering

Definition at line 31 of file bayesnets/learning/DomainLearner.java.

an array of clusterers, one for each node whose domain is to be learnt via clustering. The clusterers are built from the instance data when the learning process is ended. Each entry in the array corresponds to an entry in clusteredDomains.

Definition at line 49 of file bayesnets/learning/DomainLearner.java.

an object providing a function for naming clusters

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

an array of hash sets, where each set contains the outcomes that were encountered so far for one of the entries in array directDomains

Definition at line 67 of file bayesnets/learning/DomainLearner.java.

an array of nodes for which the domains are to be learnt directly from the set of examples (i.e. every value that occurs in the examples is also a possible outcome in the domain);

Definition at line 61 of file bayesnets/learning/DomainLearner.java.

an array of arrays of strings specifying domains that can be transferred from one node to another; may be null. If several nodes essentially share the same domain, the domain need only be learnt for one of the nodes; the learnt domain can then be transferred to the other nodes once the learning is complete. Each item in the array is an array of strings, where the first item is the name of the node for which the domain will be learnt and all subsequent items are the names of nodes to which the learnt domain is to be

Definition at line 79 of file bayesnets/learning/DomainLearner.java.

Definition at line 81 of file bayesnets/learning/DomainLearner.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