Esempio n. 1
0
        public void EvaluateClassifier(
            IBaseClassifier <Classifier> classifier,
            Runtime testing,
            bool crossFoldsEvaluate      = true,
            bool runPredictions          = true,
            string saveModelToDiskFile   = null,
            string loadModelfromDiskFile = null,
            int numFolds = 10)
        {
            Console.WriteLine("EvaluateClassifier");

            var start = DateTime.Now;

            if (classifier != null)
            {
                classifier.Build();
            }

            if (!String.IsNullOrWhiteSpace(loadModelfromDiskFile))
            {
                throw new NotSupportedException("loadModelfromDiskFile not supported " +
                                                "as BaseClassifier.Read returns a Classifier not a IBaseClassifier as it should");
                // clas = BaseClassifier.Read(loadModelfromDiskFile);
                // Console.WriteLine("Loading Model From Disk Took: {0}", DateTime.Now.Subtract(start));
            }
            else if (!String.IsNullOrWhiteSpace(saveModelToDiskFile))
            {
                classifier.FlushToFile(saveModelToDiskFile);
            }
            if (crossFoldsEvaluate)
            {
                classifier.Runtime.EvaluateWithCrossValidation(classifier, numFolds);
            }
            if (runPredictions)
            {
                testing.GeneratePredictions(null, classifier);
            }

            Console.WriteLine("\n\nEvaluation Took: {0}", DateTime.Now.Subtract(start));
        }
Esempio n. 2
0
 public ClassifierEvaluator(Runtime runtime, IBaseClassifier <Classifier> classifier)
 {
     this.runtime    = runtime;
     this.classifier = classifier;
 }
Esempio n. 3
0
 public double[] GetClassifications(IBaseClassifier <Classifier> classifier)
 {
     return(this.Select(classifier.ClassifyInstance).ToArray());
 }
Esempio n. 4
0
 public PmlEvaluation EvaluateWithCrossValidation(IBaseClassifier <Classifier> classifier, int numfolds = 10, bool quiet = false)
 {
     return(new ClassifierEvaluator(this, classifier).
            EvaluateWithCrossValidateion(numfolds, quiet));
 }
Esempio n. 5
0
 public double EvaluateModelOnce(IBaseClassifier <Classifier> classifier, PmlInstance instance)
 {
     return(Impl.evaluateModelOnce(classifier.Impl, instance.Impl));
 }
Esempio n. 6
0
 public double EvaluateModelOnceAndRecordPrediction(IBaseClassifier <Classifier> classifier, PmlInstance instance)
 {
     return(Impl.evaluateModelOnceAndRecordPrediction(classifier.Impl, instance.Impl));
 }
Esempio n. 7
0
 public static string EvaluateModel(IBaseClassifier <Classifier> classifier, string[] options)
 {
     return(Evaluation.evaluateModel(classifier.Impl, options));
 }
Esempio n. 8
0
 public double[] EvaluateModel(IBaseClassifier <Classifier> classifier, Runtime data, object[] forPredictionsPrinting)
 {
     return(Impl.evaluateModel(classifier.Impl, data.Impl, forPredictionsPrinting));
 }