Exemplo n.º 1
0
        internal MulticlassClassificationMetrics(IHost host, DataViewRow overallResult, int topKPredictionCount, IDataView confusionMatrix)
        {
            double FetchDouble(string name) => RowCursorUtils.Fetch <double>(host, overallResult, name);

            MicroAccuracy       = FetchDouble(MulticlassClassificationEvaluator.AccuracyMicro);
            MacroAccuracy       = FetchDouble(MulticlassClassificationEvaluator.AccuracyMacro);
            LogLoss             = FetchDouble(MulticlassClassificationEvaluator.LogLoss);
            LogLossReduction    = FetchDouble(MulticlassClassificationEvaluator.LogLossReduction);
            TopKPredictionCount = topKPredictionCount;
            if (topKPredictionCount > 0)
            {
                TopKAccuracy = FetchDouble(MulticlassClassificationEvaluator.TopKAccuracy);
            }

            var perClassLogLoss = RowCursorUtils.Fetch <VBuffer <double> >(host, overallResult, MulticlassClassificationEvaluator.PerClassLogLoss);

            PerClassLogLoss = perClassLogLoss.DenseValues().ToImmutableArray();
            ConfusionMatrix = MetricWriter.GetConfusionMatrix(host, confusionMatrix, binary: false, perClassLogLoss.Length);
        }
 internal BinaryClassificationMetrics(double auc, double accuracy, double positivePrecision, double positiveRecall,
                                      double negativePrecision, double negativeRecall, double f1Score, double auprc, ConfusionMatrix confusionMatrix)
     : this(auc, accuracy, positivePrecision, positiveRecall, negativePrecision, negativeRecall, f1Score, auprc)
 {
     ConfusionMatrix = confusionMatrix;
 }
 internal MulticlassClassificationMetrics(double accuracyMicro, double accuracyMacro, double logLoss, double logLossReduction,
                                          int topKPredictionCount, double topKAccuracy, double[] perClassLogLoss, ConfusionMatrix confusionMatrix)
     : this(accuracyMicro, accuracyMacro, logLoss, logLossReduction, topKPredictionCount, topKAccuracy, perClassLogLoss)
 {
     ConfusionMatrix = confusionMatrix;
 }