Package aima.core.probability.bayes.approx

Examples of aima.core.probability.bayes.approx.LikelihoodWeighting


    System.out.println("DEMO: Bayes Likelihood Weighting N = "
        + NUM_SAMPLES);
    System.out.println("================================");
    demoToothacheCavityCatchModel(new FiniteBayesModel(
        BayesNetExampleFactory.constructToothacheCavityCatchNetwork(),
        new BayesInferenceApproxAdapter(new LikelihoodWeighting(),
            NUM_SAMPLES)));
    demoBurglaryAlarmModel(new FiniteBayesModel(
        BayesNetExampleFactory.constructBurglaryAlarmNetwork(),
        new BayesInferenceApproxAdapter(new LikelihoodWeighting(),
            NUM_SAMPLES)));
    System.out.println("================================");
  }
View Full Code Here


    AssignmentProposition[] e = new AssignmentProposition[] { new AssignmentProposition(
        ExampleRV.SPRINKLER_RV, Boolean.TRUE) };
    MockRandomizer r = new MockRandomizer(
        new double[] { 0.5, 0.5, 0.5, 0.5 });

    LikelihoodWeighting lw = new LikelihoodWeighting(r);

    double[] estimate = lw.likelihoodWeighting(
        new RandomVariable[] { ExampleRV.RAIN_RV }, e, bn, 1000)
        .getValues();

    Assert.assertArrayEquals(new double[] { 1.0, 0.0 }, estimate,
        DELTA_THRESHOLD);
View Full Code Here

    // sample P(Sprinkler | Cloudy = true) = <0.1, 0.9>; suppose
    // Sprinkler=false
    // sample P(Rain | Cloudy = true) = <0.8, 0.2>; suppose Rain=true
    MockRandomizer r = new MockRandomizer(new double[] { 0.5, 0.5 });

    LikelihoodWeighting lw = new LikelihoodWeighting(r);
    double[] estimate = lw.likelihoodWeighting(
        new RandomVariable[] { ExampleRV.RAIN_RV }, e, bn, 1)
        .getValues();

    // Here the event [true,false,true,true] should have weight 0.45,
    // and this is tallied under Rain = true, which when normalized
View Full Code Here

TOP

Related Classes of aima.core.probability.bayes.approx.LikelihoodWeighting

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.