Package org.integratedmodelling.riskwiz.inference.ls

Examples of org.integratedmodelling.riskwiz.inference.ls.JoinTreeCompiler


    
        JTInference inference = new JTInference();

        try {
            inference.initialize(bn, new JoinTreeCompiler());
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        inference.run();
View Full Code Here


            JTInference inference = new JTInference();

            // JTCompilerDebugger deb = new JTCompilerDebugger();
            // deb.doAll();
     
            inference.initialize(network, new JoinTreeCompiler());
            inference.run();
      
            Set<BNNode> nodes = network.vertexSet();

            for (BNNode node : nodes) {
View Full Code Here

            JTInference inference = new JTInference();

            // JTCompilerDebugger deb = new JTCompilerDebugger();
            // deb.doAll();

            inference.initialize(network, new JoinTreeCompiler());
            inference.run();

            Set<BNNode> nodes = network.vertexSet();

            for (BNNode node : nodes) {
View Full Code Here

            BeliefNetwork bn = r.load(new FileInputStream("examples/water.xdsl"));
            // BeliefNetwork bn =rb.load(new FileInputStream("examples/sprinkler.xml"));

            JTInference inference = new JTInference();

            inference.initialize(bn, new JoinTreeCompiler());
            // inference.setObservation("Cloudy", "true");
            inference.run();
       
            for (BNNode n : bn.vertexSet()) {
                System.out.println(n.getName() + ": " + n.getMarginal());
View Full Code Here

            }
   
            // run inference
            JTInference inference = new JTInference();

            inference.initialize(network, new JoinTreeCompiler());
            inference.run();

            // output inference results
            System.out.println("Marginals of original network\n");
            for (BNNode node : nodes) {
                System.out.println(
                        node.getName() + ":\n" + node.getMarginal().toString()
                        + "\n");
            }
     
            // learning starts here
     
            // create a new learner
            BayesianLearner learner = new BayesianLearner();

            // you need to initialize the link between the learner and network
            // this initialization will clear existing
            // probability tables from the network and set up uniform Dirichlet priors
            learner.initialize(network);
     
            // System.out.println("CPTs Before Learning \n");
            //
            // for (BeliefNode node : nodes) {
            // System.out.println(node.getName() + ":\n"
            // + node.getTable().toString() + "\n");
            // }
     
            // create a new data source for the learner
     
            GraphDataFile graphData = new GraphDataFile();
     
            // now, populate the data source, in this case from file
            graphData.readArff(dataFile);
     
            // you need to connect it too, which will help
            // the instance IGraphData to understand how to
            // format dta so that they fit the network
            // graphData.connect(network);
     
            // finally, learn!
            learner.learnFromTable(graphData);
     
            inference = new JTInference();
            inference.initialize(network, new JoinTreeCompiler());
            inference.run();
            // now, show the probabilities again
            // nodes = network.vertexSet();
            System.out.println("CPTs after learning\n");
            nodes = network.vertexSet();
View Full Code Here

            }
   
            // run inference
            JTInference inference = new JTInference();

            inference.initialize(network, new JoinTreeCompiler());
            inference.run();

            // output inference results
            System.out.println("Marginals of original network\n");
            for (BNNode node : nodes) {
                System.out.println(
                        node.getName() + ":\n" + node.getMarginal().toString()
                        + "\n");
            }
     
            // learning starts here
     
            // create a new learner
            BayesianLearner learner = new BayesianLearner();

            // you need to initialize the link between the learner and network
            // this initialization will clear existing
            // probability tables from the network and set up uniform Dirichlet priors
            learner.initializeWithPriors(network, NofVirtualSamples);
     
            System.out.println("CPTs Before Learning \n");
      
            for (BNNode node : nodes) {
                System.out.println(
                        node.getName() + ":\n" + node.getFunction().toString()
                        + "\n");
            }
     
            // create a new data source for the learner
     
            GraphDataFile graphData = new GraphDataFile();
     
            // now, populate the data source, in this case from file
            graphData.readArff(dataFile);
     
            // you need to connect it too, which will help
            // the instance IGraphData to understand how to
            // format dta so that they fit the network
            graphData.connect(network);
     
            // finally, learn!
            learner.learnFromTable(graphData);
     
            inference = new JTInference();
            inference.initialize(network, new JoinTreeCompiler());
            inference.run();
            // now, show the probabilities again
            // nodes = network.vertexSet();
            System.out.println("CPTs after learning\n");
            nodes = network.vertexSet();
View Full Code Here

            JTInference inference = new JTInference();
            JTCompilerDebugger deb = new JTCompilerDebugger();

            deb.doAll();
     
            inference.initialize(network, new JoinTreeCompiler(), deb);
            inference.run();

            // output inference results

            Set<BNNode> nodes = network.vertexSet();
View Full Code Here

        JTCompilerDebugger deb = new JTCompilerDebugger();

        deb.doAll();
     
        try {
            inference.initialize(network, new JoinTreeCompiler(), deb);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        inference.run();
View Full Code Here

        JTCompilerDebugger deb = new JTCompilerDebugger();

        deb.doAll();
     
        try {
            inference.initialize(network, new JoinTreeCompiler(), deb);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Set<BNNode> nodes = network.vertexSet();
View Full Code Here

            JTInference inference = new JTInference();
            JTCompilerDebugger deb = new JTCompilerDebugger();

            deb.doAll();
     
            inference.initialize(network, new JoinTreeCompiler(), deb);
            BNNode node1;

            node1 = network.getBeliefNode("Cloudy");
     
            // alternative way to set observation, it should work for more general
View Full Code Here

TOP

Related Classes of org.integratedmodelling.riskwiz.inference.ls.JoinTreeCompiler

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.