public void AdjustWeights_ValidInputs_WeightsAreAdjustedProperly() { MapNode node = new MapNode( x: default(int), y: default(int), weights: new Vector { 1, 4, 3, 2 }); Vector input = new Vector { 2, 5, 5, 1 }; node.AdjustWeights(input, learningRate: 0.07, distanceFalloff: 0.2); // The weights should be adjusted based on the following calculation: // Weights[x] = Weights[x] + ( learningRate * distanceFalloff * ( input[x] - Weights[x] ) ) // So, for example if Weights[0] is 1, and input[0] is 1, and learningRate is 0.07 and distanceFalloff = 0.2 // Weights[0] = 1 + (0.07 * 0.2 * (2 - 1)) // Weights[0] = 1 + (0.014 * (1)) // Weights[0] = 1 + (0.014) // Weights[0] = 1.014 Assert.AreEqual(1.014, node.Weights[0]); Assert.AreEqual(4.014, node.Weights[1]); Assert.AreEqual(3.028, node.Weights[2]); Assert.AreEqual(1.986, node.Weights[3]); }