Skip to content

Commit

Permalink
One name for MulticlassClassification (#2919)
Browse files Browse the repository at this point in the history
  • Loading branch information
artidoro authored Mar 13, 2019
1 parent 4dbc327 commit 726d486
Show file tree
Hide file tree
Showing 91 changed files with 399 additions and 399 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.ML.Samples.Static
{
class LightGBMMulticlassWithInMemoryData
{
public void MultiClassLightGbmStaticPipelineWithInMemoryData()
public void MulticlassLightGbmStaticPipelineWithInMemoryData()
{
// Create a general context for ML.NET operations. It can be used for exception tracking and logging,
// as a catalog of available operations and as the source of randomness.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Core/Data/AnnotationUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static class Const
public static class ScoreColumnKind
{
public const string BinaryClassification = "BinaryClassification";
public const string MultiClassClassification = "MultiClassClassification";
public const string MulticlassClassification = "MulticlassClassification";
public const string Regression = "Regression";
public const string Ranking = "Ranking";
public const string Clustering = "Clustering";
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Core/Prediction/IPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal enum PredictionKind
Custom = 1,

BinaryClassification = 2,
MultiClassClassification = 3,
MulticlassClassification = 3,
Regression = 4,
MultiOutputRegression = 5,
Ranking = 6,
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Core/Prediction/ITrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Microsoft.ML
[BestFriend]
internal delegate void SignatureBinaryClassifierTrainer();
[BestFriend]
internal delegate void SignatureMultiClassClassifierTrainer();
internal delegate void SignatureMulticlassClassifierTrainer();
[BestFriend]
internal delegate void SignatureRegressorTrainer();
[BestFriend]
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Data/DataLoadSave/TransformerChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static TransformerChain<ITransformer> LoadFrom(IHostEnvironment env, Stre
if (predictor.PredictionKind == PredictionKind.BinaryClassification)
pred = new BinaryPredictionTransformer<IPredictorProducing<float>>(env, predictor as IPredictorProducing<float>, chain.Schema,
roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value);
else if (predictor.PredictionKind == PredictionKind.MultiClassClassification)
else if (predictor.PredictionKind == PredictionKind.MulticlassClassification)
pred = new MulticlassPredictionTransformer<IPredictorProducing<VBuffer<float>>>(env,
predictor as IPredictorProducing<VBuffer<float>>, chain.Schema,
roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value,
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.ML.Data/EntryPoints/InputBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,11 +839,11 @@ public static class PipelineSweeperSupportedMetrics
{
public static new string ToString() => "SupportedMetric";
public const string Auc = BinaryClassifierEvaluator.Auc;
public const string AccuracyMicro = Data.MultiClassClassifierEvaluator.AccuracyMicro;
public const string AccuracyMacro = MultiClassClassifierEvaluator.AccuracyMacro;
public const string AccuracyMicro = Data.MulticlassClassificationEvaluator.AccuracyMicro;
public const string AccuracyMacro = MulticlassClassificationEvaluator.AccuracyMacro;
public const string F1 = BinaryClassifierEvaluator.F1;
public const string AuPrc = BinaryClassifierEvaluator.AuPrc;
public const string TopKAccuracy = MultiClassClassifierEvaluator.TopKAccuracy;
public const string TopKAccuracy = MulticlassClassificationEvaluator.TopKAccuracy;
public const string L1 = RegressionLossEvaluatorBase<MultiOutputRegressionEvaluator.Aggregator>.L1;
public const string L2 = RegressionLossEvaluatorBase<MultiOutputRegressionEvaluator.Aggregator>.L2;
public const string Rms = RegressionLossEvaluatorBase<MultiOutputRegressionEvaluator.Aggregator>.Rms;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Data/Evaluators/EvaluatorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>> Instanc
var tmp = new Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>>
{
{ AnnotationUtils.Const.ScoreColumnKind.BinaryClassification, env => new BinaryClassifierMamlEvaluator(env, new BinaryClassifierMamlEvaluator.Arguments()) },
{ AnnotationUtils.Const.ScoreColumnKind.MultiClassClassification, env => new MultiClassMamlEvaluator(env, new MultiClassMamlEvaluator.Arguments()) },
{ AnnotationUtils.Const.ScoreColumnKind.MulticlassClassification, env => new MulticlassClassificationMamlEvaluator(env, new MulticlassClassificationMamlEvaluator.Arguments()) },
{ AnnotationUtils.Const.ScoreColumnKind.Regression, env => new RegressionMamlEvaluator(env, new RegressionMamlEvaluator.Arguments()) },
{ AnnotationUtils.Const.ScoreColumnKind.MultiOutputRegression, env => new MultiOutputRegressionMamlEvaluator(env, new MultiOutputRegressionMamlEvaluator.Arguments()) },
{ AnnotationUtils.Const.ScoreColumnKind.QuantileRegression, env => new QuantileRegressionMamlEvaluator(env, new QuantileRegressionMamlEvaluator.Arguments()) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
namespace Microsoft.ML.Data
{
/// <summary>
/// Evaluation results for multi-class classifiers.
/// Evaluation results for multi-class classification trainers.
/// </summary>
public sealed class MultiClassClassifierMetrics
public sealed class MulticlassClassificationMetrics
{
/// <summary>
/// Gets the average log-loss of the classifier.
Expand Down Expand Up @@ -83,22 +83,22 @@ public sealed class MultiClassClassifierMetrics
/// </remarks>
public IReadOnlyList<double> PerClassLogLoss { get; }

internal MultiClassClassifierMetrics(IExceptionContext ectx, DataViewRow overallResult, int topK)
internal MulticlassClassificationMetrics(IExceptionContext ectx, DataViewRow overallResult, int topK)
{
double FetchDouble(string name) => RowCursorUtils.Fetch<double>(ectx, overallResult, name);
MicroAccuracy = FetchDouble(MultiClassClassifierEvaluator.AccuracyMicro);
MacroAccuracy = FetchDouble(MultiClassClassifierEvaluator.AccuracyMacro);
LogLoss = FetchDouble(MultiClassClassifierEvaluator.LogLoss);
LogLossReduction = FetchDouble(MultiClassClassifierEvaluator.LogLossReduction);
MicroAccuracy = FetchDouble(MulticlassClassificationEvaluator.AccuracyMicro);
MacroAccuracy = FetchDouble(MulticlassClassificationEvaluator.AccuracyMacro);
LogLoss = FetchDouble(MulticlassClassificationEvaluator.LogLoss);
LogLossReduction = FetchDouble(MulticlassClassificationEvaluator.LogLossReduction);
TopK = topK;
if (topK > 0)
TopKAccuracy = FetchDouble(MultiClassClassifierEvaluator.TopKAccuracy);
TopKAccuracy = FetchDouble(MulticlassClassificationEvaluator.TopKAccuracy);

var perClassLogLoss = RowCursorUtils.Fetch<VBuffer<double>>(ectx, overallResult, MultiClassClassifierEvaluator.PerClassLogLoss);
var perClassLogLoss = RowCursorUtils.Fetch<VBuffer<double>>(ectx, overallResult, MulticlassClassificationEvaluator.PerClassLogLoss);
PerClassLogLoss = perClassLogLoss.DenseValues().ToImmutableArray();
}

internal MultiClassClassifierMetrics(double accuracyMicro, double accuracyMacro, double logLoss, double logLossReduction,
internal MulticlassClassificationMetrics(double accuracyMicro, double accuracyMacro, double logLoss, double logLossReduction,
int topK, double topKAccuracy, double[] perClassLogLoss)
{
MicroAccuracy = accuracyMicro;
Expand Down
Loading

0 comments on commit 726d486

Please sign in to comment.