Package weka.core.converters

Examples of weka.core.converters.ArffSaver.writeBatch()


            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


    } catch (IOException e) {
      e.printStackTrace();
    }
   
    try {
      saver.writeBatch();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
 
View Full Code Here

          fold, train) + ".arff";
      ArffSaver saver = new ArffSaver();
      saver.setDestination(new File(filename));
      saver.setFile(new File(filename));
      saver.setInstances(inst);
      saver.writeBatch();
    }

    /**
     * initialize attributes
     *
 
View Full Code Here

     */
    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

        // save ARFF
        ArffSaver saver = new ArffSaver();
        saver.setInstances(data);
        saver.setFile(new File(arffFileName));
        //saver.setDestination(new File(args[1]));
        saver.writeBatch();
    }

    public static void convert(String csvFileName, String arffFileName) throws IOException {
        toArff(load(csvFileName), arffFileName);
    }
View Full Code Here

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

    public void saveFile() throws Exception{
            ArffSaver saverLearn = new ArffSaver();
            saverLearn.setInstances(learnFinal);
            saverLearn.setFile(new File(learnPostSelectionFileName));
            saverLearn.writeBatch();

            ArffSaver saverHold = new ArffSaver();
            saverHold.setInstances(holdFinal);
            saverHold.setFile(new File(holdPostSelectionFileName));
            saverHold.writeBatch();
View Full Code Here

            saverLearn.writeBatch();

            ArffSaver saverHold = new ArffSaver();
            saverHold.setInstances(holdFinal);
            saverHold.setFile(new File(holdPostSelectionFileName));
            saverHold.writeBatch();
    }

    private static String getExtension(String s) {

        String ext = null;
View Full Code Here

            String big_fileName = fileName.substring(0, 1+fileName.lastIndexOf("\\")).concat("learn_").concat(fileName.substring(1+fileName.lastIndexOf("\\"), fileName.length()));

            ArffSaver saverSmall = new ArffSaver();
            saverSmall.setInstances(smallSet);
            saverSmall.setFile(new File(small_fileName));
            saverSmall.writeBatch();
           
            ArffSaver saverBig = new ArffSaver();
            saverBig.setInstances(bigSet);
            saverBig.setFile(new File(big_fileName));
            saverBig.writeBatch();
View Full Code Here

            saverSmall.writeBatch();
           
            ArffSaver saverBig = new ArffSaver();
            saverBig.setInstances(bigSet);
            saverBig.setFile(new File(big_fileName));
            saverBig.writeBatch();

            return big_fileName.concat(";").concat(small_fileName);

        } catch (Exception e) {
            System.out.println(e.toString());
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.