Class Evidence

java.lang.Object
edu.cmu.tetrad.bayes.Evidence
All Implemented Interfaces:
TetradSerializable, Serializable

public final class Evidence extends Object implements TetradSerializable
Stores information for a variable source about evidence we have for each variable as well as whether each variable has been manipulated.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • Evidence

      public Evidence(Evidence evidence)
      Copy constructor.
      Parameters:
      evidence - a Evidence object
    • Evidence

      public Evidence(Proposition proposition)
      Wraps the proposition. The Bayes IM and manipulation will be null.
      Parameters:
      proposition - a Proposition object
    • Evidence

      public Evidence(Evidence evidence, VariableSource variableSource)

      Constructor for Evidence.

      Parameters:
      evidence - a Evidence object
      variableSource - a VariableSource object
  • Method Details

    • tautology

      public static Evidence tautology(VariableSource variableSource)

      tautology.

      Parameters:
      variableSource - a VariableSource object
      Returns:
      a Evidence object
    • serializableInstance

      public static Evidence serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a Evidence object
    • getVariableSource

      public VariableSource getVariableSource()

      getVariableSource.

      Returns:
      the Bayes IM that this is evidence for.
    • getNodeIndex

      public int getNodeIndex(String nodeName)

      getNodeIndex.

      Parameters:
      nodeName - a String object
      Returns:
      a int
    • getCategoryIndex

      public int getCategoryIndex(String nodeName, String category)

      getCategoryIndex.

      Parameters:
      nodeName - a String object
      category - a String object
      Returns:
      a int
    • getNumNodes

      public int getNumNodes()

      getNumNodes.

      Returns:
      a int
    • getNode

      public Node getNode(int nodeIndex)

      getNode.

      Parameters:
      nodeIndex - a int
      Returns:
      a Node object
    • getVariable

      public DiscreteVariable getVariable(String nodeName)

      getVariable.

      Parameters:
      nodeName - a String object
      Returns:
      a DiscreteVariable object
    • getNumCategories

      public int getNumCategories(int variable)

      getNumCategories.

      Parameters:
      variable - a int
      Returns:
      a int
    • getProposition

      public Proposition getProposition()

      Getter for the field proposition.

      Returns:
      a Proposition object
    • isManipulated

      public boolean isManipulated(int nodeIndex)

      isManipulated.

      Parameters:
      nodeIndex - a int
      Returns:
      a boolean
    • setManipulated

      public void setManipulated(int nodeIndex, boolean manipulated)

      setManipulated.

      Parameters:
      nodeIndex - a int
      manipulated - a boolean
    • toString

      public String toString()

      toString.

      Overrides:
      toString in class Object
      Returns:
      a String object
    • hasNoEvidence

      public boolean hasNoEvidence(int variable)

      hasNoEvidence.

      Parameters:
      variable - a int
      Returns:
      a boolean
    • getVariablesInEvidence

      public List<Node> getVariablesInEvidence()

      getVariablesInEvidence.

      Returns:
      the variable for which there is evidence.
    • getCategory

      public String getCategory(Node node, int j)

      getCategory.

      Parameters:
      node - a Node object
      j - a int
      Returns:
      a String object
    • isIncompatibleWith

      public boolean isIncompatibleWith(VariableSource variableSource)
      Returna true just in case this evidence has a list of variables equal to those of the given variable source.
      Parameters:
      variableSource - a VariableSource object
      Returns:
      a boolean
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()

      hashCode.

      Overrides:
      hashCode in class Object
      Returns:
      a int