edu.ksu.cis.bnj.bbn.learning.score
Class WeightedBDEScore

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.learning.LearnerScore
      extended byedu.ksu.cis.bnj.bbn.learning.score.BDEScore
          extended byedu.ksu.cis.bnj.bbn.learning.score.WeightedBDEScore

public class WeightedBDEScore
extends BDEScore


Field Summary
static double lnPi
           
static double oneThird
           
 
Fields inherited from class edu.ksu.cis.bnj.bbn.learning.score.BDEScore
arityCache, curNode, lnFactorialCache, nodeArity, nodes, result, ri_minus_one, ri_minus_one_fact, tupleSize
 
Fields inherited from class edu.ksu.cis.bnj.bbn.learning.LearnerScore
NO_CANDIDATES, owner, tally
 
Constructor Summary
WeightedBDEScore()
           
WeightedBDEScore(Learner l)
           
 
Method Summary
 double getScore(int curNode, int candidate, java.util.Set[] parentTable)
          BDE scoring is:
g(vi, parents(vi)) = \Pi_{j=1}^{qi} ((ri-1)!
 void initialize()
          This is just to reset the cache.
protected  void iterateUniqueInstantiation(int depth, TableTally tally)
          Recursively filter out the data according to the current node (Roby Joehanes)
protected static double stirlingGosperApprox(double n)
          Stirling-Gosper approximation for ln n!
 
Methods inherited from class edu.ksu.cis.bnj.bbn.learning.score.BDEScore
iterateUniqueInstantiation, precache
 
Methods inherited from class edu.ksu.cis.bnj.bbn.learning.LearnerScore
getTallyer, setData, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oneThird

public static final double oneThird
See Also:
Constant Field Values

lnPi

public static final double lnPi
Constructor Detail

WeightedBDEScore

public WeightedBDEScore()

WeightedBDEScore

public WeightedBDEScore(Learner l)
Method Detail

getScore

public double getScore(int curNode,
                       int candidate,
                       java.util.Set[] parentTable)
Description copied from class: BDEScore
BDE scoring is:
g(vi, parents(vi)) = \Pi_{j=1}^{qi} ((ri-1)!/(Nij+ri-1)!) \Pi_{k=1}^{ri} Nijk!

With:
vi is the node being queried
qi is the unique instantiation of vi's parents
ri is vi's arity
Nij is the total number of unique cases of one unique instantiation
Nijk is the total number of unique cases of one unique instantiation that contains the value of r_ik.

Then, we do a logarithm out of g.

In short, UTSL or RTFP.

Overrides:
getScore in class BDEScore
See Also:
edu.ksu.cis.bnj.bbn.learning.LearnerScore#score(java.lang.String, java.util.Set)

stirlingGosperApprox

protected static double stirlingGosperApprox(double n)
Stirling-Gosper approximation for ln n! (Roby Joehanes) ln n! = 0.5*(ln(2*n+ 1/3) + ln pi) + n ln n - n I did this because the weights may be real valued


iterateUniqueInstantiation

protected void iterateUniqueInstantiation(int depth,
                                          TableTally tally)
Recursively filter out the data according to the current node (Roby Joehanes)

Parameters:
depth -
tally -

initialize

public void initialize()
This is just to reset the cache. But since it is not dependent on tuple numbers, we can simply ignore this.

Overrides:
initialize in class LearnerScore
See Also:
LearnerScore.initialize()