edu.ksu.cis.bnj.bbn.learning.scorebased.k2
Class K2

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.learning.Learner
      extended byedu.ksu.cis.bnj.bbn.learning.ScoreBasedLearner
          extended byedu.ksu.cis.bnj.bbn.learning.BDEBasedLearner
              extended byedu.ksu.cis.bnj.bbn.learning.scorebased.k2.K2
All Implemented Interfaces:
Optionable

public class K2
extends BDEBasedLearner

K2 algorithm

Author:
Roby Joehanes

Field Summary
protected  java.util.List ordering
          Set the upper bound on parent limits for K2.
protected  java.util.Set[] parentTable
           
 
Fields inherited from class edu.ksu.cis.bnj.bbn.learning.ScoreBasedLearner
candidateScorer, defaultParentLimit, parentLimit, structureScorer
 
Fields inherited from class edu.ksu.cis.bnj.bbn.learning.Learner
bbnNodes, calculateCPT, data, indexTable, learnerClassName, OPT_CALCULATE_RMSE, options
 
Fields inherited from interface edu.ksu.cis.kdd.util.gui.Optionable
OPT_OUTPUT_FILE
 
Constructor Summary
K2()
           
K2(Data t)
          Constructor for K2.
 
Method Summary
 BBNGraph getGraph()
           Procedure K2 for i:=1 downto n do pi(v[i]) = emptyset; // parent of v[i] Pold = g(v[i], pi(v[i])); while | pi(v[i]) | < limit do let z be the node in v[0..i-1] - pi(v[i]) that maximizes g(v[i], pi(v[i]) U {z}); Pnew = g(v[i], pi(v[i]) U {z}); if Pnew <= Pold then break; Pold := Pnew; pi(v[i]) := pi(v[i]) U {z}; end while write("Parents of "+v[i]+" are :", pi(v[i]); end for end K2
 java.lang.String getName()
           
 double getNetworkScore()
          added by prashanth
 OptionGUI getOptionsDialog()
           
 java.util.List getOrdering()
           
static Table getToyExample()
          Get the toy example out from paper for testing
 void initialize()
          This method will be invoked prior to getGraph.
static void main(java.lang.String[] args)
           
 void processParameters(java.lang.String[] args)
           
 void setOrdering(java.util.List ordering)
          Sets the ordering.
 
Methods inherited from class edu.ksu.cis.bnj.bbn.learning.ScoreBasedLearner
computeCPT, getParentLimit, iterateUniqueInstantiation, setCandidateScorer, setParentLimit, setStructureScorer, setTable
 
Methods inherited from class edu.ksu.cis.bnj.bbn.learning.Learner
getCalculateRMSE, getCurrentOptions, getData, getDefaultOptions, getOutputFile, isCalculateCPT, load, populateNodes, setCalculateCPT, setCalculateRMSE, setData, setOption, setOptions, setOutputFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ordering

protected java.util.List ordering
Set the upper bound on parent limits for K2. Defaults to 5


parentTable

protected java.util.Set[] parentTable
Constructor Detail

K2

public K2()

K2

public K2(Data t)
Constructor for K2.

Parameters:
t -
Method Detail

getGraph

public BBNGraph getGraph()
Procedure K2 for i:=1 downto n do pi(v[i]) = emptyset; // parent of v[i] Pold = g(v[i], pi(v[i])); while | pi(v[i]) | < limit do let z be the node in v[0..i-1] - pi(v[i]) that maximizes g(v[i], pi(v[i]) U {z}); Pnew = g(v[i], pi(v[i]) U {z}); if Pnew <= Pold then break; Pold := Pnew; pi(v[i]) := pi(v[i]) U {z}; end while write("Parents of "+v[i]+" are :", pi(v[i]); end for end K2

Specified by:
getGraph in class BDEBasedLearner
See Also:
edu.ksu.cis.bnj.bbn.learning.Learning#getGraph()

getName

public java.lang.String getName()
Overrides:
getName in class Learner

getOrdering

public java.util.List getOrdering()
Returns:
List

setOrdering

public void setOrdering(java.util.List ordering)
Sets the ordering.

Parameters:
ordering - The ordering to set

initialize

public void initialize()
Description copied from class: Learner
This method will be invoked prior to getGraph. The purpose is to let the learner object to purge caches and stuff.

Overrides:
initialize in class Learner
See Also:
edu.ksu.cis.bnj.bbn.learning.Learning#initialize()

processParameters

public void processParameters(java.lang.String[] args)
Overrides:
processParameters in class Learner

getToyExample

public static Table getToyExample()
Get the toy example out from paper for testing

Returns:
Table

getOptionsDialog

public OptionGUI getOptionsDialog()
Specified by:
getOptionsDialog in interface Optionable
Overrides:
getOptionsDialog in class Learner

getNetworkScore

public double getNetworkScore()
added by prashanth


main

public static void main(java.lang.String[] args)