edu.ksu.cis.bnj.bbn
Class BBNCPF

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.BBNCPF
All Implemented Interfaces:
java.lang.Cloneable

public class BBNCPF
extends java.lang.Object
implements java.lang.Cloneable

Author:
Roby Joehanes

Field Summary
protected  java.util.Hashtable cpf
          We store the PDF in a hashtable.
protected  java.util.Collection nodeNames
           
protected  int tableArity
           
 
Constructor Summary
BBNCPF(java.util.Collection nodeNames)
           
 
Method Summary
 void add(BBNCPF cpt)
          Addition with another CPT.
 java.lang.Object clone()
           
 void divide(BBNCPF cpt)
          Division with another CPT.
 void divide(BBNPDF arg)
           
 java.lang.String dumpPDF()
          Dumping out the PDF.
 BBNCPF extract(java.util.Collection subset)
           
 BBNCPF extractExcept(java.util.Collection subset)
           
 double get(java.util.Hashtable values)
          Queries to the CPT (or CPF, in case of continuous value).
 java.util.Hashtable getTable()
           
 void multiply(BBNCPF cpt)
          Multiplication with another CPT.
 void multiply(BBNPDF arg)
           
 void normalize(java.lang.String base)
          Normalize.
 void normalizeAndFill(java.lang.String base)
          Normalize.
 double normalizedQuery(java.util.Hashtable values)
          Same as query, but normalized
 void put(java.util.Hashtable q, BBNPDF v)
          Populating the conditional probability function (CPF)
 double query(java.util.Hashtable v)
          Syntactical candy for get(Hashtable) to make naming consistent
 java.util.List queryColumn(java.util.Hashtable values)
           
 void remove(java.util.Hashtable q)
          Removing a specific entry from CPF.
 void resetEntries()
          Reset all CPT entries to zeroes.
 void setTable(java.util.Hashtable t)
           
 void subtract(BBNCPF cpt)
          Subtraction with another CPT.
 java.lang.String toString()
           
 void zeroEntryExcept(java.util.Hashtable q)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cpf

protected java.util.Hashtable cpf
We store the PDF in a hashtable.


nodeNames

protected java.util.Collection nodeNames

tableArity

protected int tableArity
Constructor Detail

BBNCPF

public BBNCPF(java.util.Collection nodeNames)
Method Detail

query

public double query(java.util.Hashtable v)
Syntactical candy for get(Hashtable) to make naming consistent

Parameters:
v -
Returns:
double

get

public double get(java.util.Hashtable values)
Queries to the CPT (or CPF, in case of continuous value).

Parameters:
values - The query values in a hash table
Returns:
double the return value.

normalizedQuery

public double normalizedQuery(java.util.Hashtable values)
Same as query, but normalized

Parameters:
values - The query values in a hash table
Returns:
double the return value.

resetEntries

public void resetEntries()
Reset all CPT entries to zeroes.


put

public void put(java.util.Hashtable q,
                BBNPDF v)
Populating the conditional probability function (CPF)

Parameters:
q - The query
v - The actual value

remove

public void remove(java.util.Hashtable q)
Removing a specific entry from CPF.

Parameters:
q - the query

zeroEntryExcept

public void zeroEntryExcept(java.util.Hashtable q)

dumpPDF

public java.lang.String dumpPDF()
Dumping out the PDF. For debugging only.


multiply

public void multiply(BBNCPF cpt)
Multiplication with another CPT. (this_cpt = this_cpt * other_cpt) Note: This function must be overhauled if we deal with continuous values!

Parameters:
cpt -

divide

public void divide(BBNCPF cpt)
Division with another CPT. (this_cpt = this_cpt / other_cpt) Note: This function must be overhauled if we deal with continuous values! Also, if the denominator is zero, the division is not carried out (otherwise Java will complain division by zero error).

Parameters:
cpt -

add

public void add(BBNCPF cpt)
Addition with another CPT. (this_cpt = this_cpt + other_cpt) Note: This function must be overhauled if we deal with continuous values!

Parameters:
cpt -

subtract

public void subtract(BBNCPF cpt)
Subtraction with another CPT. (this_cpt = this_cpt - other_cpt) Note: This function must be overhauled if we deal with continuous values!

Parameters:
cpt -

queryColumn

public java.util.List queryColumn(java.util.Hashtable values)

extract

public BBNCPF extract(java.util.Collection subset)

extractExcept

public BBNCPF extractExcept(java.util.Collection subset)

normalize

public void normalize(java.lang.String base)
Normalize. If the column total is 0.0, it may throw a divide by zero error

Parameters:
base - Name of the variable to be marginalized to 1.0

normalizeAndFill

public void normalizeAndFill(java.lang.String base)
Normalize. If the column total is 0.0, fill it with uniform values

Parameters:
base - Name of the variable to be marginalized to 1.0

multiply

public void multiply(BBNPDF arg)

divide

public void divide(BBNPDF arg)

setTable

public void setTable(java.util.Hashtable t)

getTable

public java.util.Hashtable getTable()

toString

public java.lang.String toString()

clone

public java.lang.Object clone()