Package weka.classifiers.bayes.net

Examples of weka.classifiers.bayes.net.BayesNetGenerator


   *
   * @return the actual datagenerator
   */
  protected BayesNetGenerator getGenerator() {
    if (m_Generator == null)
      m_Generator = new BayesNetGenerator();

    return m_Generator;
  }
View Full Code Here


   * @return the format for the dataset
   * @throws Exception if the generating of the format failed
   * @see  #getSeed()
   */
  public Instances defineDataFormat() throws Exception {
    BayesNetGenerator   bng;

    bng = new BayesNetGenerator();
    bng.setOptions(getGenerator().getOptions());
    setGeneratorOption(bng, "M", "1");
    bng.generateRandomNetwork();
    bng.generateInstances();
    bng.m_Instances.renameAttribute(0, "class");
    bng.m_Instances.setRelationName(getRelationNameToUse());
   
    return bng.m_Instances;
  }
View Full Code Here

        jBtGo = new JButton("Generate Network");

        jBtGo.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            try {
              BayesNetGenerator generator = new BayesNetGenerator();
              m_BayesNet = generator;
              m_BayesNet.clearUndoStack();
             
              String[] options = new String[8];
              options[0] = "-N";
              options[1] = "" + jTfNrOfNodes.getText();
              options[2] = "-A";
              options[3] = "" + jTfNrOfArcs.getText();
              options[4] = "-C";
              options[5] = "" + jTfCardinality.getText();
              options[6] = "-S";
              options[7] = "" + jTfSeed.getText();
              generator.setOptions(options);
              generator.generateRandomNetwork();
              // Convert to EditableBayesNet
              // This ensures the getOptions() called by GenericObjectEditor to get the correct result.
              BIFReader bifReader = new BIFReader();
              bifReader.processString(m_BayesNet.toXMLBIF03());
              m_BayesNet = new EditableBayesNet(bifReader);
View Full Code Here

        jBtGo.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            try {
              String tmpfilename = "tmp.bif.file.xml";
              BayesNetGenerator generator = new BayesNetGenerator();
              String[] options = new String[4];
              options[0] = "-M";
              options[1] = "" + jTfNrOfInstances.getText();
              options[2] = "-F";
              options[3] = tmpfilename;
              FileWriter outfile = new FileWriter(tmpfilename);
              StringBuffer text = new StringBuffer();
              if (m_marginCalculator == null) {
                m_marginCalculator = new MarginCalculator();
                m_marginCalculator.calcMargins(m_BayesNet);
              }
              text.append(m_marginCalculator.toXMLBIF03());
              outfile.write(text.toString());
              outfile.close();

              generator.setOptions(options);
              generator.generateRandomNetwork();
              generator.generateInstances();
              m_Instances = generator.m_Instances;
              a_learn.setEnabled(true);
              a_learnCPT.setEnabled(true);

              m_sFile = jTfFile.getText();
View Full Code Here

   *
   * @return the actual datagenerator
   */
  protected BayesNetGenerator getGenerator() {
    if (m_Generator == null)
      m_Generator = new BayesNetGenerator();

    return m_Generator;
  }
View Full Code Here

   * @return the format for the dataset
   * @throws Exception if the generating of the format failed
   * @see  #getSeed()
   */
  public Instances defineDataFormat() throws Exception {
    BayesNetGenerator   bng;

    bng = new BayesNetGenerator();
    bng.setOptions(getGenerator().getOptions());
    setGeneratorOption(bng, "M", "1");
    bng.generateRandomNetwork();
    bng.generateInstances();
    bng.m_Instances.renameAttribute(0, "class");
    bng.m_Instances.setRelationName(getRelationNameToUse());
   
    return bng.m_Instances;
  }
View Full Code Here

TOP

Related Classes of weka.classifiers.bayes.net.BayesNetGenerator

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.