public double GetScore(RegressionMetrics metrics) { if (metrics == null) { return(double.NaN); } switch (_optimizingMetric) { case RegressionMetric.MeanAbsoluteError: return(metrics.MeanAbsoluteError); case RegressionMetric.MeanSquaredError: return(metrics.MeanSquaredError); case RegressionMetric.RootMeanSquaredError: return(metrics.RootMeanSquaredError); case RegressionMetric.RSquared: return(metrics.RSquared); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
public bool IsModelPerfect(double score) { if (double.IsNaN(score)) { return(false); } switch (_optimizingMetric) { case RegressionMetric.MeanAbsoluteError: return(score == 0); case RegressionMetric.MeanSquaredError: return(score == 0); case RegressionMetric.RootMeanSquaredError: return(score == 0); case RegressionMetric.RSquared: return(score == 1); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
public bool IsModelPerfect(double score) { if (double.IsNaN(score)) { return(false); } switch (_optimizingMetric) { case MulticlassClassificationMetric.MacroAccuracy: return(score == 1); case MulticlassClassificationMetric.MicroAccuracy: return(score == 1); case MulticlassClassificationMetric.LogLoss: return(score == 0); case MulticlassClassificationMetric.LogLossReduction: return(score == 1); case MulticlassClassificationMetric.TopKAccuracy: return(score == 1); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
public double GetScore(MulticlassClassificationMetrics metrics) { if (metrics == null) { return(double.NaN); } switch (_optimizingMetric) { case MulticlassClassificationMetric.MacroAccuracy: return(metrics.MacroAccuracy); case MulticlassClassificationMetric.MicroAccuracy: return(metrics.MicroAccuracy); case MulticlassClassificationMetric.LogLoss: return(metrics.LogLoss); case MulticlassClassificationMetric.LogLossReduction: return(metrics.LogLossReduction); case MulticlassClassificationMetric.TopKAccuracy: return(metrics.TopKAccuracy); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
// REVIEW: model can't be perfect with DCG public bool IsModelPerfect(double score) { if (double.IsNaN(score)) { return(false); } switch (_optimizingMetric) { case RankingMetric.Ndcg: return(score == 1); case RankingMetric.Dcg: return(false); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
// Optimizing metric used: NDCG@10 and DCG@10 public double GetScore(RankingMetrics metrics) { if (metrics == null) { return(double.NaN); } switch (_optimizingMetric) { case RankingMetric.Ndcg: return(metrics.NormalizedDiscountedCumulativeGains[Math.Min(metrics.NormalizedDiscountedCumulativeGains.Count, (int)_dcgTruncationLevel) - 1]); case RankingMetric.Dcg: return(metrics.DiscountedCumulativeGains[Math.Min(metrics.DiscountedCumulativeGains.Count, (int)_dcgTruncationLevel) - 1]); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
// Optimizing metric used: NDCG@10 and DCG@10 public double GetScore(RankingMetrics metrics) { if (metrics == null) { return(double.NaN); } switch (_optimizingMetric) { case RankingMetric.Ndcg: return((metrics.NormalizedDiscountedCumulativeGains.Count >= 10) ? metrics.NormalizedDiscountedCumulativeGains[9] : metrics.NormalizedDiscountedCumulativeGains[metrics.NormalizedDiscountedCumulativeGains.Count - 1]); case RankingMetric.Dcg: return((metrics.DiscountedCumulativeGains.Count >= 10) ? metrics.DiscountedCumulativeGains[9] : metrics.DiscountedCumulativeGains[metrics.DiscountedCumulativeGains.Count - 1]); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
public bool IsModelPerfect(double score) { if (double.IsNaN(score)) { return(false); } switch (_optimizingMetric) { case BinaryClassificationMetric.Accuracy: return(score == 1); case BinaryClassificationMetric.AreaUnderRocCurve: return(score == 1); case BinaryClassificationMetric.AreaUnderPrecisionRecallCurve: return(score == 1); case BinaryClassificationMetric.F1Score: return(score == 1); case BinaryClassificationMetric.NegativePrecision: return(score == 1); case BinaryClassificationMetric.NegativeRecall: return(score == 1); case BinaryClassificationMetric.PositivePrecision: return(score == 1); case BinaryClassificationMetric.PositiveRecall: return(score == 1); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }
public double GetScore(BinaryClassificationMetrics metrics) { if (metrics == null) { return(double.NaN); } switch (_optimizingMetric) { case BinaryClassificationMetric.Accuracy: return(metrics.Accuracy); case BinaryClassificationMetric.AreaUnderRocCurve: return(metrics.AreaUnderRocCurve); case BinaryClassificationMetric.AreaUnderPrecisionRecallCurve: return(metrics.AreaUnderPrecisionRecallCurve); case BinaryClassificationMetric.F1Score: return(metrics.F1Score); case BinaryClassificationMetric.NegativePrecision: return(metrics.NegativePrecision); case BinaryClassificationMetric.NegativeRecall: return(metrics.NegativeRecall); case BinaryClassificationMetric.PositivePrecision: return(metrics.PositivePrecision); case BinaryClassificationMetric.PositiveRecall: return(metrics.PositiveRecall); default: throw MetricsAgentUtil.BuildMetricNotSupportedException(_optimizingMetric); } }