Package aima.core.probability.bayes

Examples of aima.core.probability.bayes.Node


    public boolean containsValue(RandomVariable rv) {
      return varIdxs.get(rv) <= extendedIdx;
    }

    public double posteriorForParents(RandomVariable rv) {
      Node n = bn.getNode(rv);
      if (!(n instanceof FiniteNode)) {
        throw new IllegalArgumentException(
            "Enumeration-Ask only works with finite Nodes.");
      }
      FiniteNode fn = (FiniteNode) n;
      Object[] vals = new Object[1 + fn.getParents().size()];
      int idx = 0;
      for (Node pn : n.getParents()) {
        vals[idx] = extendedValues[varIdxs.get(pn.getRandomVariable())];
        idx++;
      }
      vals[idx] = extendedValues[varIdxs.get(rv)];
View Full Code Here


    Set<Node> s = new LinkedHashSet<Node>();
    for (Node n : this.rootNodes) {
      walkNode(n, seenAlready, incomingEdges, s);
    }
    while (!s.isEmpty()) {
      Node n = s.iterator().next();
      s.remove(n);
      variables.add(n.getRandomVariable());
      varToNodeMap.put(n.getRandomVariable(), n);
      for (Node m : n.getChildren()) {
        List<Node> edges = incomingEdges.get(m);
        edges.remove(n);
        if (edges.isEmpty()) {
          s.add(m);
        }
View Full Code Here

  // PRIVATE METHODS
  //
  private Factor makeFactor(RandomVariable var, AssignmentProposition[] e,
      BayesianNetwork bn) {

    Node n = bn.getNode(var);
    if (!(n instanceof FiniteNode)) {
      throw new IllegalArgumentException(
          "Elimination-Ask only works with finite Nodes.");
    }
    FiniteNode fn = (FiniteNode) n;
View Full Code Here

    public boolean containsValue(RandomVariable rv) {
      return varIdxs.get(rv) <= extendedIdx;
    }

    public double posteriorForParents(RandomVariable rv) {
      Node n = bn.getNode(rv);
      if (!(n instanceof FiniteNode)) {
        throw new IllegalArgumentException(
            "Enumeration-Ask only works with finite Nodes.");
      }
      FiniteNode fn = (FiniteNode) n;
      Object[] vals = new Object[1 + fn.getParents().size()];
      int idx = 0;
      for (Node pn : n.getParents()) {
        vals[idx] = extendedValues[varIdxs.get(pn.getRandomVariable())];
        idx++;
      }
      vals[idx] = extendedValues[varIdxs.get(rv)];
View Full Code Here

    if (o == this) {
      return true;
    }

    if (o instanceof Node) {
      Node n = (Node) o;

      return getRandomVariable().equals(n.getRandomVariable());
    }

    return false;
  }
View Full Code Here

    Set<Node> s = new LinkedHashSet<Node>();
    for (Node n : this.rootNodes) {
      walkNode(n, seenAlready, incomingEdges, s);
    }
    while (!s.isEmpty()) {
      Node n = s.iterator().next();
      s.remove(n);
      variables.add(n.getRandomVariable());
      varToNodeMap.put(n.getRandomVariable(), n);
      for (Node m : n.getChildren()) {
        List<Node> edges = incomingEdges.get(m);
        edges.remove(n);
        if (edges.isEmpty()) {
          s.add(m);
        }
View Full Code Here

TOP

Related Classes of aima.core.probability.bayes.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.