Accord.Neuro.Learning.DeepNeuralNetworkLearning.GetLayerInput C# (CSharp) Method

GetLayerInput() public method

Gets the learning data needed to train the currently selected layer. The return of this function should then be passed to RunEpoch(double[][], double[][]) to actually run a learning epoch.
public GetLayerInput ( double input ) : double[][]
input double The batch of input data.
return double[][]
        public double[][] GetLayerInput(double[][] input)
        {
            return GetLayerInput(new[] { input })[0];
        }

Same methods

DeepNeuralNetworkLearning::GetLayerInput ( double batches ) : double[][][]

Usage Example

Example #1
0
        public void Train(double[][] i, double[][] o = null, int outputLength = 10, int hiddenLayer = -1)
        {
            if (n == null)
            {
                if (File.Exists(p)) n = DeepBeliefNetwork.Load(p);
                else
                {
                    outputLength = (o == null) ? outputLength : o[0].Length;
                    hiddenLayer = (hiddenLayer == -1) ? (int)Math.Log(i[0].Length, outputLength) : hiddenLayer;
                    List<int> layers = new List<int>();
                    for (int j = 0; j < hiddenLayer; j++) layers.Add(i[0].Length);
                    layers.Add(outputLength);
                    n = new DeepBeliefNetwork(new BernoulliFunction(), i[0].Length, layers.ToArray());
                    new GaussianWeights(n).Randomize();
                }
            }

            dynamic t;
            if (o == null)
            {
                t = new DeepBeliefNetworkLearning(n) { Algorithm = (h, v, j) => new ContrastiveDivergenceLearning(h, v), LayerIndex = n.Machines.Count - 1, };
                while (true) e = t.RunEpoch(t.GetLayerInput(i));
            }
            else
            {
                t = new DeepNeuralNetworkLearning(n) { Algorithm = (ann, j) => new ParallelResilientBackpropagationLearning(ann), LayerIndex = n.Machines.Count - 1, };
                while (true) e = t.RunEpoch(t.GetLayerInput(i), o);
            }
        }
All Usage Examples Of Accord.Neuro.Learning.DeepNeuralNetworkLearning::GetLayerInput