예제 #1
0
        public void EntropyIndex_Calculate_3C()
        {
            var index = new EntropyIndex <double[]>();

            var p1 = SimplePattern(0, -0.5F);
            var p2 = SimplePattern(0, 0.5F);
            var p3 = SimplePattern(0, 1.5F);
            var p4 = SimplePattern(0, 2.5F);
            var p5 = SimplePattern(0, 3.5F);
            var p6 = SimplePattern(0, 4.5F);
            var p7 = SimplePattern(0, 5.5F);

            var i1 = index.Calculate(p1, SAMPLE_3C);
            var i2 = index.Calculate(p2, SAMPLE_3C);
            var i3 = index.Calculate(p3, SAMPLE_3C);
            var i4 = index.Calculate(p4, SAMPLE_3C);
            var i5 = index.Calculate(p5, SAMPLE_3C);
            var i6 = index.Calculate(p6, SAMPLE_3C);
            var i7 = index.Calculate(p7, SAMPLE_3C);

            Assert.IsTrue(Math.Abs(i1) < EPS);
            Assert.IsTrue(Math.Abs(i2 - 0.31668908F) < EPS);
            Assert.IsTrue(Math.Abs(i3 - 0.9182958F) < EPS);
            Assert.IsTrue(Math.Abs(i4 - 0.6666667F) < EPS);
            Assert.IsTrue(Math.Abs(i5 - 0.9182958F) < EPS);
            Assert.IsTrue(Math.Abs(i6 - 0.316689074F) < EPS);
            Assert.IsTrue(Math.Abs(i7) < EPS);
        }
예제 #2
0
        public void EntropyIndex_Calculate_2C()
        {
            var index = new EntropyIndex <double[]>();

            var p1 = SimplePattern(0, -0.5F);
            var p2 = SimplePattern(0, 0.5F);
            var p3 = SimplePattern(0, 1.5F);
            var p4 = SimplePattern(0, 2.5F);
            var p5 = SimplePattern(0, 3.5F);
            var p6 = SimplePattern(0, 4.5F);

            var i1 = index.Calculate(p1, SAMPLE_2C);
            var i2 = index.Calculate(p2, SAMPLE_2C);
            var i3 = index.Calculate(p3, SAMPLE_2C);
            var i4 = index.Calculate(p4, SAMPLE_2C);
            var i5 = index.Calculate(p5, SAMPLE_2C);
            var i6 = index.Calculate(p6, SAMPLE_2C);

            Assert.IsTrue(Math.Abs(i1) < EPS);
            Assert.IsTrue(Math.Abs(i2 - 0.3219280F) < EPS);
            Assert.IsTrue(Math.Abs(i3 - 0.9709505F) < EPS);
            Assert.IsTrue(Math.Abs(i4 - 0.419973075F) < EPS);
            Assert.IsTrue(Math.Abs(i5 - 0.170950577F) < EPS);
            Assert.IsTrue(Math.Abs(i6) < EPS);
        }