Exemplo n.º 1
0
        public void DonskoyIndex_Calculate_3C()
        {
            var index = new DonskoyIndex <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.AreEqual(i1, 0);
            Assert.AreEqual(i2, 4);
            Assert.AreEqual(i3, 8);
            Assert.AreEqual(i4, 8);
            Assert.AreEqual(i5, 8);
            Assert.AreEqual(i6, 4);
            Assert.AreEqual(i7, 0);
        }
Exemplo n.º 2
0
        private void doDecisionTreeAlgorithmTest()
        {
            var patterns = getSimpleLogicPatterns();

            var alg           = new DecisionTreeID3Algorithm <double[]>(Data.TrainingSample);
            var informativity = new DonskoyIndex <double[]>();

            alg.Train(patterns, informativity);

            outputError(alg);

            Visualizer.Run(alg);
        }