Class BufferedMLDataSet

  • All Implemented Interfaces:
    Serializable, Iterable<MLDataPair>, MLDataSet

    public class BufferedMLDataSetextends Objectimplements MLDataSet, Serializable
    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.
    See Also:
    Serialized Form
    • Constructor Detail

      • BufferedMLDataSet

        public BufferedMLDataSet(File binaryFile)
        Construct the dataset using the specified binary file.
        binaryFile - The file to use.
    • Method Detail

      • open

        public void open()
        Open the binary file for reading.
      • getRecordCount

        public long getRecordCount()
        Description copied from interface: MLDataSet
        Determine the total number of records in the set.
        Specified by:
        getRecordCount in interface MLDataSet
        The record count.
      • getRecord

        public void getRecord(long index,             MLDataPair pair)
        Read an individual record.
        Specified by:
        getRecord in interface MLDataSet
        index - The zero-based index. Specify 0 for the first record, 1 for the second, and so on.
        pair - THe data to read.
      • add

        public void add(MLData data1)
        Add only input data, for an unsupervised dataset.
        Specified by:
        add in interface MLDataSet
        data1 - The data to be added.
      • add

        public void add(MLData inputData,       MLData idealData)
        Add both the input and ideal data.
        Specified by:
        add in interface MLDataSet
        inputData - The input data.
        idealData - The ideal data.
      • add

        public void add(MLDataPair pair)
        Add a data pair of both input and ideal data.
        Specified by:
        add in interface MLDataSet
        pair - The pair to add.
      • close

        public void close()
        Close the dataset.
        Specified by:
        close in interface MLDataSet
      • getIdealSize

        public int getIdealSize()
        Specified by:
        getIdealSize in interface MLDataSet
        The ideal data size.
      • getInputSize

        public int getInputSize()
        Specified by:
        getInputSize in interface MLDataSet
        The input data size.
      • isSupervised

        public boolean isSupervised()
        Specified by:
        isSupervised in interface MLDataSet
        True if this dataset is supervised.
      • getOwner

        public BufferedMLDataSet getOwner()
        If this dataset was created by openAdditional, the set that created this object is the owner. Return the owner.
      • setOwner

        public void setOwner(BufferedMLDataSet theOwner)
        Set the owner of this dataset.
        theOwner - The owner.
      • removeAdditional

        public void removeAdditional(BufferedMLDataSet child)
        Remove an additional dataset that was created.
        child - The additional dataset to remove.
      • beginLoad

        public void beginLoad(int inputSize,             int idealSize)
        Begin loading to the binary file. After calling this method the add methods may be called.
        inputSize - The input size.
        idealSize - The ideal size.
      • endLoad

        public void endLoad()
        This method should be called once all the data has been loaded. The underlying file will be closed. The binary fill will then be opened for reading.
      • getFile

        public File getFile()
        The binary file used.
      • getEGB

        public EncogEGBFile getEGB()
        The EGB file to use.
      • loadToMemory

        public MLDataSet loadToMemory()
        Load the binary dataset to memory. Memory access is faster.
        A memory dataset.
      • load

        public void load(MLDataSet training)
        Load the specified training set.
        training - The training set to load.
      • size

        public int size()
        Specified by:
        size in interface MLDataSet

SCaVis 1.8 © jWork.org