Examples of FiniteNode


Examples of aima.core.probability.bayes.FiniteNode

    return new BayesNet(dice1, dice2);
  }

  public static BayesianNetwork constructToothacheCavityCatchNetwork() {
    FiniteNode cavity = new FullCPTNode(ExampleRV.CAVITY_RV, new double[] {
        0.2, 0.8 });
    @SuppressWarnings("unused")
    FiniteNode toothache = new FullCPTNode(ExampleRV.TOOTHACHE_RV,
        new double[] {
            // C=true, T=true
            0.6,
            // C=true, T=false
            0.4,
            // C=false, T=true
            0.1,
            // C=false, T=false
            0.9

        }, cavity);
    @SuppressWarnings("unused")
    FiniteNode catchN = new FullCPTNode(ExampleRV.CATCH_RV, new double[] {
        // C=true, Catch=true
        0.9,
        // C=true, Catch=false
        0.1,
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

    return new BayesNet(cavity);
  }

  public static BayesianNetwork constructToothacheCavityCatchWeatherNetwork() {
    FiniteNode cavity = new FullCPTNode(ExampleRV.CAVITY_RV, new double[] {
        0.2, 0.8 });
    @SuppressWarnings("unused")
    FiniteNode toothache = new FullCPTNode(ExampleRV.TOOTHACHE_RV,
        new double[] {
            // C=true, T=true
            0.6,
            // C=true, T=false
            0.4,
            // C=false, T=true
            0.1,
            // C=false, T=false
            0.9

        }, cavity);
    @SuppressWarnings("unused")
    FiniteNode catchN = new FullCPTNode(ExampleRV.CATCH_RV, new double[] {
        // C=true, Catch=true
        0.9,
        // C=true, Catch=false
        0.1,
        // C=false, Catch=true
        0.2,
        // C=false, Catch=false
        0.8 }, cavity);
    FiniteNode weather = new FullCPTNode(ExampleRV.WEATHER_RV,
        new double[] {
            // sunny
            0.6,
            // rain
            0.1,
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

    return new BayesNet(cavity, weather);
  }

  public static BayesianNetwork constructMeningitisStiffNeckNetwork() {
    FiniteNode meningitis = new FullCPTNode(ExampleRV.MENINGITIS_RV,
        new double[] { 1.0 / 50000.0, 1.0 - (1.0 / 50000.0) });
    @SuppressWarnings("unused")
    FiniteNode stiffneck = new FullCPTNode(ExampleRV.STIFF_NECK_RV,
        new double[] {
            // M=true, S=true
            0.7,
            // M=true, S=false
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

        }, meningitis);
    return new BayesNet(meningitis);
  }

  public static BayesianNetwork constructBurglaryAlarmNetwork() {
    FiniteNode burglary = new FullCPTNode(ExampleRV.BURGLARY_RV,
        new double[] { 0.001, 0.999 });
    FiniteNode earthquake = new FullCPTNode(ExampleRV.EARTHQUAKE_RV,
        new double[] { 0.002, 0.998 });
    FiniteNode alarm = new FullCPTNode(ExampleRV.ALARM_RV, new double[] {
        // B=true, E=true, A=true
        0.95,
        // B=true, E=true, A=false
        0.05,
        // B=true, E=false, A=true
        0.94,
        // B=true, E=false, A=false
        0.06,
        // B=false, E=true, A=true
        0.29,
        // B=false, E=true, A=false
        0.71,
        // B=false, E=false, A=true
        0.001,
        // B=false, E=false, A=false
        0.999 }, burglary, earthquake);
    @SuppressWarnings("unused")
    FiniteNode johnCalls = new FullCPTNode(ExampleRV.JOHN_CALLS_RV,
        new double[] {
            // A=true, J=true
            0.90,
            // A=true, J=false
            0.10,
            // A=false, J=true
            0.05,
            // A=false, J=false
            0.95 }, alarm);
    @SuppressWarnings("unused")
    FiniteNode maryCalls = new FullCPTNode(ExampleRV.MARY_CALLS_RV,
        new double[] {
            // A=true, M=true
            0.70,
            // A=true, M=false
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

    return new BayesNet(burglary, earthquake);
  }

  public static BayesianNetwork constructCloudySprinklerRainWetGrassNetwork() {
    FiniteNode cloudy = new FullCPTNode(ExampleRV.CLOUDY_RV, new double[] {
        0.5, 0.5 });
    FiniteNode sprinkler = new FullCPTNode(ExampleRV.SPRINKLER_RV,
        new double[] {
            // Cloudy=true, Sprinkler=true
            0.1,
            // Cloudy=true, Sprinkler=false
            0.9,
            // Cloudy=false, Sprinkler=true
            0.5,
            // Cloudy=false, Sprinkler=false
            0.5 }, cloudy);
    FiniteNode rain = new FullCPTNode(ExampleRV.RAIN_RV, new double[] {
        // Cloudy=true, Rain=true
        0.8,
        // Cloudy=true, Rain=false
        0.2,
        // Cloudy=false, Rain=true
        0.2,
        // Cloudy=false, Rain=false
        0.8 }, cloudy);
    @SuppressWarnings("unused")
    FiniteNode wetGrass = new FullCPTNode(ExampleRV.WET_GRASS_RV,
        new double[] {
            // Sprinkler=true, Rain=true, WetGrass=true
            .99,
            // Sprinkler=true, Rain=true, WetGrass=false
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

    Node n = bn.getNode(var);
    if (!(n instanceof FiniteNode)) {
      throw new IllegalArgumentException(
          "Elimination-Ask only works with finite Nodes.");
    }
    FiniteNode fn = (FiniteNode) n;
    List<AssignmentProposition> evidence = new ArrayList<AssignmentProposition>();
    for (AssignmentProposition ap : e) {
      if (fn.getCPT().contains(ap.getTermVariable())) {
        evidence.add(ap);
      }
    }

    return fn.getCPT().getFactorFor(
        evidence.toArray(new AssignmentProposition[evidence.size()]));
  }
View Full Code Here

Examples of aima.core.probability.bayes.FiniteNode

      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)];

      return fn.getCPT().getValue(vals);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.