Exemplo n.º 1
0
        public double GetScore(ClassPerfMetric metric, LblT lbl)
        {
            switch (metric)
            {
            case ClassPerfMetric.Precision:
                return(GetPrecision(lbl));

            case ClassPerfMetric.Recall:
                return(GetRecall(lbl));

            case ClassPerfMetric.F1:
                return(GetF1(lbl));

            case ClassPerfMetric.PredictedCount:
                return(GetPredictedSum(lbl));

            case ClassPerfMetric.PredictedRatio:
                return(GetPredictedRatio(lbl));

            case ClassPerfMetric.ActualCount:
                return(GetActualSum(lbl));

            case ClassPerfMetric.ActualRatio:
                return(GetActualRatio(lbl));

            default:
                throw new ArgumentValueException("metric");
            }
        }
Exemplo n.º 2
0
        public double GetAvgStdErr(string expName, string algoName, ClassPerfMetric metric, LblT lbl, out double stderr, double confidenceLevel = 0.95)
        {
            double zval = StatsUtils.GetZScore(confidenceLevel);
            double stddev;
            double avg = GetAvg(expName, algoName, metric, lbl, out stddev);

            stderr = zval * stddev / Math.Sqrt(GetFoldCount(expName, algoName));
            return(avg);
        }
Exemplo n.º 3
0
        public double GetVal(int foldNum, string expName, string algoName, ClassPerfMetric metric, LblT lbl)
        {
            Utils.ThrowException(foldNum < 1 ? new ArgumentOutOfRangeException("foldNum") : null);
            Utils.ThrowException(expName == null ? new ArgumentNullException("expName") : null);
            Utils.ThrowException(algoName == null ? new ArgumentNullException("algoName") : null);
            ConcurrentDictionary <string, FoldData> algoData;

            if (mData.TryGetValue(expName, out algoData))
            {
                FoldData foldData;
                if (algoData.TryGetValue(algoName, out foldData))
                {
                    if (foldNum <= foldData.Count && foldData[foldNum - 1] != null)
                    {
                        return(foldData[foldNum - 1].GetScore(metric, lbl));
                    }
                }
            }
            return(Double.NaN);
        }
Exemplo n.º 4
0
        public double GetAvg(string expName, string algoName, ClassPerfMetric metric, LblT label)
        {
            double stdev;

            return(GetAvg(expName, algoName, metric, label, out stdev));
        }
Exemplo n.º 5
0
 public double GetAvg(string expName, string algoName, ClassPerfMetric metric, LblT lbl, out double stdev)
 {
     return(GetAvg(expName, algoName, mtx => mtx.GetScore(metric, lbl), out stdev));
 }