Inheritance: ITrainFlatNetwork
Beispiel #1
0
        /// <summary>
        /// Construct a gradient worker.
        /// </summary>
        ///
        /// <param name="theNetwork">The network to train.</param>
        /// <param name="theOwner">The owner that is doing the training.</param>
        /// <param name="theTraining">The training data.</param>
        /// <param name="theLow">The low index to use in the training data.</param>
        /// <param name="theHigh">The high index to use in the training data.</param>
        /// <param name="theFlatSpots">Holds an array of flat spot constants.</param>
        public GradientWorker(FlatNetwork theNetwork,
                              TrainFlatNetworkProp theOwner, IMLDataSet theTraining,
                              int theLow, int theHigh, double[] theFlatSpots, IErrorFunction ef)
        {
            _errorCalculation = new ErrorCalculation();
            _network          = theNetwork;
            _training         = theTraining;
            _low      = theLow;
            _high     = theHigh;
            _owner    = theOwner;
            _flatSpot = theFlatSpots;

            _layerDelta = new double[_network.LayerOutput.Length];
            _gradients  = new double[_network.Weights.Length];
            _actual     = new double[_network.OutputCount];

            _weights         = _network.Weights;
            _layerIndex      = _network.LayerIndex;
            _layerCounts     = _network.LayerCounts;
            _weightIndex     = _network.WeightIndex;
            _layerOutput     = _network.LayerOutput;
            _layerSums       = _network.LayerSums;
            _layerFeedCounts = _network.LayerFeedCounts;
            _ef = ef;

            _pair = BasicMLDataPair.CreatePair(_network.InputCount,
                                               _network.OutputCount);
        }
Beispiel #2
0
 public GradientWorker(FlatNetwork theNetwork, TrainFlatNetworkProp theOwner, IMLDataSet theTraining, int theLow, int theHigh, double[] theFlatSpots, IErrorFunction ef)
 {
     goto Label_0155;
     Label_0114:
     this._x071bde1041617fce = theOwner;
     this._x0ba854627e1326f9 = theFlatSpots;
     this._x58c3d5da5c5c72db = new double[this._x87a7fc6a72741c2e.LayerOutput.Length];
     this._xe05127febf8b7904 = new double[this._x87a7fc6a72741c2e.Weights.Length];
     this._xd505507cf33ae543 = new double[this._x87a7fc6a72741c2e.OutputCount];
     if (0 == 0)
     {
         this._x2f33d779e5a20b28 = this._x87a7fc6a72741c2e.Weights;
         if ((((uint) theHigh) + ((uint) theLow)) <= uint.MaxValue)
         {
             this._xb25095f37f20a1c1 = this._x87a7fc6a72741c2e.LayerIndex;
             if (((uint) theLow) <= uint.MaxValue)
             {
                 this._xe05f7b8f952f0ba4 = this._x87a7fc6a72741c2e.LayerCounts;
                 this._x7d5bf19d36074a85 = this._x87a7fc6a72741c2e.WeightIndex;
                 this._x5e72e5e601f79c78 = this._x87a7fc6a72741c2e.LayerOutput;
                 this._x59e01312f2f4aa96 = this._x87a7fc6a72741c2e.LayerSums;
                 this._xc99b49dd213196ca = this._x87a7fc6a72741c2e.LayerFeedCounts;
                 this._x2cb049236d33bbda = ef;
             }
         }
     }
     this._x61830ac74d65acc3 = BasicMLDataPair.CreatePair(this._x87a7fc6a72741c2e.InputCount, this._x87a7fc6a72741c2e.OutputCount);
     if (0 == 0)
     {
         return;
     }
     Label_0155:
     this._x84e81691256999b2 = new ErrorCalculation();
     this._x87a7fc6a72741c2e = theNetwork;
     this._x823a2b9c8bf459c5 = theTraining;
     if (0xff == 0)
     {
         return;
     }
     do
     {
         if ((((uint) theHigh) + ((uint) theLow)) > uint.MaxValue)
         {
             goto Label_0114;
         }
         this._xd12d1dba8a023d95 = theLow;
     }
     while (0 != 0);
     this._x628ea9b89457a2a9 = theHigh;
     goto Label_0114;
 }
        /// <summary>
        /// Construct a gradient worker.
        /// </summary>
        ///
        /// <param name="theNetwork">The network to train.</param>
        /// <param name="theOwner">The owner that is doing the training.</param>
        /// <param name="theTraining">The training data.</param>
        /// <param name="theLow">The low index to use in the training data.</param>
        /// <param name="theHigh">The high index to use in the training data.</param>
        /// <param name="theFlatSpots">Holds an array of flat spot constants.</param>
        public GradientWorker(FlatNetwork theNetwork,
                                 TrainFlatNetworkProp theOwner, IMLDataSet theTraining,
                                 int theLow, int theHigh, double[] theFlatSpots, IErrorFunction ef)
        {
            _errorCalculation = new ErrorCalculation();
            _network = theNetwork;
            _training = theTraining;
            _low = theLow;
            _high = theHigh;
            _owner = theOwner;
            _flatSpot = theFlatSpots;

            _layerDelta = new double[_network.LayerOutput.Length];
            _gradients = new double[_network.Weights.Length];
            _actual = new double[_network.OutputCount];

            _weights = _network.Weights;
            _layerIndex = _network.LayerIndex;
            _layerCounts = _network.LayerCounts;
            _weightIndex = _network.WeightIndex;
            _layerOutput = _network.LayerOutput;
            _layerSums = _network.LayerSums;
            _layerFeedCounts = _network.LayerFeedCounts;
            _ef = ef;

            _pair = BasicMLDataPair.CreatePair(_network.InputCount,
                                              _network.OutputCount);
        }