/** * Main method. * * @param args should contain the name of an input file. */ public static void main(String[] args) { runFileLoader(new LibSVMLoader(), args); } }
/** * Gets all the file extensions used for this type of file. * * @return the file extensions */ @Override public String[] getFileExtensions() { return new String[] { getFileExtension() }; }
/** * determines the number of attributes, if the number of attributes in the * given row is greater than the current amount then this number will be * returned, otherwise the current number. * * @param row row to determine the number of attributes from * @param num the current number of attributes * @return the new number of attributes */ protected int determineNumAttributes(String row, int num) { int result; int count; result = num; count = libsvmToArray(row).length; if (count > result) { result = count; } return result; }
/** * Resets the Loader object and sets the source of the data set to be the * supplied url. * * @param url the source url. * @throws IOException if an error occurs */ public void setSource(URL url) throws IOException { m_structure = null; m_Buffer = null; setRetrieval(NONE); setSource(url.openStream()); m_URL = url.toString(); }
/** * Resets the Loader ready to read a new data set. * * @throws IOException if something goes wrong */ @Override public void reset() throws IOException { m_structure = null; m_Buffer = null; setRetrieval(NONE); if ((m_File != null) && (new File(m_File)).isFile()) { setFile(new File(m_File)); } else if ((m_URL != null) && !m_URL.equals("http://")) { setURL(m_URL); } }
if (getRetrieval() == INCREMENTAL) { throw new IOException( "Cannot mix getting Instances in both incremental and batch modes"); setRetrieval(BATCH); if (m_structure == null) { getStructure();
/** * returns the loader used in the tests. * * @return the configured loader */ public AbstractLoader getLoader() { return new LibSVMLoader(); }
line = lines[j]; m_Buffer.add(libsvmToArray(line)); numAtt = determineNumAttributes(line, numAtt); m_Buffer.add(libsvmToArray(oldLine)); numAtt = determineNumAttributes(oldLine, numAtt);
/** * Set the url to load from. * * @param url the url to load from * @throws IOException if the url can't be set. */ @Override public void setURL(String url) throws IOException { m_URL = url; setSource(new URL(url)); }
/** * Resets the Loader ready to read a new data set. * * @throws IOException if something goes wrong */ @Override public void reset() throws IOException { m_structure = null; m_Buffer = null; setRetrieval(NONE); if ((m_File != null) && (new File(m_File)).isFile()) { setFile(new File(m_File)); } else if ((m_URL != null) && !m_URL.equals("http://")) { setURL(m_URL); } }
if (getRetrieval() == INCREMENTAL) { throw new IOException( "Cannot mix getting Instances in both incremental and batch modes"); setRetrieval(BATCH); if (m_structure == null) { getStructure();
/** * returns the loader used in the tests. * * @return the configured loader */ public AbstractLoader getLoader() { return new LibSVMLoader(); }
/** * Resets the Loader object and sets the source of the data set to be the * supplied url. * * @param url the source url. * @throws IOException if an error occurs */ public void setSource(URL url) throws IOException { m_structure = null; m_Buffer = null; setRetrieval(NONE); setSource(url.openStream()); m_URL = url.toString(); }
line = lines[j]; m_Buffer.add(libsvmToArray(line)); numAtt = determineNumAttributes(line, numAtt); m_Buffer.add(libsvmToArray(oldLine)); numAtt = determineNumAttributes(oldLine, numAtt);
/** * Set the url to load from. * * @param url the url to load from * @throws IOException if the url can't be set. */ @Override public void setURL(String url) throws IOException { m_URL = url; setSource(new URL(url)); }
/** * Main method. * * @param args should contain the name of an input file. */ public static void main(String[] args) { runFileLoader(new LibSVMLoader(), args); } }
/** * Gets all the file extensions used for this type of file. * * @return the file extensions */ @Override public String[] getFileExtensions() { return new String[] { getFileExtension() }; }
/** * determines the number of attributes, if the number of attributes in the * given row is greater than the current amount then this number will be * returned, otherwise the current number. * * @param row row to determine the number of attributes from * @param num the current number of attributes * @return the new number of attributes */ protected int determineNumAttributes(String row, int num) { int result; int count; result = num; count = libsvmToArray(row).length; if (count > result) { result = count; } return result; }