Package weka.classifiers.bayes.net

Examples of weka.classifiers.bayes.net.BIFReader


   * Load bif from file.
   *
   * @param sFileName
   */
  public void loadBIFFromFile(String sFileName){
    BIFReader bayesNet = new BIFReader();
    try {
      bayesNet.processFile(sFileName);
      m_BayesNet = new EditableBayesNet(bayesNet);
      updateStatus();
        } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here


   * Set name of network in BIF file to compare with
   * @param sBIFFile the name of the BIF file
   */
  public void setBIFFile(String sBIFFile) {
    try {
      m_otherBayesNet = new BIFReader().processFile(sBIFFile);
    } catch (Throwable t) {
      m_otherBayesNet = null;
    }
  }
View Full Code Here

   * Set name of network in BIF file to compare with
   * @param sBIFFile the name of the BIF file
   */
  public void setBIFFile(String sBIFFile) {
    try {
      m_otherBayesNet = new BIFReader().processFile(sBIFFile);
    } catch (Throwable t) {
      m_otherBayesNet = null;
    }
  }
View Full Code Here

   */
  public void readBIFFromFile(String sFileName) throws BIFFormatException, IOException {
    m_sFileName = sFileName;
    try {

      BIFReader bayesNet = new BIFReader();
      bayesNet.processFile(sFileName);
      m_BayesNet = new EditableBayesNet(bayesNet);
      updateStatus();
      a_datagenerator.setEnabled(m_BayesNet.getNrOfNodes() > 0);
      m_BayesNet.clearUndoStack();
    } catch (Exception ex) {
View Full Code Here

              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);

              updateStatus();
              layoutGraph();
              a_datagenerator.setEnabled(true);
View Full Code Here

   * @param instances the instances to work with
   * @throws Exception if attribute from BIF file could not be found
   */
  public void buildStructure (BayesNet bayesNet, Instances instances) throws Exception {
    // read network structure in BIF format
    BIFReader bifReader = new BIFReader();
    bifReader.processFile(m_sBIFFile);
    // copy parent sets
        for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) {
            int iBIFAttribute = bifReader.getNode(bayesNet.getNodeName(iAttribute));
            ParentSet bifParentSet = bifReader.getParentSet(iBIFAttribute);
          for (int iBIFParent = 0; iBIFParent < bifParentSet.getNrOfParents(); iBIFParent++) {
              String sParent = bifReader.getNodeName(bifParentSet.getParent(iBIFParent));
              int iParent = 0;
              while (iParent < instances.numAttributes() && !bayesNet.getNodeName(iParent).equals(sParent)) {
                  iParent++;
              }
              if (iParent >= instances.numAttributes()) {
View Full Code Here

     * @param instances the data to use
     * @throws Exception if something goes wrong
     */
    public void buildStructure(BayesNet bayesNet, Instances instances) throws Exception {
      if (m_sInitalBIFFile != null && !m_sInitalBIFFile.equals("")) {
        BIFReader initialNet = new BIFReader().processFile(m_sInitalBIFFile);
            for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) {
              int iNode = initialNet.getNode(bayesNet.getNodeName(iAttribute));
              for (int iParent = 0; iParent < initialNet.getNrOfParents(iAttribute);iParent++) {
                String sParent = initialNet.getNodeName(initialNet.getParent(iNode, iParent));
                int nParent = 0;
                while (nParent < bayesNet.getNrOfNodes() && !bayesNet.getNodeName(nParent).equals(sParent)) {
                  nParent++;
                }
                if (nParent< bayesNet.getNrOfNodes()) {
View Full Code Here

   * Set name of network in BIF file to compare with
   * @param sBIFFile the name of the BIF file
   */
  public void setBIFFile(String sBIFFile) {
    try {
      m_otherBayesNet = new BIFReader().processFile(sBIFFile);
    } catch (Throwable t) {
      m_otherBayesNet = null;
    }
  }
View Full Code Here

TOP

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

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.