Examples of BayesianLearner


Examples of org.integratedmodelling.riskwiz.learning.parameter.bayes.BayesianLearner

            }
     
            // 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
View Full Code Here

Examples of org.integratedmodelling.riskwiz.learning.parameter.bayes.BayesianLearner

            }
     
            // 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
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.