org.encog.ml.data.buffer.codec
Class SQLCODEC
- java.lang.Object
-
- org.encog.ml.data.buffer.codec.SQLCODEC
-
- All Implemented Interfaces:
- DataSetCODEC
public class SQLCODEC extends java.lang.Object implements DataSetCODEC
A CODEC that is designed to read data from an SQL source. This is a read-only codec.
-
-
Constructor Summary
Constructors Constructor and Description SQLCODEC(java.sql.Connection theConnection, java.lang.String theSQL, int theInputSize, int theIdealSize)Create a SQLNeuralDataSet based on the specified connection.SQLCODEC(java.lang.String theSQL, int theInputSize, int theIdealSize, java.lang.String theDriver, java.lang.String theURL, java.lang.String theUID, java.lang.String thePWD)Construct a SQL dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Close any open files.intgetFetchSize()intgetIdealSize()intgetInputSize()voidprepareRead()Prepare to read from an external data source.voidprepareWrite(int recordCount, int theInputSize, int theIdealSize)Prepare to write to an external data destination.booleanread(double[] input, double[] ideal, double[] significance)Read one record of data from an external source.voidsetFetchSize(int theFetchSize)voidwrite(double[] input, double[] ideal, double significance)Write one record of data to an external destination.
-
-
-
Constructor Detail
-
SQLCODEC
public SQLCODEC(java.sql.Connection theConnection, java.lang.String theSQL, int theInputSize, int theIdealSize)Create a SQLNeuralDataSet based on the specified connection. This connection WILL NOT be closed when the close method is called.- Parameters:
theConnection- The connection to use.theSQL- The SQL command to execute.theInputSize- The size of the input data.theIdealSize- The size of the ideal data.
-
SQLCODEC
public SQLCODEC(java.lang.String theSQL, int theInputSize, int theIdealSize, java.lang.String theDriver, java.lang.String theURL, java.lang.String theUID, java.lang.String thePWD)Construct a SQL dataset. A connection will be opened, this connection will be closed when the close method is called.- Parameters:
theSQL- The SQL command to execute.theInputSize- The size of the input data.theIdealSize- The size of the ideal data.theDriver- The driver to use.theURL- The database connection URL.theUID- The database user id.thePWD- The database password.
-
-
Method Detail
-
close
public void close()
Close any open files.- Specified by:
closein interfaceDataSetCODEC
-
getIdealSize
public int getIdealSize()
- Specified by:
getIdealSizein interfaceDataSetCODEC- Returns:
- The size of the ideal data.
-
getInputSize
public int getInputSize()
- Specified by:
getInputSizein interfaceDataSetCODEC- Returns:
- The size of the input data.
-
prepareRead
public void prepareRead()
Prepare to read from an external data source.- Specified by:
prepareReadin interfaceDataSetCODEC
-
prepareWrite
public void prepareWrite(int recordCount, int theInputSize, int theIdealSize)Prepare to write to an external data destination.- Specified by:
prepareWritein interfaceDataSetCODEC- Parameters:
recordCount- The total record count, that will be written.theInputSize- The input size.theIdealSize- The ideal size.
-
read
public boolean read(double[] input, double[] ideal, double[] significance)Read one record of data from an external source.- Specified by:
readin interfaceDataSetCODEC- Parameters:
input- The input data array.ideal- The ideal data array.significance- The significance. The first element will be modified to hold the significance.- Returns:
- True, if there is more data to be read.
-
write
public void write(double[] input, double[] ideal, double significance)Write one record of data to an external destination.- Specified by:
writein interfaceDataSetCODEC- Parameters:
input- The input data array.ideal- The ideal data array.significance- The significance (full = 1.0)
-
getFetchSize
public int getFetchSize()
- Returns:
- the fetchSize
-
setFetchSize
public void setFetchSize(int theFetchSize)
- Parameters:
theFetchSize- the fetchSize to set
-
-
DMelt 3.0 © DataMelt by jWork.ORG