/// <summary> /// Propagate the layer. /// </summary> /// /// <param name="matrix">The matrix for this layer.</param> /// <param name="input">The input pattern.</param> /// <param name="output">The output pattern.</param> /// <returns>True if the network has become stable.</returns> private static bool PropagateLayer(Matrix matrix, IMLData input, IMLDataModifiable output) { int i; bool stable = true; for (i = 0; i < output.Count; i++) { double sum = 0; // **FIX** ?? int ?? int j; for (j = 0; j < input.Count; j++) { sum += GetWeight(matrix, input, i, j) * input[j]; } if (sum != 0) { int xout; if (sum < 0) { xout = -1; } else { xout = 1; } if (xout != (int)output[i]) { stable = false; output[i] = xout; } } } return(stable); }
/// <summary> /// Construct the neural data mapping class with the specified values. /// </summary> /// /// <param name="f">The source data.</param> /// <param name="t">The target data.</param> public NeuralDataMapping(IMLDataModifiable f, IMLDataModifiable t) { From = f; To = t; }
/// <summary> /// Construct the neural data mapping class with the specified values. /// </summary> /// /// <param name="f">The source data.</param> /// <param name="t">The target data.</param> public NeuralDataMapping(IMLDataModifiable f, IMLDataModifiable t) { From = f; To = t; }
/// <summary> /// Propagate the layer. /// </summary> /// /// <param name="matrix">The matrix for this layer.</param> /// <param name="input">The input pattern.</param> /// <param name="output">The output pattern.</param> /// <returns>True if the network has become stable.</returns> private static bool PropagateLayer(Matrix matrix, IMLData input, IMLDataModifiable output) { int i; bool stable = true; for (i = 0; i < output.Count; i++) { double sum = 0; // **FIX** ?? int ?? int j; for (j = 0; j < input.Count; j++) { sum += GetWeight(matrix, input, i, j)*input[j]; } if (sum != 0) { int xout; if (sum < 0) { xout = -1; } else { xout = 1; } if (xout != (int) output[i]) { stable = false; output[i] = xout; } } } return stable; }