pt.tumba.ngram.bayes
Class InferenceGraph

java.lang.Object
  extended by pt.tumba.ngram.bayes.InferenceGraph

public class InferenceGraph
extends java.lang.Object


Field Summary
static int CONSTANT_DENSITY_BOUNDED
           
static int CONSTANT_DENSITY_RATIO
           
private  java.lang.String defaultBayesNetName
           
static int EPSILON_CONTAMINATED
           
static int EXPECTATION
           
static int EXPLANATION
           
static int FULL_EXPLANATION
           
static int MARGINAL_POSTERIOR
           
static int NO_CREDAL_SET
           
(package private)  java.util.Vector nodes
           
(package private)  QuasiBayesExpectation qbe
           
(package private)  QuasiBayesInference qbi
           
(package private)  QuasiBayesNet qbn
           
static int SENSITIVITY_ANALYSIS
           
static int TOTAL_VARIATION
           
 
Constructor Summary
InferenceGraph()
           
InferenceGraph(BayesNet b_n)
           
InferenceGraph(java.lang.String filename)
           
InferenceGraph(java.net.URL url)
           
 
Method Summary
 void add_network_property(java.lang.String prop)
          Add a property to the network.
 void change_values(InferenceGraphNode node, java.lang.String[] values)
          Change the values of a variable.
 java.lang.String check_name(java.lang.String n)
          Determine whether or not a name is valid and/or repeated.
(package private)  boolean convert_bayes_net()
           
(package private)  QuasiBayesNet convert_graph()
           
 boolean create_arc(InferenceGraphNode parent, InferenceGraphNode child)
          Create an arc from parent to child.
 void create_node(int x, int y)
          Create a new node in the network.
 void delete_arc(InferenceGraphNode parent, InferenceGraphNode child)
          Delete the arc from parent to child.
 void delete_node(InferenceGraphNode node)
          Delete a node in the network.
 java.util.Enumeration elements()
          Get the nodes in the network as an Enumeration object.
private  java.lang.String generate_name(int i)
           
private  void generate_parents_and_children()
           
 QuasiBayesNet get_bayes_net()
           
 double get_global_neighborhood_parameter()
          Get the parameter for the global neighborhood modeled by the network.
 int get_global_neighborhood_type()
          Get the type of global neighborhood modeled by the network.
 java.lang.String get_name()
          Get the name of the network.
 java.util.Vector get_network_properties()
          Get the properties of the network.
private  InferenceGraphNode get_node(DiscreteVariable dv)
           
 java.util.Vector get_nodes()
          Get the nodes in the network.
 boolean hasCycle(InferenceGraphNode bottom_node, InferenceGraphNode head_node)
          Determines whether the connection of bottom_node to head_node would cause the network to have a cycle.
 int number_nodes()
          Get the number of variables in the network
 void print_bayes_net(java.io.PrintStream out)
          Print the QuasiBayesNet.
 void print_expectation(java.io.PrintStream pstream, java.lang.String queried_variable, boolean do_compute_clusters, boolean show_bucket_tree)
          Print information about a posterior expectation for the Bayesian network into the given PrintStream.
 void print_explanation(java.io.PrintStream pstream, boolean show_bucket_tree)
          Print information about an explanation for the Bayesian network into the given PrintStream.
 void print_full_explanation(java.io.PrintStream pstream, boolean show_bucket_tree)
          Print information about a full explanation for the Bayesian network into the given PrintStream.
 void print_marginal(java.io.PrintStream pstream, java.lang.String queried_variable, boolean do_compute_clusters, boolean show_bucket_tree)
          Print information about a posterior marginal for the Bayesian network into the given PrintStream.
 void print_sensitivity_analysis(java.io.PrintStream pstream)
          Print the metrics for sensitivity analysis of the Bayesian network into the given PrintStream.
 void print()
          Print method for an InferenceGraph
 void print(java.io.PrintStream out)
          Print method for an InferenceGraph
 void remove_network_property(int index)
          Remove a property from the network.
 void reset_expectation()
          Reset the QBExpectation.
 void reset_marginal()
          Reset the QBInference.
 void save_bif(java.io.PrintStream out)
          Save the Bayesian network into a PrintStream in the BIF InterchangeFormat.
 void save_bugs(java.io.PrintStream out)
          Save the Bayesian networks in BUGS format into a PrintStream.
 void save_xml(java.io.PrintStream out)
          Save the Bayesian network into a PrintStream in the XML InterchangeFormat.
 void set_global_neighborhood_parameter(double parameter)
          Set the parameter for the global neighborhood modeled by the network.
 void set_global_neighborhood(int type)
          Set the global neighborhood type.
 void set_name(java.lang.String n)
          Set the name of the network.
 void set_network_properties(java.util.Vector prop)
          Set the properties of the network.
 void set_pos(InferenceGraphNode node, java.awt.Point position)
          Set a value for the position of the node.
 java.lang.String validate_value(java.lang.String value)
          Check whether a string is a valid name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qbn

