예제 #1
0
        public void TestComputeWithMissingValue()
        {
            var classifier = new CLAClassifier <double>(new List <int> {
                1
            }, 0.1, 0.1);
            Dictionary <string, object> classification = new Dictionary <string, object>();

            classification.Add("bucketIdx", null);
            classification.Add("actValue", null);
            ClassificationExperiment <double> result = classifier.Compute(0, classification, new int[] { 1, 5, 9 }, true, true);

            Assert.AreEqual(1, result.getActualValueCount());
            Assert.AreEqual(-1, result.getActualValue(0));
        }
예제 #2
0
        public void TestCompute()
        {
            var classifier = new CLAClassifier <double>(new List <int> {
                1
            }, 0.1, 0.1);
            Dictionary <string, object> classification = new Dictionary <string, object>();

            classification.Add("bucketIdx", 4);
            classification.Add("actValue", 34.7);
            ClassificationExperiment <double> result = classifier.Compute(0, classification, new int[] { 1, 5, 9 }, true, true);

            //it is first time and so it wont learn and that's why value count will be one
            Assert.AreEqual(1, result.getActualValueCount());
            Assert.AreEqual(34.7, result.getActualValue(0), 0.01);
        }
예제 #3
0
        public void TestComputeWithTwoIteration()
        {
            var classifier = new CLAClassifier <double>(new List <int> {
                1
            }, 0.1, 0.1);
            Dictionary <string, object> classification = new Dictionary <string, object>();

            classification.Add("bucketIdx", 4);
            classification.Add("actValue", 34.7);
            classifier.Compute(0, classification, new int[] { 1, 5, 9 }, true, true);
            //It is second iteration and so it will learn and that's why value count will be more than one
            ClassificationExperiment <double> result = classifier.Compute(1, classification, new int[] { 1, 5, 9 }, true, true);

            Assert.AreEqual(5, result.getActualValueCount());
            Assert.AreEqual(34.7, result.getActualValue(4), 0.01);
        }