HasDerivative() public method

public HasDerivative ( ) : bool
return bool
コード例 #1
0
        public void TestTANH()
        {
            var activation = new ActivationTANH();
            Assert.IsTrue(activation.HasDerivative());

            var clone = (ActivationTANH) activation.Clone();
            Assert.IsNotNull(clone);

            double[] input = {0.0};

            activation.ActivationFunction(input, 0, 1);

            Assert.AreEqual(0.0, input[0], 0.1);

            // test derivative, should throw an error
            input[0] = activation.DerivativeFunction(input[0],input[0]);
            Assert.AreEqual(1.0, input[0], 0.1);
        }
コード例 #2
0
        public void TestTANH()
        {
            var activation = new ActivationTANH();

            Assert.IsTrue(activation.HasDerivative());

            var clone = (ActivationTANH)activation.Clone();

            Assert.IsNotNull(clone);

            double[] input = { 0.0 };

            activation.ActivationFunction(input, 0, 1);

            Assert.AreEqual(0.0, input[0], 0.1);


            // test derivative, should throw an error
            input[0] = activation.DerivativeFunction(input[0], input[0]);
            Assert.AreEqual(1.0, input[0], 0.1);
        }