public void TestLinear() { var activation = new ActivationLinear(); Assert.IsTrue(activation.HasDerivative()); var clone = (ActivationLinear) activation.Clone(); Assert.IsNotNull(clone); double[] input = {1, 2, 3}; activation.ActivationFunction(input, 0, 1); Assert.AreEqual(1.0, input[0], 0.1); Assert.AreEqual(2.0, input[1], 0.1); Assert.AreEqual(3.0, input[2], 0.1); // test derivative, should not throw an error input[0] = activation.DerivativeFunction(input[0],input[0]); }
public void TestLinear() { var activation = new ActivationLinear(); Assert.IsTrue(activation.HasDerivative()); var clone = (ActivationLinear)activation.Clone(); Assert.IsNotNull(clone); double[] input = { 1, 2, 3 }; activation.ActivationFunction(input, 0, 1); Assert.AreEqual(1.0, input[0], 0.1); Assert.AreEqual(2.0, input[1], 0.1); Assert.AreEqual(3.0, input[2], 0.1); // test derivative, should not throw an error input[0] = activation.DerivativeFunction(input[0], input[0]); }