List of usage examples for weka.core.converters XRFFSaver XRFFSaver
public XRFFSaver()
From source file:adams.data.io.output.XrffSpreadSheetWriter.java
License:Open Source License
/** * Returns an instance of the file loader. * //w ww . j a v a 2s . c om * @return the file loader */ @Override protected AbstractFileSaver newSaver() { return new XRFFSaver(); }
From source file:cn.ict.zyq.bestConf.util.DataIOFile.java
License:Open Source License
/** * Save @param data to the Xrff file at @param path *//*from w w w . ja va2s . c om*/ public static void saveDataToXrffFile(String path, Instances data) throws IOException { System.out.println("\nSaving to file " + path + "..."); XRFFSaver saver = new XRFFSaver(); saver.setInstances(data); saver.setFile(new File(path)); saver.writeBatch(); }
From source file:org.openscience.cdk.applications.taverna.io.XRFFFileWriterActivity.java
License:Open Source License
@Override public void work() throws Exception { // Get input/*from ww w . jav a 2s .co m*/ List<Instances> datasets = this.getInputAsList(this.INPUT_PORTS[0], Instances.class); File targetFile = this.getInputAsFile(this.INPUT_PORTS[1]); String directory = Tools.getDirectory(targetFile); String name = Tools.getFileName(targetFile); String extension = (String) this.getConfiguration() .getAdditionalProperty(CDKTavernaConstants.PROPERTY_FILE_EXTENSION); // Do work List<String> resultFiles = new ArrayList<String>(); for (Instances instances : datasets) { File file = FileNameGenerator.getNewFile(directory, extension, name, this.iteration); try { XRFFSaver saver = new XRFFSaver(); saver.setFile(file); saver.setInstances(instances); saver.writeBatch(); } catch (Exception e) { ErrorLogger.getInstance().writeError(CDKTavernaException.WRITE_FILE_ERROR + file.getPath() + "!", this.getActivityName(), e); throw new CDKTavernaException(this.getActivityName(), CDKTavernaException.WRITE_FILE_ERROR + file.getPath() + "!"); } } // Set output this.setOutputAsStringList(resultFiles, this.OUTPUT_PORTS[0]); }