Exemple #1
0
 /* dodano dla samouczacego sie neuronu */
 public void Learn(TeachingSet.Element teachingElement, int neuronIndex, double etha)
 {
     _neurons[neuronIndex].LearnSelf(
         teachingElement.Inputs,
         etha
         );
 }
Exemple #2
0
        public void LearnSimple(TeachingSet.Element teachingElement, double ratio,
                                ref double[] previousResponse, ref double[] previousError,
                                LearningMethod method)
        {
            if (_layers.Count != 1)
            {
                throw new InvalidOperationException(
                          "The simple learning algorithm can be applied only to one-layer networks.");
            }

            NonLinearNeuron[] layer = _layers[0];
            if (previousResponse == null)
            {
                previousResponse = new double[layer.Length];
            }
            if (previousError == null)
            {
                previousError = new double[layer.Length];
            }
            double[] actualInputs = AppendBias(teachingElement.Inputs, false);

            for (int neuronIndex = 0; neuronIndex < layer.Length; neuronIndex++)
            {
                switch (method)
                {
                case LearningMethod.Perceptron:
                    layer[neuronIndex].Learn(
                        actualInputs,
                        teachingElement.ExpectedOutputs[neuronIndex],
                        ratio,
                        out previousResponse[neuronIndex],
                        out previousError[neuronIndex]
                        );
                    break;

                case LearningMethod.WidrowHoff:
                    layer[neuronIndex].LearnWidrowHoff(
                        actualInputs,
                        teachingElement.ExpectedOutputs[neuronIndex],
                        ratio,
                        out previousResponse[neuronIndex],
                        out previousError[neuronIndex]
                        );
                    break;
                }
            }
        }
Exemple #3
0
        public void Learn(TeachingSet.Element teachingElement, double etha)
        {
            double _max = 0;


            _max = Winner(teachingElement.Inputs);

            for (int x = 1; x < _neurons.Length; x++)
            {
            }

            for (int neuronIndex = 0; neuronIndex < _neurons.Length; neuronIndex++)
            {
                _neurons[neuronIndex].Learn(
                    teachingElement.Inputs,
                    etha,
                    _max
                    );
            }
        }
Exemple #4
0
        public void Learn(TeachingSet.Element teachingElement, double ratio,
                          ref double[] previousResponse, ref double[] previousError)
        {
            if (previousResponse == null)
            {
                previousResponse = new double[_neurons.Length];
            }
            if (previousError == null)
            {
                previousError = new double[_neurons.Length];
            }

            for (int neuronIndex = 0; neuronIndex < _neurons.Length; neuronIndex++)
            {
                _neurons[neuronIndex].Learn(
                    teachingElement.Inputs,
                    teachingElement.ExpectedOutputs[neuronIndex],
                    ratio,
                    out previousResponse[neuronIndex],
                    out previousError[neuronIndex]
                    );
            }
        }
Exemple #5
0
 public void LearnSimpleWidrowHoff(TeachingSet.Element teachingElement,
                                   double ratio, ref double[] previousResponse, ref double[] previousError)
 {
     LearnSimple(teachingElement, ratio, ref previousResponse,
                 ref previousError, LearningMethod.WidrowHoff);
 }
Exemple #6
0
 public void LearnSimple(TeachingSet.Element teachingElement, double ratio,
                         ref double[] previousResponse, ref double[] previousError)
 {
     LearnSimple(teachingElement, ratio, ref previousResponse,
                 ref previousError, LearningMethod.Perceptron);
 }