Example usage for weka.core.converters Saver setInstances

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

Introduction

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

Prototype

void setInstances(Instances instances);

Source Link

Document

Sets the instances to be saved

Usage

From source file:com.kdcloud.lib.rest.ext.InstancesRepresentation.java

License:Open Source License

public byte[] getBuffer() throws IOException {
    Saver saver = getSaver();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    saver.setDestination(out);//w  ww  .  jav  a 2 s  .  c o  m
    saver.setInstances(getInstances());
    saver.writeBatch();
    return out.toByteArray();
}

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.  ja  v  a2s  . c  o 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   w  w 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);
    }
}