/// <summary> /// Initializes a new instance of the <see cref="DeltaRuleLearning"/> class /// </summary> /// <param name="network">Network to teach</param> public DeltaRuleLearning( ActivationNetwork network ) { // check layers count if ( network.LayersCount != 1 ) { throw new ArgumentException( "Invalid nuaral network. It should have one layer only." ); } this._network = network; }
/// <summary> /// Initializes a new instance of the <see cref="BackPropagationLearning"/> class /// </summary> /// <param name="network">Network to teach</param> public BackPropagationLearning( ActivationNetwork network ) { this._network = network; // create error and deltas arrays _neuronErrors = new double[network.LayersCount][]; _weightsUpdates = new double[network.LayersCount][][]; _thresholdsUpdates = new double[network.LayersCount][]; // initialize errors and deltas arrays for each layer for ( int i = 0, n = network.LayersCount; i < n; i++ ) { Layer layer = network[i]; _neuronErrors[i] = new double[layer.NeuronsCount]; _weightsUpdates[i] = new double[layer.NeuronsCount][]; _thresholdsUpdates[i] = new double[layer.NeuronsCount]; // for each neuron for ( var j = 0; j < layer.NeuronsCount; j++ ) _weightsUpdates[i][j] = new double[layer.InputsCount]; } }