コード例 #1
0
    public void EvaluateNeuron_WithPassthroughAF_WithMultipleInputs_ReturnsCorrectValue()
    {
        FullyConnectedNN nn = new FullyConnectedNN(new[] { 2, 1 },
                                                   AF.Passthrough);

        AssertFloat.AreAlmostEqual(0.0f, nn.EvaluateNeuron(new[] { 0.0f, 0.0f }, 1, new[] { 1.0f, 1.0f }, 0));
        AssertFloat.AreAlmostEqual(0.8f, nn.EvaluateNeuron(new[] { 0.3f, 0.5f }, 1, new[] { 1.0f, 1.0f }, 0));
        AssertFloat.AreAlmostEqual(0.3f, nn.EvaluateNeuron(new[] { 0.5f, -0.4f }, 1, new[] { 1.0f, 0.5f }, 0));
    }
コード例 #2
0
    public void EvaluateNeuron_WithPassthroughAF_WithSingleInput_ReturnsInputValueTimesWeight()
    {
        FullyConnectedNN nn = new FullyConnectedNN(new[] { 1, 1 },
                                                   AF.Passthrough);

        AssertFloat.AreAlmostEqual(-1.0f, nn.EvaluateNeuron(new[] { -1.0f }, 1, new[] { 1.0f }, 0));
        AssertFloat.AreAlmostEqual(0.35f, nn.EvaluateNeuron(new[] { 0.35f }, 1, new[] { 1.0f }, 0));
        AssertFloat.AreAlmostEqual(0.5f, nn.EvaluateNeuron(new[] { 1.0f }, 1, new[] { 0.5f }, 0));
    }