QuasiBayesNet qbn

qbi

QuasiBayesInference qbi

qbe

QuasiBayesExpectation qbe

nodes

java.util.Vector nodes

defaultBayesNetName

private final java.lang.String defaultBayesNetName
See Also:
Constant Field Values

MARGINAL_POSTERIOR

public static final int MARGINAL_POSTERIOR
See Also:
Constant Field Values

EXPECTATION

public static final int EXPECTATION
See Also:
Constant Field Values

EXPLANATION

public static final int EXPLANATION
See Also:
Constant Field Values

FULL_EXPLANATION

public static final int FULL_EXPLANATION
See Also:
Constant Field Values

SENSITIVITY_ANALYSIS

public static final int SENSITIVITY_ANALYSIS
See Also:
Constant Field Values

NO_CREDAL_SET

public static final int NO_CREDAL_SET
See Also:
Constant Field Values

CONSTANT_DENSITY_RATIO

public static final int CONSTANT_DENSITY_RATIO
See Also:
Constant Field Values

EPSILON_CONTAMINATED

public static final int EPSILON_CONTAMINATED
See Also:
Constant Field Values

CONSTANT_DENSITY_BOUNDED

public static final int CONSTANT_DENSITY_BOUNDED
See Also:
Constant Field Values

TOTAL_VARIATION

public static final int TOTAL_VARIATION
See Also:
Constant Field Values
Constructor Detail

InferenceGraph

public InferenceGraph()

InferenceGraph

public InferenceGraph(BayesNet b_n)

InferenceGraph

public InferenceGraph(java.lang.String filename)
               throws java.io.IOException,
                      IFException
Throws:
java.io.IOException
IFException

InferenceGraph

public InferenceGraph(java.net.URL url)
               throws java.io.IOException,
                      IFException
Throws:
java.io.IOException
IFException
Method Detail

get_bayes_net

public QuasiBayesNet get_bayes_net()

convert_bayes_net

boolean convert_bayes_net()

generate_parents_and_children

private void generate_parents_and_children()

get_node

private InferenceGraphNode get_node(DiscreteVariable dv)

convert_graph

QuasiBayesNet convert_graph()

generate_name

private java.lang.String generate_name(int i)

get_name

public java.lang.String get_name()
Get the name of the network.


set_name

public void set_name(java.lang.String n)
Set the name of the network.


get_network_properties

public java.util.Vector get_network_properties()
Get the properties of the network.


set_network_properties

public void set_network_properties(java.util.Vector prop)
Set the properties of the network.


get_global_neighborhood_type

public int get_global_neighborhood_type()
Get the type of global neighborhood modeled by the network.


set_global_neighborhood

public void set_global_neighborhood(int type)
Set the global neighborhood type.


get_global_neighborhood_parameter

public double get_global_neighborhood_parameter()
Get the parameter for the global neighborhood modeled by the network.


set_global_neighborhood_parameter

