Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Microsoft.ML/Models/BinaryClassificationMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.ML.Runtime.Data;
using System;
using System.Collections.Generic;
using static Microsoft.ML.Runtime.Data.MetricKinds;

namespace Microsoft.ML.Models
{
Expand Down Expand Up @@ -35,7 +36,7 @@ internal static List<BinaryClassificationMetrics> FromMetrics(IHostEnvironment e
var confusionMatrices = ConfusionMatrix.Create(env, confusionMatrix).GetEnumerator();

int index = 0;
foreach(var metric in metricsEnumerable)
foreach (var metric in metricsEnumerable)
{

if (index++ >= confusionMatriceStartIndex && !confusionMatrices.MoveNext())
Expand All @@ -57,6 +58,7 @@ internal static List<BinaryClassificationMetrics> FromMetrics(IHostEnvironment e
Entropy = metric.Entropy,
F1Score = metric.F1Score,
Auprc = metric.Auprc,
RowTag = metric.RowTag,
ConfusionMatrix = confusionMatrices.Current,
});

Expand Down Expand Up @@ -162,6 +164,12 @@ internal static List<BinaryClassificationMetrics> FromMetrics(IHostEnvironment e
/// </summary>
public ConfusionMatrix ConfusionMatrix { get; private set; }

/// <summary>
/// For cross-validation, this is equal to "Fold N" for per-fold metric rows, "Overall" for the average metrics and "STD" for standard deviation.
/// For non-CV scenarios, this is equal to null
/// </summary>
public string RowTag { get; private set; }

/// <summary>
/// This class contains the public fields necessary to deserialize from IDataView.
/// </summary>
Expand Down Expand Up @@ -200,6 +208,9 @@ private sealed class SerializationClass

[ColumnName(BinaryClassifierEvaluator.AuPrc)]
public Double Auprc;

[ColumnName(ColumnNames.FoldIndex)]
public string RowTag;
#pragma warning restore 649 // never assigned
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/Microsoft.ML/Models/ClassificationMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.ML.Runtime.Api;
using Microsoft.ML.Runtime.Data;
using System.Collections.Generic;
using static Microsoft.ML.Runtime.Data.MetricKinds;

namespace Microsoft.ML.Models
{
Expand Down Expand Up @@ -51,7 +52,8 @@ internal static List<ClassificationMetrics> FromMetrics(IHostEnvironment env, ID
LogLossReduction = metric.LogLossReduction,
TopKAccuracy = metric.TopKAccuracy,
PerClassLogLoss = metric.PerClassLogLoss,
ConfusionMatrix = confusionMatrices.Current
ConfusionMatrix = confusionMatrices.Current,
RowTag = metric.RowTag,
});

}
Expand Down Expand Up @@ -127,6 +129,12 @@ internal static List<ClassificationMetrics> FromMetrics(IHostEnvironment env, ID
/// </remarks>
public double[] PerClassLogLoss { get; private set; }

/// <summary>
/// For cross-validation, this is equal to "Fold N" for per-fold metric rows, "Overall" for the average metrics and "STD" for standard deviation.
/// For non-CV scenarios, this is equal to null
/// </summary>
public string RowTag { get; private set; }

/// <summary>
/// Gets the confusion matrix, or error matrix, of the classifier.
/// </summary>
Expand Down Expand Up @@ -155,6 +163,9 @@ private sealed class SerializationClass

[ColumnName(MultiClassClassifierEvaluator.PerClassLogLoss)]
public double[] PerClassLogLoss;

[ColumnName(ColumnNames.FoldIndex)]
public string RowTag;
#pragma warning restore 649 // never assigned
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/Microsoft.ML/Models/ClusterMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.ML.Runtime.Data;
using System;
using System.Collections.Generic;
using static Microsoft.ML.Runtime.Data.MetricKinds;

namespace Microsoft.ML.Models
{
Expand Down Expand Up @@ -38,6 +39,7 @@ internal static List<ClusterMetrics> FromOverallMetrics(IHostEnvironment env, ID
AvgMinScore = metric.AvgMinScore,
Nmi = metric.Nmi,
Dbi = metric.Dbi,
RowTag = metric.RowTag,
});
}

Expand Down Expand Up @@ -73,6 +75,12 @@ internal static List<ClusterMetrics> FromOverallMetrics(IHostEnvironment env, ID
/// </remarks>
public double AvgMinScore { get; private set; }

/// <summary>
/// For cross-validation, this is equal to "Fold N" for per-fold metric rows, "Overall" for the average metrics and "STD" for standard deviation.
/// For non-CV scenarios, this is equal to null
/// </summary>
public string RowTag { get; private set; }

/// <summary>
/// This class contains the public fields necessary to deserialize from IDataView.
/// </summary>
Expand All @@ -88,6 +96,8 @@ private sealed class SerializationClass
[ColumnName(Runtime.Data.ClusteringEvaluator.AvgMinScore)]
public Double AvgMinScore;

[ColumnName(ColumnNames.FoldIndex)]
public string RowTag;
#pragma warning restore 649 // never assigned
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/Microsoft.ML/Models/RegressionMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.ML.Runtime.Data;
using System;
using System.Collections.Generic;
using static Microsoft.ML.Runtime.Data.MetricKinds;

namespace Microsoft.ML.Models
{
Expand Down Expand Up @@ -40,6 +41,7 @@ internal static List<RegressionMetrics> FromOverallMetrics(IHostEnvironment env,
Rms = metric.Rms,
LossFn = metric.LossFn,
RSquared = metric.RSquared,
RowTag = metric.RowTag,
});
}

Expand Down Expand Up @@ -90,6 +92,12 @@ internal static List<RegressionMetrics> FromOverallMetrics(IHostEnvironment env,
/// </summary>
public double RSquared { get; private set; }

/// <summary>
/// For cross-validation, this is equal to "Fold N" for per-fold metric rows, "Overall" for the average metrics and "STD" for standard deviation.
/// For non-CV scenarios, this is equal to null
/// </summary>
public string RowTag { get; private set; }

/// <summary>
/// This class contains the public fields necessary to deserialize from IDataView.
/// </summary>
Expand All @@ -110,6 +118,9 @@ private sealed class SerializationClass

[ColumnName(Runtime.Data.RegressionEvaluator.RSquared)]
public Double RSquared;

[ColumnName(ColumnNames.FoldIndex)]
public string RowTag;
#pragma warning restore 649 // never assigned
}
}
Expand Down