/** * Main method. * * @param args should contain the options of a Saver. */ public static void main(String[] args) { runFileSaver(new LibSVMSaver(), args); } }
/** * Constructor */ public LibSVMSaver() { resetOptions(); }
int writeMode = getWriteMode(); Instances structure = getInstances(); PrintWriter outW = null; if ((getRetrieval() == BATCH) || (getRetrieval() == NONE)) { throw new IOException("Batch and incremental saving cannot be mixed."); if (getWriter() != null) { outW = new PrintWriter(getWriter()); setWriteMode(CANCEL); if (inst != null) { System.err setWriteMode(STRUCTURE_READY); writeMode = getWriteMode(); cancel(); setWriteMode(WRITE); writeMode = getWriteMode(); if ((retrieveFile() == null) && (outW == null)) { System.out.println(instanceToLibsvm(inst)); } else { outW.println(instanceToLibsvm(inst)); m_incrementalCounter++;
if (getInstances() == null) { throw new IOException("No instances to save"); if (getRetrieval() == INCREMENTAL) { throw new IOException("Batch and incremental saving cannot be mixed."); setRetrieval(BATCH); setWriteMode(WRITE); if ((retrieveFile() == null) && (getWriter() == null)) { for (int i = 0; i < getInstances().numInstances(); i++) { System.out.println(instanceToLibsvm(getInstances().instance(i))); setWriteMode(WAIT); } else { PrintWriter outW = new PrintWriter(getWriter()); for (int i = 0; i < getInstances().numInstances(); i++) { outW.println(instanceToLibsvm(getInstances().instance(i))); setWriteMode(WAIT); outW = null; resetWriter(); setWriteMode(CANCEL);
/** * returns the saver used in the tests. * * @return the configured saver */ public AbstractSaver getSaver() { return new LibSVMSaver(); }
/** * returns the options of the current setup * * @return the current options */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); result.add("-c"); result.add(getClassIndex()); Collections.addAll(result, super.getOptions()); return result.toArray(new String[result.size()]); }
int writeMode = getWriteMode(); Instances structure = getInstances(); PrintWriter outW = null; if ((getRetrieval() == BATCH) || (getRetrieval() == NONE)) { throw new IOException("Batch and incremental saving cannot be mixed."); if (getWriter() != null) { outW = new PrintWriter(getWriter()); setWriteMode(CANCEL); if (inst != null) { System.err setWriteMode(STRUCTURE_READY); writeMode = getWriteMode(); cancel(); setWriteMode(WRITE); writeMode = getWriteMode(); if ((retrieveFile() == null) && (outW == null)) { System.out.println(instanceToLibsvm(inst)); } else { outW.println(instanceToLibsvm(inst)); m_incrementalCounter++;
if (getInstances() == null) { throw new IOException("No instances to save"); if (getRetrieval() == INCREMENTAL) { throw new IOException("Batch and incremental saving cannot be mixed."); setRetrieval(BATCH); setWriteMode(WRITE); if ((retrieveFile() == null) && (getWriter() == null)) { for (int i = 0; i < getInstances().numInstances(); i++) { System.out.println(instanceToLibsvm(getInstances().instance(i))); setWriteMode(WAIT); } else { PrintWriter outW = new PrintWriter(getWriter()); for (int i = 0; i < getInstances().numInstances(); i++) { outW.println(instanceToLibsvm(getInstances().instance(i))); setWriteMode(WAIT); outW = null; resetWriter(); setWriteMode(CANCEL);
/** * returns the saver used in the tests. * * @return the configured saver */ public AbstractSaver getSaver() { return new LibSVMSaver(); }
/** * returns the options of the current setup * * @return the current options */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); result.add("-c"); result.add(getClassIndex()); Collections.addAll(result, super.getOptions()); return result.toArray(new String[result.size()]); }
/** * Main method. * * @param args should contain the options of a Saver. */ public static void main(String[] args) { runFileSaver(new LibSVMSaver(), args); } }
/** * Constructor */ public LibSVMSaver() { resetOptions(); }