public void set_global_neighborhood_parameter(double parameter)
Set the parameter for the global neighborhood modeled by the network.


remove_network_property

public void remove_network_property(int index)
Remove a property from the network.


add_network_property

public void add_network_property(java.lang.String prop)
Add a property to the network.


check_name

public java.lang.String check_name(java.lang.String n)
Determine whether or not a name is valid and/or repeated.


validate_value

public java.lang.String validate_value(java.lang.String value)
Check whether a string is a valid name.


print_bayes_net

public void print_bayes_net(java.io.PrintStream out)
Print the QuasiBayesNet.


print_marginal

public void print_marginal(java.io.PrintStream pstream,
                           java.lang.String queried_variable,
                           boolean do_compute_clusters,
                           boolean show_bucket_tree)
Print information about a posterior marginal for the Bayesian network into the given PrintStream.

Parameters:
queried_variable - indicates the variable of interest.
show_bucket_tree - determines whether or not to present a description of the BucketTree.

reset_marginal

public void reset_marginal()
Reset the QBInference.


print_expectation

public void print_expectation(java.io.PrintStream pstream,
                              java.lang.String queried_variable,
                              boolean do_compute_clusters,
                              boolean show_bucket_tree)
Print information about a posterior expectation for the Bayesian network into the given PrintStream.

Parameters:
queried_variable - indicates the variable of interest.
show_bucket_tree - determines whether or not to present a description of the BucketTree.

reset_expectation

public void reset_expectation()
Reset the QBExpectation.


print_explanation

public void print_explanation(java.io.PrintStream pstream,
                              boolean show_bucket_tree)
Print information about an explanation for the Bayesian network into the given PrintStream.

Parameters:
show_bucket_tree - determines whether or not to present a description of the BucketTree.

print_full_explanation

public void print_full_explanation(java.io.PrintStream pstream,
                                   boolean show_bucket_tree)
Print information about a full explanation for the Bayesian network into the given PrintStream.

Parameters:
show_bucket_tree - determines whether or not to present a description of the BucketTree.

print_sensitivity_analysis

public void print_sensitivity_analysis(java.io.PrintStream pstream)
Print the metrics for sensitivity analysis of the Bayesian network into the given PrintStream.


save_bif

public void save_bif(java.io.PrintStream out)
Save the Bayesian network into a PrintStream in the BIF InterchangeFormat.


save_xml

public void save_xml(java.io.PrintStream out)
Save the Bayesian network into a PrintStream in the XML InterchangeFormat.


save_bugs

public void save_bugs(java.io.PrintStream out)
Save the Bayesian networks in BUGS format into a PrintStream.


print

public void print()
Print method for an InferenceGraph


print

public void print(java.io.PrintStream out)
Print method for an InferenceGraph


get_nodes

public java.util.Vector get_nodes()
Get the nodes in the network.


elements

public java.util.Enumeration elements()
Get the nodes in the network as an Enumeration object.


number_nodes

public int number_nodes()
Get the number of variables in the network


create_node

public void create_node(int x,
                        int y)
Create a new node in the network.


create_arc

public boolean create_arc(InferenceGraphNode parent,
                          InferenceGraphNode child)
Create an arc from parent to child.


delete_node

public void delete_node(InferenceGraphNode node)
Delete a node in the network.


delete_arc

public void delete_arc(InferenceGraphNode parent,
                       InferenceGraphNode child)
Delete the arc from parent to child.


hasCycle

public boolean hasCycle(InferenceGraphNode bottom_node,
                        InferenceGraphNode head_node)
Determines whether the connection of bottom_node to head_node would cause the network to have a cycle.


change_values

public void change_values(InferenceGraphNode node,
                          java.lang.String[] values)
Change the values of a variable. Note that, if the number of new values is different from the number of current values, this operation resets the probability values of the variable and all its children.


set_pos

public void set_pos(InferenceGraphNode node,
                    java.awt.Point position)
Set a value for the position of the node.