Example usage for weka.core.converters Saver setFile

List of usage examples for weka.core.converters Saver setFile

Introduction

In this page you can find the example usage for weka.core.converters Saver setFile.

Prototype

void setFile(File file) throws IOException;

Source Link

Document

Sets the output file

Usage

From source file:edu.oregonstate.eecs.mcplan.abstraction.WekaUtil.java

License:Open Source License

/**
 * Save an Instances object with the specified file name. The '.arff'
 * extension is added by this function.//from  w w  w . j  a v  a 2  s .co  m
 * 
 * Adapted from:
 * http://weka.wikispaces.com/Use+WEKA+in+your+Java+code
 * @param root
 * @param filename
 * @param x
 */
public static void writeDataset(final File root, final String filename, final Instances x) {
    final File dataset_file = new File(root, filename + ".arff");
    final Saver saver = new ArffSaver();
    try {
        saver.setFile(dataset_file);
        saver.setInstances(x);
        saver.writeBatch();
    } catch (final IOException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:edu.oregonstate.eecs.mcplan.domains.blackjack.AbstractionDiscovery.java

License:Open Source License

private static void writeDataset(final File root, final Instances x) {
    final File dataset_file = new File(root, x.relationName() + ".arff");
    final Saver saver = new ArffSaver();
    try {//from   ww  w  . j  av  a  2  s .  c  o m
        saver.setFile(dataset_file);
        saver.setInstances(x);
        saver.writeBatch();
    } catch (final IOException ex) {
        throw new RuntimeException(ex);
    }
}