Package weka.core.converters

Examples of weka.core.converters.ArffSaver


        LibSVM cModel = new LibSVM();
        try {
            cModel.buildClassifier(trainingSet);
            saveTheModel(cModel, maxNumFeats);
            ArffSaver saver = new ArffSaver();
            saver.setInstances(trainingSet);
            saver.setFile(new File(PropertiesGetter.getProperty("TrainingDataSetObject")));
            saver.writeBatch();
        } catch (Exception ex) {
            Logger.getLogger(WekaWrapper.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println(ex.toString());
        }
    }
View Full Code Here


   *
   * @param strFile 
   * @param dataSet the data set
   */
  public void saveWekaFile(String strFile, Instances dataSet) { 
    ArffSaver saver = new ArffSaver();
    saver.setInstances(dataSet);
    try {
      saver.setFile(new File(strFile));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    try {
      saver.writeBatch();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

        Integer run, Integer fold) throws IOException {
      Instances inst = initializeInstances(sparseData, sortedMap, train,
          label, run, fold);
      String filename = FileUtil.getDataFilePrefix(outdir, label, run,
          fold, train) + ".arff";
      ArffSaver saver = new ArffSaver();
      saver.setDestination(new File(filename));
      saver.setFile(new File(filename));
      saver.setInstances(inst);
      saver.writeBatch();
    }
View Full Code Here

              m_sFile = jTfFile.getText();
              if (m_sFile != null && !m_sFile.equals("")) {
                AbstractFileSaver saver = ConverterUtils.getSaverForFile(m_sFile);
                // no idea what the format is, so let's save it as ARFF file
                if (saver == null)
                  saver = new ArffSaver();
                saver.setFile(new File(m_sFile));
                saver.setInstances(m_Instances);
                saver.writeBatch();
              }
View Full Code Here

      buffer.append("Table Name: " + databaseSaver.getTableName() + "\n");
      buffer.append("Relation For Table Name: " + databaseSaver.getRelationForTableName() + "\n");
      buffer.append("Auto Key Generation: " + databaseSaver.getAutoKeyGeneration() + "\n");       
    }     
    else if(className.equalsIgnoreCase(ArffSaver.class.getName())) {
      ArffSaver arffSaver = (ArffSaver)saver.getSaver();
      buffer.append("  Loader type: ArffSaver" + "\n");       
    }
    else if(className.equalsIgnoreCase(CSVSaver.class.getName())) {
      CSVSaver csvSaver = (CSVSaver)saver.getSaver();
      buffer.append("  Loader type: CSVLoader" + "\n");
View Full Code Here

       
        if( env.getOutConnection() != null ) {
          databaseSaver.setDestination(env.getOutConnection());
        }
      } else if(className.equalsIgnoreCase(ArffSaver.class.getName())) {
        ArffSaver arffSaver = (ArffSaver)saver.getSaver();       
        // setup operation goes here     
      }
    }
    logger.debug("OUT");
  }
View Full Code Here

     *            The file to which to write the instances
     * @throws IOException
     *             If instances object can not be written
     */
    public static void writeInstances(Instances instances, String outFile) throws IOException {
        ArffSaver saver = new ArffSaver();
        saver.setInstances(instances);
        saver.setFile(new File(outFile));
        saver.writeBatch();
    }
View Full Code Here

    }

    public static void toArff(Instances data, String arffFileName) throws IOException {
        System.out.println("Saving dataset as ARFF");
        // save ARFF
        ArffSaver saver = new ArffSaver();
        saver.setInstances(data);
        saver.setFile(new File(arffFileName));
        //saver.setDestination(new File(args[1]));
        saver.writeBatch();
    }
View Full Code Here

              m_sFile = jTfFile.getText();
              if (m_sFile != null && !m_sFile.equals("")) {
                AbstractFileSaver saver = ConverterUtils.getSaverForFile(m_sFile);
                // no idea what the format is, so let's save it as ARFF file
                if (saver == null)
                  saver = new ArffSaver();
                saver.setFile(new File(m_sFile));
                saver.setInstances(m_Instances);
                saver.writeBatch();
              }
View Full Code Here

    public void run() throws Exception {

        // writes data to a temporary file - this converts data to the ARFF format, which can then be parsed
        // sequentially to yield the instances for each attribute
        ArffSaver saver = new ArffSaver();
        saver.setInstances(data);
        saver.setFile(new File("Ranker_tempDataFileCopy.arff"));
        saver.writeBatch();

        // initialize reader for train and test files
        BufferedReader trainInput = new BufferedReader(new FileReader("Ranker_tempDataFileCopy.arff"));
        int linePos = 0;
View Full Code Here

TOP

Related Classes of weka.core.converters.ArffSaver

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.