/** * Create a SQLNeuralDataSet based on the specified connection. This connection WILL NOT be closed * when the close method is called. * * @param theConnection The connection to use. * @param theSQL The SQL command to execute. * @param theInputSize The size of the input data. * @param theIdealSize The size of the ideal data. */ public SQLNeuralDataSet( final Connection theConnection, final String theSQL, final int theInputSize, final int theIdealSize) { DataSetCODEC codec = new SQLCODEC(theConnection, theSQL, theInputSize, theIdealSize); MemoryDataLoader load = new MemoryDataLoader(codec); load.setResult(this); load.external2Memory(); }
/** * Load CSV to memory. * * @param filename The CSV file to load. * @param input The input count. * @param ideal The ideal count. * @param headers True, if headers are present. * @param format The loaded dataset. * @param significance True, if there is a significance column. * @return The loaded dataset. */ public static MLDataSet loadCSV2Memory( String filename, int input, int ideal, boolean headers, CSVFormat format, boolean significance) { DataSetCODEC codec = new CSVDataCODEC(new File(filename), format, headers, input, ideal, significance); MemoryDataLoader load = new MemoryDataLoader(codec); MLDataSet dataset = load.external2Memory(); return dataset; }
/** * Construct a SQL dataset. A connection will be opened, this connection will be closed when the * close method is called. * * @param sql The SQL command to execute. * @param inputSize The size of the input data. * @param idealSize The size of the ideal data. * @param driver The driver to use. * @param url The database connection URL. * @param uid The database user id. * @param pwd The database password. */ public SQLNeuralDataSet( final String sql, final int inputSize, final int idealSize, final String driver, final String url, final String uid, final String pwd) { DataSetCODEC codec = new SQLCODEC(sql, inputSize, idealSize, driver, url, uid, pwd); MemoryDataLoader load = new MemoryDataLoader(codec); load.setResult(this); load.external2Memory(); }