Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions 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 @@ -57,6 +58,7 @@ internal static List<BinaryClassificationMetrics> FromMetrics(IHostEnvironment e
Entropy = metric.Entropy,
F1Score = metric.F1Score,
Auprc = metric.Auprc,
FoldIndex = metric.FoldIndex,
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 gives fold number or standard deviation or average across all metrics.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fold number or standard deviation or average across all metrics [](start = 39, length = 63)

let's elaborate, because right now it feels unclear.
Maybe call it 'row tag', and then add a comment that

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.

(whatever the actual strings are).

/// In other cases equal to null.
/// </summary>
public string FoldIndex { 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 FoldIndex;
#pragma warning restore 649 // never assigned
}
}
Expand Down
10 changes: 10 additions & 0 deletions 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 @@ -127,6 +128,12 @@ internal static List<ClassificationMetrics> FromMetrics(IHostEnvironment env, ID
/// </remarks>
public double[] PerClassLogLoss { get; private set; }

/// <summary>
/// For cross validation gives fold number or standard deviation or average across all metrics.
/// In other cases equal to null.
/// </summary>
public string FoldIndex { get; private set; }

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

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

[ColumnName(ColumnNames.FoldIndex)]
public string FoldIndex;
#pragma warning restore 649 // never assigned
}
}
Expand Down
11 changes: 11 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 @@ -73,6 +74,12 @@ internal static List<ClusterMetrics> FromOverallMetrics(IHostEnvironment env, ID
/// </remarks>
public double AvgMinScore { get; private set; }

/// <summary>
/// For cross validation gives fold number or standard deviation or average across all metrics.
/// In other cases equal to null.
/// </summary>
public string FoldIndex { get; private set; }

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

[ColumnName(ColumnNames.FoldIndex)]
public string FoldIndex;


#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,
FoldIndex = metric.FoldIndex,
});
}

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 gives fold number or standard deviation or average across all metrics.
/// In other cases equal to null.
/// </summary>
public string FoldIndex { 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 FoldIndex;
#pragma warning restore 649 // never assigned
}
}
Expand Down