public void FunctionTest() { Sigmoid dense = new Sigmoid(3.6, 1); SparseSigmoid target = new SparseSigmoid(3.6, 1); double[] sx = { 1, -0.555556, 2, +0.250000, 3, -0.864407, 4, -0.916667 }; double[] sy = { 1, -0.666667, 2, -0.166667, 3, -0.864407, 4, -0.916667 }; double[] sz = { 1, -0.944444, 3, -0.898305, 4, -0.916667 }; double[] dx = { -0.555556, +0.250000, -0.864407, -0.916667 }; double[] dy = { -0.666667, -0.166667, -0.864407, -0.916667 }; double[] dz = { -0.944444, +0.000000, -0.898305, -0.916667 }; double expected, actual; expected = dense.Function(dx, dy); actual = target.Function(sx, sy); Assert.AreEqual(expected, actual); expected = dense.Function(dx, dz); actual = target.Function(sx, sz); Assert.AreEqual(expected, actual); expected = dense.Function(dy, dz); actual = target.Function(sy, sz); Assert.AreEqual(expected, actual); }
/// <summary> /// Updates the output of the neuron. /// </summary> /// <param name="activation">The activation function with which the output is calculated.</param> /// <returns></returns> public virtual void UpdateOutput(Sigmoid activation) { Output = activation.Function(Net); }