Ejemplo n.º 1
0
 /// <summary>
 /// Trains network with the pattern from the specified training element 
 /// </summary>
 /// <param name="trainingElement">unsupervised training element which contains network input</param>
 protected void LearnPattern(TrainingElement trainingElement)
 {
     double[] input = trainingElement.Input;
     this.NeuralNetwork.SetInput(input);
     this.NeuralNetwork.Calculate();
     this.AdjustWeights();
 }
Ejemplo n.º 2
0
        private void LearnPattern(TrainingElement tE, int neighborhood)
        {
            this.NeuralNetwork.SetInput(tE.Input);
            this.NeuralNetwork.Calculate();
            Neuron winner = GetClosest();
            if (winner.Output == 0)
                return; // ako je vec istrenirana jedna celija, izadji

            Layer mapLayer = this.NeuralNetwork.GetLayerAt(1);
            int winnerIdx = mapLayer.IndexOf(winner);
            AdjustCellWeights(winner, 0);

            int cellNum = mapLayer.NeuronsCount;
            for (int p = 0; p < cellNum; p++)
            {
                if (p == winnerIdx)
                    continue;
                if (IsNeighbor(winnerIdx, p, neighborhood))
                {
                    Neuron cell = mapLayer.GetNeuronAt(p);
                    AdjustCellWeights(cell, 1);
                } // if
            } // for
        }