TemporalMLDataSet
org.encog.ml.data.temporal

Class TemporalMLDataSet

  • All Implemented Interfaces:
    Serializable, Iterable<MLDataPair>, MLDataSet, NeuralDataSet
    Direct Known Subclasses:
    MarketMLDataSet


    public class TemporalMLDataSetextends BasicNeuralDataSetimplements Serializable
    This class implements a temporal neural data set. A temporal neural dataset is designed to use a neural network to predict. A temporal dataset is a stream of data over a time range. This time range is broken up into "points". Each point can contain one or more values. These values are either the values that you would like to predict, or use to predict. It is possible for a value to be both predicted and used to predict. For example, if you were trying to predict a trend in a stock's price fluctuations you might very well use the security price for both. Each point that we have data for is stored in the TemporalPoint class. Each TemporalPoint will contain one more data values. These data values are described by the TemporalDataDescription class. For example, if you had five TemporalDataDescription objects added to this class, each Temporal point object would contain five values. Points are arranged by sequence number. No two points can have the same sequence numbers. Methods are provided to allow you to add points using the Date class. These dates are resolved to sequence number using the level of granularity specified for this class. No two points can occupy the same granularity increment.
    See Also:
    Serialized Form
    • Field Detail

    • Constructor Detail

      • TemporalMLDataSet

        public TemporalMLDataSet(int inputWindowSize,                 int predictWindowSize)
        Construct a dataset.
        Parameters:
        inputWindowSize - What is the input window size.
        predictWindowSize - What is the prediction window size.
    • Method Detail

      • add

        public void add(MLData data)
        Adding directly is not supported. Rather, add temporal points and generate the training data.
        Specified by:
        add in interface MLDataSet
        Overrides:
        add in class BasicMLDataSet
        Parameters:
        data - Not used.
      • add

        public void add(MLData inputData,       MLData idealData)
        Adding directly is not supported. Rather, add temporal points and generate the training data.
        Specified by:
        add in interface MLDataSet
        Overrides:
        add in class BasicMLDataSet
        Parameters:
        inputData - Not used.
        idealData - Not used.
      • add

        public void add(MLDataPair inputData)
        Adding directly is not supported. Rather, add temporal points and generate the training data.
        Specified by:
        add in interface MLDataSet
        Overrides:
        add in class BasicMLDataSet
        Parameters:
        inputData - Not used.
      • addDescription

        public void addDescription(TemporalDataDescription desc)
        Add a data description.
        Parameters:
        desc - The data description to add.
      • calculateActualSetSize

        public int calculateActualSetSize()
        Calculate the actual set size, this is the number of training set entries that will be generated.
        Returns:
        The size of the training set.
      • calculateNeuronCounts

        public void calculateNeuronCounts()
        Calculate how many input and output neurons will be needed for the current data.
      • calculatePointsInRange

        public int calculatePointsInRange()
        Calculate how many points are in the high and low range. These are the points that the training set will be generated on.
        Returns:
        The number of points.
      • calculateStartIndex

        public int calculateStartIndex()
        Calculate the index to start at.
        Returns:
        the starting index.
      • clear

        public void clear()
        Clear the entire dataset.
      • createPoint

        public TemporalPoint createPoint(Date when)
        Create a temporal point from a time. Using the granularity each date is given a unique sequence number. No two dates that fall in the same granularity should be specified.
        Parameters:
        when - The time that this point should be created at.
        Returns:
        The point TemporalPoint created.
      • createPoint

        public TemporalPoint createPoint(int sequence)
        Create a temporal data point using a sequence number. They can also be created using time. No two points should have the same sequence number.
        Parameters:
        sequence - The sequence number.
        Returns:
        A new TemporalPoint object.
      • generate

        public void generate()
        Generate the training sets.
      • generateInputNeuralData

        public BasicNeuralData generateInputNeuralData(int index)
        Generate input neural data for the specified index.
        Parameters:
        index - The index to generate neural data for.
        Returns:
        The input neural data generated.
      • generateOutputNeuralData

        public BasicNeuralData generateOutputNeuralData(int index)
        Generate neural ideal data for the specified index.
        Parameters:
        index - The index to generate for.
        Returns:
        The neural data generated.
      • getDesiredSetSize

        public int getDesiredSetSize()
        Returns:
        the desiredSetSize
      • getHighSequence

        public int getHighSequence()
        Returns:
        the highSequence
      • getInputNeuronCount

        public int getInputNeuronCount()
        Returns:
        the inputNeuronCount
      • getInputWindowSize

        public int getInputWindowSize()
        Returns:
        the inputWindowSize
      • getLowSequence

        public int getLowSequence()
        Returns:
        the lowSequence
      • getOutputNeuronCount

        public int getOutputNeuronCount()
        Returns:
        the outputNeuronCount
      • getPredictWindowSize

        public int getPredictWindowSize()
        Returns:
        the predictWindowSize
      • getSequenceFromDate

        public int getSequenceFromDate(Date when)
        Create a sequence number from a time. The first date will be zero, and subsequent dates will be increased according to the grandularity specified.
        Parameters:
        when - The date to generate the sequence number for.
        Returns:
        A sequence number.
      • getSequenceGrandularity

        public TimeUnit getSequenceGrandularity()
        Returns:
        the sequenceGrandularity
      • getStartingPoint

        public Date getStartingPoint()
        Returns:
        the startingPoint
      • isPointInRange

        public boolean isPointInRange(TemporalPoint point)
        Is the specified point within the range. If a point is in the selection range, then the point will be used to generate the training sets.
        Parameters:
        point - The point to consider.
        Returns:
        True if the point is within the range.
      • setDesiredSetSize

        public void setDesiredSetSize(int desiredSetSize)
        Parameters:
        desiredSetSize - the desiredSetSize to set
      • setHighSequence

        public void setHighSequence(int highSequence)
        Parameters:
        highSequence - the highSequence to set
      • setInputWindowSize

        public void setInputWindowSize(int inputWindowSize)
        Parameters:
        inputWindowSize - the inputWindowSize to set
      • setLowSequence

        public void setLowSequence(int lowSequence)
        Parameters:
        lowSequence - the lowSequence to set
      • setPredictWindowSize

        public void setPredictWindowSize(int predictWindowSize)
        Parameters:
        predictWindowSize - the predictWindowSize to set
      • setSequenceGrandularity

        public void setSequenceGrandularity(TimeUnit sequenceGrandularity)
        Parameters:
        sequenceGrandularity - the sequenceGrandularity to set
      • setStartingPoint

        public void setStartingPoint(Date startingPoint)
        Parameters:
        startingPoint - the startingPoint to set
      • sortPoints

        public void sortPoints()
        Sort the points.

SCaVis 1.8 © jWork.org