Search Results for

    Show / Hide Table of Contents

    Class ConfusionMatrix<TLabel>

    Implements a confusion matrix.

    Inheritance
    Object
    ConfusionMatrix<TLabel>
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Namespace: Microsoft.ML.Probabilistic.Learners
    Assembly: Microsoft.ML.Probabilistic.Learners.Classifier.dll
    Syntax
    [Serializable]
    public class ConfusionMatrix<TLabel>
    Type Parameters
    Name Description
    TLabel

    The type of a label.

    Constructors

    ConfusionMatrix(IEnumerable<TLabel>)

    Initializes a new instance of the ConfusionMatrix<TLabel> class.

    Declaration
    public ConfusionMatrix(IEnumerable<TLabel> classLabels)
    Parameters
    Type Name Description
    IEnumerable<TLabel> classLabels

    The class labels.

    Properties

    ClassLabelSet

    Gets the bidirectional dictionary mapping class labels to class label indexes.

    Declaration
    public IndexedSet<TLabel> ClassLabelSet { get; }
    Property Value
    Type Description
    IndexedSet<TLabel>

    Item[TLabel, TLabel]

    Gets or sets the number of instances for given true and predicted labels.

    Declaration
    public long this[TLabel trueLabel, TLabel predictedLabel] { get; set; }
    Parameters
    Type Name Description
    TLabel trueLabel

    The true label.

    TLabel predictedLabel

    The predicted label.

    Property Value
    Type Description
    Int64

    The number of instances for the specified true and predicted labels.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    If a given label is unknown.

    MacroAccuracy

    Gets the macro-averaged accuracy.

    Declaration
    public double MacroAccuracy { get; }
    Property Value
    Type Description
    Double

    MacroAccuracyClassLabelCount

    Gets the number of class labels available to compute the macro-averaged accuracy.

    Declaration
    public int MacroAccuracyClassLabelCount { get; }
    Property Value
    Type Description
    Int32

    MacroF1

    Gets the macro-averaged F1-measure.

    Declaration
    public double MacroF1 { get; }
    Property Value
    Type Description
    Double

    MacroF1ClassLabelCount

    Gets the number of class labels available to compute the macro-averaged F1-measure.

    Declaration
    public int MacroF1ClassLabelCount { get; }
    Property Value
    Type Description
    Int32

    MacroPrecision

    Gets the macro-averaged precision.

    Declaration
    public double MacroPrecision { get; }
    Property Value
    Type Description
    Double

    MacroPrecisionClassLabelCount

    Gets the number of distinct class labels used to compute the macro-averaged precision.

    Declaration
    public int MacroPrecisionClassLabelCount { get; }
    Property Value
    Type Description
    Int32

    MacroRecall

    Gets the macro-averaged recall.

    Declaration
    public double MacroRecall { get; }
    Property Value
    Type Description
    Double

    MacroRecallClassLabelCount

    Gets the number of distinct class labels used to compute the macro-averaged recall.

    Declaration
    public int MacroRecallClassLabelCount { get; }
    Property Value
    Type Description
    Int32

    MicroAccuracy

    Gets the micro-averaged accuracy.

    Declaration
    public double MicroAccuracy { get; }
    Property Value
    Type Description
    Double

    MicroF1

    Gets the micro-averaged F1-measure.

    Declaration
    public double MicroF1 { get; }
    Property Value
    Type Description
    Double

    MicroPrecision

    Gets the micro-averaged precision.

    Declaration
    public double MicroPrecision { get; }
    Property Value
    Type Description
    Double

    MicroRecall

    Gets the micro-averaged recall.

    Declaration
    public double MicroRecall { get; }
    Property Value
    Type Description
    Double

    Methods

    Accuracy(TLabel)

    Gets the accuracy for a specified label.

    Declaration
    public double Accuracy(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the accuracy for.

    Returns
    Type Description
    Double

    The accuracy of the specified label.

    F1(TLabel)

    Gets the F1-measure for a specified label.

    Declaration
    public double F1(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the F1-measure for.

    Returns
    Type Description
    Double

    The F1-measure of the specified label.

    Precision(TLabel)

    Gets the precision for a specified label.

    Declaration
    public double Precision(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the precision for.

    Returns
    Type Description
    Double

    The precision of the specified label.

    PredictedLabelCount(TLabel)

    Gets the number of instances whose predicted label equals the specified label.

    Declaration
    public long PredictedLabelCount(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the number of instances for.

    Returns
    Type Description
    Int64

    The number of instances with the specified predicted label.

    Recall(TLabel)

    Gets the recall for a specified label.

    Declaration
    public double Recall(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the recall for.

    Returns
    Type Description
    Double

    The recall of the specified label.

    ToString()

    Returns the confusion matrix as a string.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The confusion matrix as a String.

    Overrides
    Object.ToString()

    TrueLabelCount(TLabel)

    Gets the number of instances whose ground truth label equals the specified label.

    Declaration
    public long TrueLabelCount(TLabel label)
    Parameters
    Type Name Description
    TLabel label

    The label to get the number of instances for.

    Returns
    Type Description
    Int64

    The number of instances with the specified ground truth label.

    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.