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) |
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).
Definition at line 25 of file bayesnets/learning/DomainLearner.java.
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
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. |
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
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. |
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)
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)
bn | the belief network |
Definition at line 198 of file bayesnets/learning/DomainLearner.java.
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))
res | the query result containing the data for a set of examples |
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
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>.
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. |
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.
rs | the result set |
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.
rs | the result set |
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
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.
Attribute edu::tum::cs::bayesnets::learning::DomainLearner::attrValue [protected] |
Definition at line 41 of file bayesnets/learning/DomainLearner.java.
Instances [] edu::tum::cs::bayesnets::learning::DomainLearner::clusterData [protected] |
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.
SimpleKMeans [] edu::tum::cs::bayesnets::learning::DomainLearner::clusterers [package] |
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.
ClusterNamer<SimpleKMeans> edu::tum::cs::bayesnets::learning::DomainLearner::clusterNamer [protected] |
an object providing a function for naming clusters
Definition at line 54 of file bayesnets/learning/DomainLearner.java.
HashSet<?> [] edu::tum::cs::bayesnets::learning::DomainLearner::directDomainData [protected] |
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.
BeliefNode [] edu::tum::cs::bayesnets::learning::DomainLearner::directDomains [protected] |
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.
String [][] edu::tum::cs::bayesnets::learning::DomainLearner::duplicateDomains [package] |
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.
boolean edu::tum::cs::bayesnets::learning::DomainLearner::verbose = false [protected] |
Definition at line 81 of file bayesnets/learning/DomainLearner.java.