示例#1
0
        /**
         * <summary> TestClassification an instance list with the current model.</summary>
         *
         * <param name="testSet">Test data (list of instances) to be tested.</param>
         * <returns>The accuracy (and error) of the model as an instance of Performance class.</returns>
         */
        public virtual Performance.Performance Test(InstanceList.InstanceList testSet)
        {
            var classLabels = testSet.GetUnionOfPossibleClassLabels();
            var confusion   = new ConfusionMatrix(classLabels);

            for (var i = 0; i < testSet.Size(); i++)
            {
                var instance = testSet.Get(i);
                confusion.Classify(instance.GetClassLabel(), model.Predict(instance));
            }

            return(new DetailedClassificationPerformance(confusion));
        }