|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.encog.ml.data.buffer.BufferedMLDataSet
public class BufferedMLDataSet
This class is not memory based, so very long files can be used, without running out of memory. This dataset uses a Encog binary training file as a buffer. When used with a slower access dataset, such as CSV, XML or SQL, where parsing must occur, this dataset can be used to load from the slower dataset and train at much higher speeds. This class makes use of Java file channels for maximum file access performance. If you are going to create a binary file, by using the add methods, you must call beginLoad to cause Encog to open an output file. Once the data has been loaded, call endLoad. You can also use the BinaryDataLoader class, with a CODEC, to load many other popular external formats. The binary files produced by this class are in the Encog binary training format, and can be used with any Encog platform. Encog binary files are stored using "little endian" numbers.
| Field Summary | |
|---|---|
static String |
ERROR_ADD
Error message for ADD. |
static String |
ERROR_REMOVE
Error message for REMOVE. |
| Constructor Summary | |
|---|---|
BufferedMLDataSet(File binaryFile)
Construct the dataset using the specified binary file. |
|
| Method Summary | |
|---|---|
void |
add(MLData data1)
Add only input data, for an unsupervised dataset. |
void |
add(MLData inputData,
MLData idealData)
Add both the input and ideal data. |
void |
add(MLDataPair pair)
Add a data pair of both input and ideal data. |
void |
beginLoad(int inputSize,
int idealSize)
Begin loading to the binary file. |
void |
close()
Close the dataset. |
void |
endLoad()
This method should be called once all the data has been loaded. |
MLDataPair |
get(int index)
|
EncogEGBFile |
getEGB()
|
File |
getFile()
|
int |
getIdealSize()
|
int |
getInputSize()
|
BufferedMLDataSet |
getOwner()
|
void |
getRecord(long index,
MLDataPair pair)
Read an individual record. |
long |
getRecordCount()
Determine the total number of records in the set. |
boolean |
isSupervised()
|
Iterator<MLDataPair> |
iterator()
|
void |
load(MLDataSet training)
Load the specified training set. |
MLDataSet |
loadToMemory()
Load the binary dataset to memory. |
void |
open()
Open the binary file for reading. |
BufferedMLDataSet |
openAdditional()
Opens an additional instance of this dataset. |
void |
removeAdditional(BufferedMLDataSet child)
Remove an additional dataset that was created. |
void |
setOwner(BufferedMLDataSet theOwner)
Set the owner of this dataset. |
int |
size()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ERROR_ADD
public static final String ERROR_REMOVE
| Constructor Detail |
|---|
public BufferedMLDataSet(File binaryFile)
binaryFile - The file to use.| Method Detail |
|---|
public final void open()
public final Iterator<MLDataPair> iterator()
iterator in interface Iterable<MLDataPair>public final long getRecordCount()
MLDataSet
getRecordCount in interface MLDataSet
public final void getRecord(long index,
MLDataPair pair)
getRecord in interface MLDataSetindex - The zero-based index. Specify 0 for the first record, 1 for
the second, and so on.pair - THe data to read.public final BufferedMLDataSet openAdditional()
MLDataSet
openAdditional in interface MLDataSetpublic final void add(MLData data1)
add in interface MLDataSetdata1 - The data to be added.
public final void add(MLData inputData,
MLData idealData)
add in interface MLDataSetinputData - The input data.idealData - The ideal data.public final void add(MLDataPair pair)
add in interface MLDataSetpair - The pair to add.public final void close()
close in interface MLDataSetpublic final int getIdealSize()
getIdealSize in interface MLDataSetpublic final int getInputSize()
getInputSize in interface MLDataSetpublic final boolean isSupervised()
isSupervised in interface MLDataSetpublic final BufferedMLDataSet getOwner()
public final void setOwner(BufferedMLDataSet theOwner)
theOwner - The owner.public final void removeAdditional(BufferedMLDataSet child)
child - The additional dataset to remove.
public final void beginLoad(int inputSize,
int idealSize)
inputSize - The input size.idealSize - The ideal size.public final void endLoad()
public final File getFile()
public final EncogEGBFile getEGB()
public final MLDataSet loadToMemory()
public final void load(MLDataSet training)
training - The training set to load.public int size()
size in interface MLDataSetpublic MLDataPair get(int index)
get in interface MLDataSet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||