コード例 #1
0
        public void ReturnTrueIfFirstVectorIsKnown()
        {
            var bcmModel  = new BcmModel();
            var threshold = 2;

            bcmModel.Teach(_firstVector);
            bcmModel.Teach(_secondVector);

            bcmModel.Test(_firstVector, threshold).Should().BeTrue();
        }
コード例 #2
0
        public void ReturnFalseIfVectorIsNotKnown()
        {
            var bcmModel      = new BcmModel();
            var threshold     = 2;
            var unknownVector = Vector <float> .Build.DenseOfArray(new[] { 1f, 1, 1, 1, 0, 0 });

            bcmModel.Teach(_firstVector);
            bcmModel.Teach(_secondVector);

            bcmModel.Test(unknownVector, threshold).Should().BeFalse();
        }
コード例 #3
0
        public void TestMethodShouldThrowExceptionIfVectorHaveDifferentLength()
        {
            var bcmModel              = new BcmModel();
            var threshold             = 2;
            var vectorWithOtherLength = Vector <float> .Build.Dense(8);

            bcmModel.Teach(_firstVector);
            bcmModel.Teach(_secondVector);

            Action testingWithDifferentLengths = () => bcmModel.Test(vectorWithOtherLength, threshold);

            testingWithDifferentLengths.ShouldThrow <ArgumentException>();
        }