List of usage examples for weka.core.converters Saver writeBatch
void writeBatch() throws IOException;
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 w w .ja v a 2s.c om*/ 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 .j a v a 2 s .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 {// ww w .j ava 2s .c om saver.setFile(dataset_file); saver.setInstances(x); saver.writeBatch(); } catch (final IOException ex) { throw new RuntimeException(ex); } }