This class describes one unit of input, or output, to a temporal neural network. Data can be both an input and output. Inputs are used to attempt predict the output.
 /// <summary>
 /// Add one description of the type of market data that we are seeking at
 /// each datapoint.
 /// </summary>
 /// <param name="desc"></param>
 public override void AddDescription(TemporalDataDescription desc)
 {
     if (!(desc is MarketDataDescription))
     {
         throw new MarketError(
                 "Only MarketDataDescription objects may be used "
                 + "with the MarketNeuralDataSet container.");
     }
     base.AddDescription(desc);
 }
        /// <summary>
        /// Format data according to the type specified in the description.
        /// </summary>
        /// <param name="desc">The data description.</param>
        /// <param name="index">The index to format the data at.</param>
        /// <returns>The formatted data.</returns>
        private double FormatData(TemporalDataDescription desc,
                int index)
        {
            double[] result = new double[1];

            switch (desc.DescriptionType)
            {
                case TemporalDataDescription.Type.DELTA_CHANGE:
                    result[0] = GetDataDeltaChange(desc, index);
                    break;
                case TemporalDataDescription.Type.PERCENT_CHANGE:
                    result[0] = GetDataPercentChange(desc, index);
                    break;
                case TemporalDataDescription.Type.RAW:
                    result[0] = GetDataRAW(desc, index);
                    break;
                default:
                    throw new TemporalError("Unsupported data type.");
            }

            if (desc.ActivationFunction != null)
            {
                desc.ActivationFunction.ActivationFunction(result,0,1);
            }

            return result[0];
        }
 /// <summary>
 /// Get data between two points in percent form.
 /// </summary>
 /// <param name="desc">The data description.</param>
 /// <param name="index">The index to get data from.</param>
 /// <returns>The requested data.</returns>
 private double GetDataPercentChange(TemporalDataDescription desc,
          int index)
 {
     if (index == 0)
     {
         return 0.0;
     }
     TemporalPoint point = this.points[index];
     TemporalPoint previousPoint = this.points[index - 1];
     double currentValue = point[desc.Index];
     double previousValue = previousPoint[desc.Index];
     return (currentValue - previousValue) / previousValue;
 }
 /// <summary>
 /// Get data between two points in delta form.
 /// </summary>
 /// <param name="desc">The data description.</param>
 /// <param name="index">The index to get data from.</param>
 /// <returns>The requested data.</returns>
 private double GetDataDeltaChange(TemporalDataDescription desc,
          int index)
 {
     if (index == 0)
     {
         return 0.0;
     }
     TemporalPoint point = this.points[index];
     TemporalPoint previousPoint = this.points[index - 1];
     return point[desc.Index]
             - previousPoint[desc.Index];
 }
 /// <summary>
 /// Get data between two points in raw form.
 /// </summary>
 /// <param name="desc">The data description.</param>
 /// <param name="index">The index to get data from.</param>
 /// <returns>The requested data.</returns>
 private double GetDataRAW(TemporalDataDescription desc,
          int index)
 {
     TemporalPoint point = this.points[index-1];
     return point[desc.Index];
 }
        /// <summary>
        /// Add a data description.
        /// </summary>
        /// <param name="desc">The data description to add.</param>
        public virtual void AddDescription(TemporalDataDescription desc)
        {
            if (this.points.Count > 0)
            {
                throw new TemporalError(
                        "Can't add anymore descriptions, there are "
                                + "already temporal points defined.");
            }

            int index = this.descriptions.Count;
            desc.Index = index;

            this.descriptions.Add(desc);
            CalculateNeuronCounts();
        }