org.encog.ml.data.temporal
Class TemporalMLDataSet
- java.lang.Object
-
- org.encog.ml.data.basic.BasicMLDataSet
-
- org.encog.neural.data.basic.BasicNeuralDataSet
-
- org.encog.ml.data.temporal.TemporalMLDataSet
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<MLDataPair>, MLDataSet, NeuralDataSet
- Direct Known Subclasses:
- MarketMLDataSet
public class TemporalMLDataSet extends BasicNeuralDataSet implements java.io.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.encog.ml.data.basic.BasicMLDataSet
BasicMLDataSet.BasicMLIterator
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringADD_NOT_SUPPORTEDError message: adds are not supported.
-
Constructor Summary
Constructors Constructor and Description TemporalMLDataSet(int inputWindowSize, int predictWindowSize)Construct a dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(MLData data)Adding directly is not supported.voidadd(MLData inputData, MLData idealData)Adding directly is not supported.voidadd(MLDataPair inputData)Adding directly is not supported.voidaddDescription(TemporalDataDescription desc)Add a data description.intcalculateActualSetSize()Calculate the actual set size, this is the number of training set entries that will be generated.voidcalculateNeuronCounts()Calculate how many input and output neurons will be needed for the current data.intcalculatePointsInRange()Calculate how many points are in the high and low range.intcalculateStartIndex()Calculate the index to start at.voidclear()Clear the entire dataset.TemporalPointcreatePoint(java.util.Date when)Create a temporal point from a time.TemporalPointcreatePoint(int sequence)Create a temporal data point using a sequence number.voidgenerate()Generate the training sets.BasicNeuralDatagenerateInputNeuralData(int index)Generate input neural data for the specified index.BasicNeuralDatagenerateOutputNeuralData(int index)Generate neural ideal data for the specified index.java.util.List<TemporalDataDescription>getDescriptions()intgetDesiredSetSize()intgetHighSequence()intgetInputNeuronCount()intgetInputWindowSize()intgetLowSequence()intgetOutputNeuronCount()java.util.List<TemporalPoint>getPoints()intgetPredictWindowSize()intgetSequenceFromDate(java.util.Date when)Create a sequence number from a time.TimeUnitgetSequenceGrandularity()java.util.DategetStartingPoint()booleanisPointInRange(TemporalPoint point)Is the specified point within the range.voidsetDesiredSetSize(int desiredSetSize)voidsetHighSequence(int highSequence)voidsetInputWindowSize(int inputWindowSize)voidsetLowSequence(int lowSequence)voidsetPredictWindowSize(int predictWindowSize)voidsetSequenceGrandularity(TimeUnit sequenceGrandularity)voidsetStartingPoint(java.util.Date startingPoint)voidsortPoints()Sort the points.-
Methods inherited from class org.encog.ml.data.basic.BasicMLDataSet
clone, close, get, getData, getIdealSize, getInputSize, getRecord, getRecordCount, isSupervised, iterator, openAdditional, setData, size, toList
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.encog.ml.data.MLDataSet
close, get, getIdealSize, getInputSize, getRecord, getRecordCount, isSupervised, openAdditional, size
-
-
-
-
Field Detail
-
ADD_NOT_SUPPORTED
public static final java.lang.String ADD_NOT_SUPPORTED
Error message: adds are not supported.- See Also:
- Constant Field Values
-
-
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:
addin interfaceMLDataSet- Overrides:
addin classBasicMLDataSet- 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:
addin interfaceMLDataSet- Overrides:
addin classBasicMLDataSet- 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:
addin interfaceMLDataSet- Overrides:
addin classBasicMLDataSet- 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(java.util.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.
-
getDescriptions
public java.util.List<TemporalDataDescription> getDescriptions()
- Returns:
- A list of the data descriptions.
-
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
-
getPoints
public java.util.List<TemporalPoint> getPoints()
- Returns:
- The temporal points.
-
getPredictWindowSize
public int getPredictWindowSize()
- Returns:
- the predictWindowSize
-
getSequenceFromDate
public int getSequenceFromDate(java.util.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 java.util.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(java.util.Date startingPoint)
- Parameters:
startingPoint- the startingPoint to set
-
sortPoints
public void sortPoints()
Sort the points.
-
-
DMelt 3.0 © DataMelt by jWork.ORG