Examples of BayesianNetwork


Examples of org.encog.ml.bayesian.BayesianNetwork

  public final File EG_FILENAME = TEMP_DIR.createFile("encogtest.eg");
  public final File SERIAL_FILENAME = TEMP_DIR.createFile("encogtest.ser");
   
  public BayesianNetwork create()
  {
    BayesianNetwork network = new BayesianNetwork();
    BayesianEvent a = network.createEvent("a");
    BayesianEvent b = network.createEvent("b");

    network.createDependency(a, b);
    network.finalizeStructure();
    a.getTable().addLine(0.5, true); // P(A) = 0.5
    b.getTable().addLine(0.2, true, true); // p(b|a) = 0.2
    b.getTable().addLine(0.8, true, false);// p(b|~a) = 0.8   
    network.validate();
    return network;
  }
View Full Code Here

Examples of org.encog.ml.bayesian.BayesianNetwork

    Assert.assertEquals(3, network.calculateParameterCount());
  }
 
  public void testPersistEG()
  {
    BayesianNetwork network = create();

    EncogDirectoryPersistence.saveObject(EG_FILENAME, network);
    BayesianNetwork network2 = (BayesianNetwork)EncogDirectoryPersistence.loadObject(EG_FILENAME);

    validate(network2);
  }
View Full Code Here

Examples of org.encog.ml.bayesian.BayesianNetwork

    validate(network2);
  }
 
  public void testPersistSerial() throws IOException, ClassNotFoundException
  {
    BayesianNetwork network = create();
   
    SerializeObject.save(SERIAL_FILENAME, network);
    BayesianNetwork network2 = (BayesianNetwork)SerializeObject.load(SERIAL_FILENAME);
       
    validate(network2);
  }
View Full Code Here

Examples of org.encog.ml.bayesian.BayesianNetwork

   * @param output The output neuron count.
   * @return The new bayesian network.
   */
  public MLMethod create(final String architecture, final int input,
      final int output) {
    BayesianNetwork method = new BayesianNetwork();
    method.setContents(architecture);
    return method;
  }
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.