Exemplo n.º 1
0
        public void TestCompute1()
        {
            _classifier = new CLAClassifier(new[] { 1 }, 0.1, 0.1, 0);
            Dictionary <string, object> classification = new Dictionary <string, object>();

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

            Assert.IsTrue(Arrays.AreEqual(new[] { 1 }, result.StepSet()));
            Assert.AreEqual(1, result.GetActualValueCount());
            Assert.AreEqual(34.7, result.GetActualValue(0), 0.01);
        }
Exemplo n.º 2
0
        public void TestComputeWithMissingValue()
        {
            _classifier = new CLAClassifier(new[] { 1 }, 0.1, 0.1, 0);
            Map <string, object> classification = new Map <string, object>();

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

            Assert.IsTrue(Arrays.AreEqual(new[] { 1 }, result.StepSet()));
            Assert.AreEqual(1, result.GetActualValueCount());
            Assert.AreEqual(null, result.GetActualValue(0));
        }
Exemplo n.º 3
0
        public void TestMissingRecordInitialization()
        {
            _classifier = new CLAClassifier(new[] { 2 }, 0.1, 0.1, 0);
            int recordNum = 0;
            Dictionary <string, object> classification = new Dictionary <string, object>();

            classification.Add("bucketIdx", 0);
            classification.Add("actValue", 34.7);
            _classifier.Compute <double>(recordNum, classification, new[] { 1, 5, 9 }, true, true);

            recordNum = 2;
            Classification <double> result = _classifier.Compute <double>(recordNum, classification, new[] { 1, 5, 9 }, true, true);

            Assert.IsTrue(Arrays.AreEqual(new[] { 2 }, result.StepSet()));
            Assert.AreEqual(1, result.GetActualValueCount());
            Assert.AreEqual(34.7, result.GetActualValue(0), 0.01);
        }