private Node[] Epoch(int t, Drink inputDrink, Node[] nodesArray) { BestMatchingNodeMultiThreadedSearcher bestMatchingNodeMultiThreadedSearcher = new BestMatchingNodeMultiThreadedSearcher(nodesArray, processorsCount, inputDrink.FeaturesArray); int winningNodeIndex = bestMatchingNodeMultiThreadedSearcher.GetBestMatchingNodeIndex(); double neighbourhoodRadius = Radius(t); double learningRate = LearningRate(t); potentialsArray[winningNodeIndex] -= (_minNeuronPotential + maxNeuronRestTimeInv); UpdatePotentialsArray(maxNeuronRestTimeInv); System.Threading.Tasks.Parallel.ForEach(nodesArray, node => { double theta = Theta(t, nodesArray[winningNodeIndex], node, neighbourhoodRadius); if (theta > 0) { node.AdjustWeights(theta, learningRate, inputDrink.FeaturesArray); node.DrinkID = inputDrink.ID; } }); return(nodesArray); }
private Node[] Epoch(int t, Drink inputDrink, Node[] nodesArray) { BestMatchingNodeMultiThreadedSearcher bestMatchingNodeMultiThreadedSearcher = new BestMatchingNodeMultiThreadedSearcher(nodesArray, processorsCount, inputDrink.FeaturesArray); int winningNodeIndex = bestMatchingNodeMultiThreadedSearcher.GetBestMatchingNodeIndex(); double neighbourhoodRadius = Radius(t); double learningRate = LearningRate(t); potentialsArray[winningNodeIndex] -= (_minNeuronPotential + maxNeuronRestTimeInv); UpdatePotentialsArray(maxNeuronRestTimeInv); System.Threading.Tasks.Parallel.ForEach(nodesArray, node => { double theta = Theta(t, nodesArray[winningNodeIndex], node, neighbourhoodRadius); if (theta > 0) { node.AdjustWeights(theta, learningRate, inputDrink.FeaturesArray); node.DrinkID = inputDrink.ID; } }); return nodesArray; }