Exemplo n.º 1
0
 /// <summary>
 /// Creates the report from metrics given, using averaging computation specified
 /// </summary>
 /// <param name="_metrics">The metrics to build report entry from</param>
 /// <param name="averageComputation">The average computation method to apply for F1, P and R</param>
 public classificationReport(classificationEvalMetricSet _metrics, classificationMetricComputation averageComputation)
 {
     Name = _metrics.name;
     GetSetMetrics(_metrics);
     this.AddValues(_metrics, averageComputation);
     method = averageComputation;
 }
        /// <summary>
        /// Deploys the specified report options.
        /// </summary>
        /// <param name="_reportOptions">The report options.</param>
        /// <param name="_signature">The signature.</param>
        /// <param name="_averagingMethod">The averaging method.</param>
        /// <param name="_rootFolder">The root folder.</param>
        /// <param name="_experimentDescription">The experiment description.</param>
        /// <param name="logger">The logger.</param>
        public void Deploy(aceAuthorNotation _signature, classificationMetricComputation _averagingMethod, folderNode _rootFolder, String _experimentDescription, ILogBuilder logger)
        {
            //  reportOptions = _reportOptions;
            signature            = _signature;
            averagingMethod      = _averagingMethod;
            description          = _experimentDescription;
            experimentRootFolder = _rootFolder;
            notes = new ToolkitExperimentNotes(experimentRootFolder, _experimentDescription);


            notes.log("Starting [" + runName + "]");
            notes.log("[" + description + "]:[" + signature + "]");
            //ToolkitExperimentNotes.[" + _experimentDescription + "]:[" + signature + "]");
            imbSCI.Core.screenOutputControl.logToConsoleControl.setAsOutput(notes, "Note");
        }
        /// <summary>
        /// Gets the F1 measure, computed in respect to the <c>method</c> specified
        /// </summary>
        /// <param name="method">The method of F1 measure computation.</param>
        /// <seealso cref="classificationEval.GetF1"/>
        /// <returns></returns>
        public Double GetF1(classificationMetricComputation method = classificationMetricComputation.microAveraging)
        {
            Double output = 0;

            switch (method)
            {
            case classificationMetricComputation.microAveraging:
                return(GetSummary().GetF1());

                break;

            case classificationMetricComputation.macroAveraging:
                foreach (var pair in items)
                {
                    output += this[pair.Key].GetF1();
                }
                return(output.GetRatio(items.Count));

                break;
            }
            return(output);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Evaluates the test results.
        /// </summary>
        /// <param name="testResults">Set of test results.</param>
        /// <param name="_testName">Descriptive name to be attached at results report.</param>
        /// <param name="logger">The logger - to log any problems, if occourred.</param>
        /// <param name="averagingMethod">The averaging method.</param>
        /// <returns></returns>
        public classificationReport EvaluateTestResults(List <FeatureVectorWithLabelID> testResults, String _testName, ILogBuilder logger, classificationMetricComputation averagingMethod = classificationMetricComputation.macroAveraging)
        {
            //classificationReport report = new classificationReport()

            classificationReport report = new classificationReport(_testName);

            classificationEvalMetricSet metric = EvaluateTestResultsToMetricSet(testResults, _testName, logger);

            report.GetSetMetrics(metric);
            report.AddValues(metric, averagingMethod);

            return(report);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sets or Adds the values from specified <c>metrics</c> object.
        /// </summary>
        /// <param name="a">a.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="method">The method of ratios computation (F1, Precision, Recall)</param>
        public static void AddValues(this IClassificationReport a, classificationEvalMetricSet metrics, classificationMetricComputation method)
        {
            a.Precision += metrics.GetPrecision(method);
            a.Recall    += metrics.GetRecall(method);
            a.F1measure += metrics.GetF1(method);

            foreach (var p in metrics)
            {
                a.Correct += p.Value.correct;
                a.Wrong   += p.Value.wrong;
                a.Targets += p.Value.correct + p.Value.wrong;
            }

            a.method = method;
        }