diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/FieldAwareFactorizationMachinewWithOptions.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/FieldAwareFactorizationMachinewWithOptions.cs index f4ec502d1f..cae0684039 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/FieldAwareFactorizationMachinewWithOptions.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/FieldAwareFactorizationMachinewWithOptions.cs @@ -32,8 +32,8 @@ public static void Example() FieldAwareFactorizationMachine( new FieldAwareFactorizationMachineBinaryClassificationTrainer.Options { - FeatureColumn = "Features", - LabelColumn = "Sentiment", + FeatureColumnName = "Features", + LabelColumnName = "Sentiment", LearningRate = 0.1f, NumberOfIterations = 10 })); diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs index f9b21cc9f9..e5a01cd4f7 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs @@ -62,8 +62,8 @@ public static void Example() var advancedPipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features") .Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent( new SdcaBinaryTrainer.Options { - LabelColumn = "Sentiment", - FeatureColumn = "Features", + LabelColumnName = "Sentiment", + FeatureColumnName = "Features", ConvergenceTolerance = 0.01f, // The learning rate for adjusting bias from being regularized NumThreads = 2, // Degree of lock-free parallelism })); diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/MulticlassClassification/LightGbmWithOptions.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/MulticlassClassification/LightGbmWithOptions.cs index 79368c9ebf..a149aa9199 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/MulticlassClassification/LightGbmWithOptions.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/MulticlassClassification/LightGbmWithOptions.cs @@ -35,8 +35,8 @@ public static void Example() var pipeline = mlContext.Transforms.Conversion.MapValueToKey("LabelIndex", "Label") .Append(mlContext.MulticlassClassification.Trainers.LightGbm(new Options { - LabelColumn = "LabelIndex", - FeatureColumn = "Features", + LabelColumnName = "LabelIndex", + FeatureColumnName = "Features", Booster = new DartBooster.Options { DropRate = 0.15, diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/Regression/LightGbmWithOptions.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/Regression/LightGbmWithOptions.cs index c1c82a9735..e93eeb3f96 100644 --- a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/Regression/LightGbmWithOptions.cs +++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/Regression/LightGbmWithOptions.cs @@ -38,7 +38,7 @@ public static void Example() var pipeline = mlContext.Transforms.Concatenate("Features", featureNames) .Append(mlContext.Regression.Trainers.LightGbm(new Options { - LabelColumn = labelName, + LabelColumnName = labelName, NumLeaves = 4, MinDataPerLeaf = 6, LearningRate = 0.001, diff --git a/src/Microsoft.ML.Data/EntryPoints/EntryPointNode.cs b/src/Microsoft.ML.Data/EntryPoints/EntryPointNode.cs index f294bb3452..fac0d77753 100644 --- a/src/Microsoft.ML.Data/EntryPoints/EntryPointNode.cs +++ b/src/Microsoft.ML.Data/EntryPoints/EntryPointNode.cs @@ -509,9 +509,9 @@ private EntryPointNode(IHostEnvironment env, IChannel ch, RunContext context, throw _host.Except($"The following required inputs were not provided: {String.Join(", ", missing)}"); var inputInstance = _inputBuilder.GetInstance(); - SetColumnArgument(ch, inputInstance, "LabelColumn", label, "label", typeof(CommonInputs.ITrainerInputWithLabel)); - SetColumnArgument(ch, inputInstance, "GroupIdColumn", group, "group Id", typeof(CommonInputs.ITrainerInputWithGroupId)); - SetColumnArgument(ch, inputInstance, "WeightColumn", weight, "weight", typeof(CommonInputs.ITrainerInputWithWeight), typeof(CommonInputs.IUnsupervisedTrainerWithWeight)); + SetColumnArgument(ch, inputInstance, "LabelColumnName", label, "label", typeof(CommonInputs.ITrainerInputWithLabel)); + SetColumnArgument(ch, inputInstance, "RowGroupColumnName", group, "group Id", typeof(CommonInputs.ITrainerInputWithGroupId)); + SetColumnArgument(ch, inputInstance, "ExampleWeightColumnName", weight, "weight", typeof(CommonInputs.ITrainerInputWithWeight), typeof(CommonInputs.IUnsupervisedTrainerWithWeight)); SetColumnArgument(ch, inputInstance, "NameColumn", name, "name"); // Validate outputs. diff --git a/src/Microsoft.ML.Data/EntryPoints/InputBase.cs b/src/Microsoft.ML.Data/EntryPoints/InputBase.cs index 36393f9aca..f28caf6be9 100644 --- a/src/Microsoft.ML.Data/EntryPoints/InputBase.cs +++ b/src/Microsoft.ML.Data/EntryPoints/InputBase.cs @@ -9,24 +9,10 @@ using Microsoft.ML.CommandLine; using Microsoft.ML.Data; using Microsoft.ML.Data.IO; +using Microsoft.ML.Trainers; namespace Microsoft.ML.EntryPoints { - /// - /// The base class for all transform inputs. - /// - [TlcModule.EntryPointKind(typeof(CommonInputs.ITransformInput))] - public abstract class TransformInputBase - { - /// - /// The input dataset. Used only in entry-point methods, since the normal API mechanism for feeding in a dataset to - /// create an is to use the method. - /// - [BestFriend] - [Argument(ArgumentType.Required, HelpText = "Input dataset", Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly, SortOrder = 1)] - internal IDataView Data; - } - [BestFriend] internal enum CachingOptions { @@ -35,89 +21,12 @@ internal enum CachingOptions None } - /// - /// The base class for all learner inputs. - /// - [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInput))] - public abstract class LearnerInputBase - { - /// - /// The data to be used for training. Used only in entry-points, since in the API the expected mechanism is - /// that the user will use the or some other train - /// method. - /// - [BestFriend] - [Argument(ArgumentType.Required, ShortName = "data", HelpText = "The data to be used for training", SortOrder = 1, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - internal IDataView TrainingData; - - /// - /// Column to use for features. - /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for features", ShortName = "feat", SortOrder = 2, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - public string FeatureColumn = DefaultColumnNames.Features; - - /// - /// Normalize option for the feature column. Used only in entry-points, since in the API the user is expected to do this themselves. - /// - [BestFriend] - [Argument(ArgumentType.AtMostOnce, HelpText = "Normalize option for the feature column", ShortName = "norm", SortOrder = 5, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - internal NormalizeOption NormalizeFeatures = NormalizeOption.Auto; - - /// - /// Whether learner should cache input training data. Used only in entry-points, since the intended API mechanism - /// is that the user will use the or other method - /// like . - /// - [BestFriend] - [Argument(ArgumentType.LastOccurenceWins, HelpText = "Whether learner should cache input training data", ShortName = "cache", SortOrder = 6, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - internal CachingOptions Caching = CachingOptions.Auto; - } - - /// - /// The base class for all learner inputs that support a Label column. - /// - [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithLabel))] - public abstract class LearnerInputBaseWithLabel : LearnerInputBase - { - /// - /// Column to use for labels. - /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for labels", ShortName = "lab", SortOrder = 3, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - public string LabelColumn = DefaultColumnNames.Label; - } - - // REVIEW: This is a known antipattern, but the solution involves the decorator pattern which can't be used in this case. - /// - /// The base class for all learner inputs that support a weight column. - /// - [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithWeight))] - public abstract class LearnerInputBaseWithWeight : LearnerInputBaseWithLabel - { - /// - /// The name of the example weight column. - /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - public string WeightColumn = null; - } - - /// - /// The base class for all unsupervised learner inputs that support a weight column. - /// - [TlcModule.EntryPointKind(typeof(CommonInputs.IUnsupervisedTrainerWithWeight))] - public abstract class UnsupervisedLearnerInputBaseWithWeight : LearnerInputBase - { - /// - /// Column to use for example weight. - /// - [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - public string WeightColumn = null; - } - /// /// The base class for all evaluators inputs. /// [TlcModule.EntryPointKind(typeof(CommonInputs.IEvaluatorInput))] - public abstract class EvaluateInputBase + [BestFriend] + internal abstract class EvaluateInputBase { [Argument(ArgumentType.Required, ShortName = "data", HelpText = "The data to be used for evaluation.", SortOrder = 1, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] public IDataView Data; @@ -126,18 +35,8 @@ public abstract class EvaluateInputBase public string NameColumn = DefaultColumnNames.Name; } - [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithGroupId))] - public abstract class LearnerInputBaseWithGroupId : LearnerInputBaseWithWeight - { - /// - /// Column to use for example groupId. - /// - [Argument(ArgumentType.AtMostOnce, Name = "GroupIdColumn", HelpText = "Column to use for example groupId", ShortName = "groupId", SortOrder = 5, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] - public string GroupIdColumn = null; - } - [BestFriend] - internal static class LearnerEntryPointsUtils + internal static class TrainerEntryPointsUtils { public static string FindColumn(IExceptionContext ectx, DataViewSchema schema, Optional value) { @@ -165,13 +64,13 @@ public static TOut Train(IHost host, TArg input, Func>> getCustom = null, ICalibratorTrainerFactory calibrator = null, int maxCalibrationExamples = 0) - where TArg : LearnerInputBase + where TArg : TrainerInputBase where TOut : CommonOutputs.TrainerOutput, new() { using (var ch = host.Start("Training")) { var schema = input.TrainingData.Schema; - var feature = FindColumn(ch, schema, input.FeatureColumn); + var feature = FindColumn(ch, schema, input.FeatureColumnName); var label = getLabel?.Invoke(); var weight = getWeight?.Invoke(); var group = getGroup?.Invoke(); diff --git a/src/Microsoft.ML.Data/Prediction/Calibrator.cs b/src/Microsoft.ML.Data/Prediction/Calibrator.cs index 028b38531a..46e8063df0 100644 --- a/src/Microsoft.ML.Data/Prediction/Calibrator.cs +++ b/src/Microsoft.ML.Data/Prediction/Calibrator.cs @@ -19,6 +19,7 @@ using Microsoft.ML.Model; using Microsoft.ML.Model.OnnxConverter; using Microsoft.ML.Model.Pfa; +using Microsoft.ML.Transforms; using Newtonsoft.Json.Linq; [assembly: LoadableClass(PlattCalibratorTrainer.Summary, typeof(PlattCalibratorTrainer), null, typeof(SignatureCalibrator), diff --git a/src/Microsoft.ML.Data/Training/TrainerInputBase.cs b/src/Microsoft.ML.Data/Training/TrainerInputBase.cs new file mode 100644 index 0000000000..1387c27220 --- /dev/null +++ b/src/Microsoft.ML.Data/Training/TrainerInputBase.cs @@ -0,0 +1,113 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using Microsoft.Data.DataView; +using Microsoft.ML.Calibrators; +using Microsoft.ML.CommandLine; +using Microsoft.ML.Data; +using Microsoft.ML.Data.IO; +using Microsoft.ML.EntryPoints; + +namespace Microsoft.ML.Trainers +{ + /// + /// The base class for all trainer inputs. + /// + [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInput))] + public abstract class TrainerInputBase + { + private protected TrainerInputBase() { } + + /// + /// The data to be used for training. Used only in entry-points, since in the API the expected mechanism is + /// that the user will use the or some other train + /// method. + /// + [BestFriend] + [Argument(ArgumentType.Required, ShortName = "data", HelpText = "The data to be used for training", SortOrder = 1, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + internal IDataView TrainingData; + + /// + /// Column to use for features. + /// + [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for features", ShortName = "feat", SortOrder = 2, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + public string FeatureColumnName = DefaultColumnNames.Features; + + /// + /// Normalize option for the feature column. Used only in entry-points, since in the API the user is expected to do this themselves. + /// + [BestFriend] + [Argument(ArgumentType.AtMostOnce, HelpText = "Normalize option for the feature column", ShortName = "norm", SortOrder = 5, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + internal NormalizeOption NormalizeFeatures = NormalizeOption.Auto; + + /// + /// Whether learner should cache input training data. Used only in entry-points, since the intended API mechanism + /// is that the user will use the or other method + /// like . + /// + [BestFriend] + [Argument(ArgumentType.LastOccurenceWins, HelpText = "Whether learner should cache input training data", ShortName = "cache", SortOrder = 6, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + internal CachingOptions Caching = CachingOptions.Auto; + } + + /// + /// The base class for all learner inputs that support a Label column. + /// + [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithLabel))] + public abstract class TrainerInputBaseWithLabel : TrainerInputBase + { + private protected TrainerInputBaseWithLabel() { } + + /// + /// Column to use for labels. + /// + [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for labels", ShortName = "lab", SortOrder = 3, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + public string LabelColumnName = DefaultColumnNames.Label; + } + + // REVIEW: This is a known antipattern, but the solution involves the decorator pattern which can't be used in this case. + /// + /// The base class for all learner inputs that support a weight column. + /// + [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithWeight))] + public abstract class TrainerInputBaseWithWeight : TrainerInputBaseWithLabel + { + private protected TrainerInputBaseWithWeight() { } + + /// + /// Column to use for example weight. + /// + [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + public string ExampleWeightColumnName = null; + } + + /// + /// The base class for all unsupervised learner inputs that support a weight column. + /// + [TlcModule.EntryPointKind(typeof(CommonInputs.IUnsupervisedTrainerWithWeight))] + public abstract class UnsupervisedTrainerInputBaseWithWeight : TrainerInputBase + { + private protected UnsupervisedTrainerInputBaseWithWeight() { } + + /// + /// Column to use for example weight. + /// + [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example weight", ShortName = "weight", SortOrder = 4, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + public string ExampleWeightColumnName = null; + } + + [TlcModule.EntryPointKind(typeof(CommonInputs.ITrainerInputWithGroupId))] + public abstract class TrainerInputBaseWithGroupId : TrainerInputBaseWithWeight + { + private protected TrainerInputBaseWithGroupId() { } + + /// + /// Column to use for example groupId. + /// + [Argument(ArgumentType.AtMostOnce, HelpText = "Column to use for example groupId", ShortName = "groupId", SortOrder = 5, Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly)] + public string RowGroupColumnName = null; + } +} diff --git a/src/Microsoft.ML.Data/Transforms/NopTransform.cs b/src/Microsoft.ML.Data/Transforms/NopTransform.cs index 526a827b4b..43068d9e21 100644 --- a/src/Microsoft.ML.Data/Transforms/NopTransform.cs +++ b/src/Microsoft.ML.Data/Transforms/NopTransform.cs @@ -9,6 +9,7 @@ using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(NopTransform.Summary, typeof(NopTransform), null, typeof(SignatureLoadDataTransform), "", NopTransform.LoaderSignature)] diff --git a/src/Microsoft.ML.Data/Transforms/TransformInputBase.cs b/src/Microsoft.ML.Data/Transforms/TransformInputBase.cs new file mode 100644 index 0000000000..e123379824 --- /dev/null +++ b/src/Microsoft.ML.Data/Transforms/TransformInputBase.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Data.DataView; +using Microsoft.ML.CommandLine; +using Microsoft.ML.EntryPoints; + +namespace Microsoft.ML.Transforms +{ + /// + /// The base class for all transform inputs. + /// + [TlcModule.EntryPointKind(typeof(CommonInputs.ITransformInput))] + public abstract class TransformInputBase + { + private protected TransformInputBase() { } + + /// + /// The input dataset. Used only in entry-point methods, since the normal API mechanism for feeding in a dataset to + /// create an is to use the method. + /// + [BestFriend] + [Argument(ArgumentType.Required, HelpText = "Input dataset", Visibility = ArgumentAttribute.VisibilityType.EntryPointsOnly, SortOrder = 1)] + internal IDataView Data; + } +} diff --git a/src/Microsoft.ML.Ensemble/EntryPoints/Ensemble.cs b/src/Microsoft.ML.Ensemble/EntryPoints/Ensemble.cs index afec3af471..fab5ecfe2c 100644 --- a/src/Microsoft.ML.Ensemble/EntryPoints/Ensemble.cs +++ b/src/Microsoft.ML.Ensemble/EntryPoints/Ensemble.cs @@ -20,9 +20,9 @@ public static CommonOutputs.BinaryClassificationOutput CreateBinaryEnsemble(IHos host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new EnsembleTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } [TlcModule.EntryPoint(Name = "Trainers.EnsembleClassification", Desc = "Train multiclass ensemble.", UserName = EnsembleTrainer.UserNameValue)] @@ -33,9 +33,9 @@ public static CommonOutputs.MulticlassClassificationOutput CreateMultiClassEnsem host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new MulticlassDataPartitionEnsembleTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } [TlcModule.EntryPoint(Name = "Trainers.EnsembleRegression", Desc = "Train regression ensemble.", UserName = EnsembleTrainer.UserNameValue)] @@ -46,9 +46,9 @@ public static CommonOutputs.RegressionOutput CreateRegressionEnsemble(IHostEnvir host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new RegressionEnsembleTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } } } diff --git a/src/Microsoft.ML.Ensemble/Trainer/EnsembleTrainerBase.cs b/src/Microsoft.ML.Ensemble/Trainer/EnsembleTrainerBase.cs index 13e435e2e4..f650bb296e 100644 --- a/src/Microsoft.ML.Ensemble/Trainer/EnsembleTrainerBase.cs +++ b/src/Microsoft.ML.Ensemble/Trainer/EnsembleTrainerBase.cs @@ -22,7 +22,7 @@ internal abstract class EnsembleTrainerBase where TCombiner : class, IOutputCombiner { - public abstract class ArgumentsBase : LearnerInputBaseWithLabel + public abstract class ArgumentsBase : TrainerInputBaseWithLabel { #pragma warning disable CS0649 // These are set via reflection. [Argument(ArgumentType.AtMostOnce, diff --git a/src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs b/src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs index a5f0c93604..3d44c3d30f 100644 --- a/src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs +++ b/src/Microsoft.ML.Ensemble/Trainer/Multiclass/MulticlassDataPartitionEnsembleTrainer.cs @@ -63,7 +63,7 @@ public Arguments() // non-default column names. Unfortuantely no method of resolving this temporary strikes me as being any // less laborious than the proper fix, which is that this "meta" component should itself be a trainer // estimator, as opposed to a regular trainer. - var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumn, FeatureColumn); + var trainerEstimator = new MulticlassLogisticRegression(env, LabelColumnName, FeatureColumnName); return TrainerUtils.MapTrainerEstimatorToTrainer(env, trainerEstimator); }) diff --git a/src/Microsoft.ML.EntryPoints/ModelOperations.cs b/src/Microsoft.ML.EntryPoints/ModelOperations.cs index ebd2a33fa7..41ba5d93ca 100644 --- a/src/Microsoft.ML.EntryPoints/ModelOperations.cs +++ b/src/Microsoft.ML.EntryPoints/ModelOperations.cs @@ -9,6 +9,7 @@ using Microsoft.ML.Data; using Microsoft.ML.EntryPoints; using Microsoft.ML.Trainers; +using Microsoft.ML.Transforms; [assembly: LoadableClass(typeof(void), typeof(ModelOperations), null, typeof(SignatureEntryPointModule), "ModelOperations")] @@ -52,7 +53,7 @@ public sealed class PredictorModelOutput public PredictorModel PredictorModel; } - public sealed class CombineOvaPredictorModelsInput : LearnerInputBaseWithWeight + public sealed class CombineOvaPredictorModelsInput : TrainerInputBaseWithWeight { [Argument(ArgumentType.Multiple, HelpText = "Input models", SortOrder = 1)] public PredictorModel[] ModelArray; @@ -142,13 +143,13 @@ public static PredictorModelOutput CombineOvaModels(IHostEnvironment env, Combin using (var ch = host.Start("CombineOvaModels")) { var schema = normalizedView.Schema; - var label = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.LabelColumn), - input.LabelColumn, + var label = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.LabelColumnName), + input.LabelColumnName, DefaultColumnNames.Label); - var feature = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.FeatureColumn), - input.FeatureColumn, DefaultColumnNames.Features); - var weight = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.WeightColumn), - input.WeightColumn, DefaultColumnNames.Weight); + var feature = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.FeatureColumnName), + input.FeatureColumnName, DefaultColumnNames.Features); + var weight = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(input.ExampleWeightColumnName), + input.ExampleWeightColumnName, DefaultColumnNames.Weight); var data = new RoleMappedData(normalizedView, label, feature, null, weight); return new PredictorModelOutput diff --git a/src/Microsoft.ML.EntryPoints/OneVersusAllMacro.cs b/src/Microsoft.ML.EntryPoints/OneVersusAllMacro.cs index 716cc0b9fa..4fb062cced 100644 --- a/src/Microsoft.ML.EntryPoints/OneVersusAllMacro.cs +++ b/src/Microsoft.ML.EntryPoints/OneVersusAllMacro.cs @@ -28,7 +28,7 @@ public sealed class SubGraphOutput public Var Model; } - public sealed class Arguments : LearnerInputBaseWithWeight + public sealed class Arguments : TrainerInputBaseWithWeight { // This is the subgraph that describes how to train a model for submodel. It should // accept one IDataView input and output one IPredictorModel output. @@ -119,13 +119,13 @@ private static int GetNumberOfClasses(IHostEnvironment env, Arguments input, out { // RoleMappedData creation var schema = input.TrainingData.Schema; - label = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.LabelColumn), - input.LabelColumn, + label = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.LabelColumnName), + input.LabelColumnName, DefaultColumnNames.Label); - var feature = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.FeatureColumn), - input.FeatureColumn, DefaultColumnNames.Features); - var weight = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.WeightColumn), - input.WeightColumn, DefaultColumnNames.Weight); + var feature = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.FeatureColumnName), + input.FeatureColumnName, DefaultColumnNames.Features); + var weight = TrainUtils.MatchNameOrDefaultOrNull(ch, schema, nameof(Arguments.ExampleWeightColumnName), + input.ExampleWeightColumnName, DefaultColumnNames.Weight); // Get number of classes var data = new RoleMappedData(input.TrainingData, label, feature, null, weight); @@ -164,8 +164,8 @@ public static CommonOutputs.MacroOutput OneVersusAll( // produces single multiclass predictor model. var combineArgs = new ModelOperations.CombineOvaPredictorModelsInput(); combineArgs.Caching = input.Caching; - combineArgs.FeatureColumn = input.FeatureColumn; - combineArgs.LabelColumn = input.LabelColumn; + combineArgs.FeatureColumnName = input.FeatureColumnName; + combineArgs.LabelColumnName = input.LabelColumnName; combineArgs.NormalizeFeatures = input.NormalizeFeatures; combineArgs.UseProbabilities = input.UseProbabilities; diff --git a/src/Microsoft.ML.EntryPoints/TrainTestMacro.cs b/src/Microsoft.ML.EntryPoints/TrainTestMacro.cs index cba12df109..f95eb19dc3 100644 --- a/src/Microsoft.ML.EntryPoints/TrainTestMacro.cs +++ b/src/Microsoft.ML.EntryPoints/TrainTestMacro.cs @@ -209,7 +209,7 @@ public static CommonOutputs.MacroOutput TrainTest( subGraphNodes.Add(scoreNode); var evalDataVarName = scoreNodeOutputScoredData.VarName; - // REVIEW: add similar support for FeatureColumn. + // REVIEW: add similar support for FeatureColumnName. var settings = new MacroUtils.EvaluatorSettings { LabelColumn = input.LabelColumn, diff --git a/src/Microsoft.ML.FastTree/FastTree.cs b/src/Microsoft.ML.FastTree/FastTree.cs index 5acc742b81..0ac9799cc3 100644 --- a/src/Microsoft.ML.FastTree/FastTree.cs +++ b/src/Microsoft.ML.FastTree/FastTree.cs @@ -118,10 +118,10 @@ private protected FastTreeTrainerBase(IHostEnvironment env, FastTreeTrainerOptions.NumTrees = numTrees; FastTreeTrainerOptions.MinDocumentsInLeafs = minDatapointsInLeaves; - FastTreeTrainerOptions.LabelColumn = label.Name; - FastTreeTrainerOptions.FeatureColumn = featureColumn; - FastTreeTrainerOptions.WeightColumn = weightColumn; - FastTreeTrainerOptions.GroupIdColumn = groupIdColumn; + FastTreeTrainerOptions.LabelColumnName = label.Name; + FastTreeTrainerOptions.FeatureColumnName = featureColumn; + FastTreeTrainerOptions.ExampleWeightColumnName = weightColumn; + FastTreeTrainerOptions.RowGroupColumnName = groupIdColumn; // The discretization step renders this trainer non-parametric, and therefore it does not need normalization. // Also since it builds its own internal discretized columnar structures, it cannot benefit from caching. @@ -140,8 +140,8 @@ private protected FastTreeTrainerBase(IHostEnvironment env, /// Constructor that is used when invoking the classes deriving from this, through maml. /// private protected FastTreeTrainerBase(IHostEnvironment env, TOptions options, SchemaShape.Column label) - : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn), - TrainerUtils.MakeU4ScalarColumn(options.GroupIdColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName), + TrainerUtils.MakeU4ScalarColumn(options.RowGroupColumnName)) { Host.CheckValue(options, nameof(options)); FastTreeTrainerOptions = options; diff --git a/src/Microsoft.ML.FastTree/FastTreeArguments.cs b/src/Microsoft.ML.FastTree/FastTreeArguments.cs index 11bb7a3e2c..be8ca0f0cc 100644 --- a/src/Microsoft.ML.FastTree/FastTreeArguments.cs +++ b/src/Microsoft.ML.FastTree/FastTreeArguments.cs @@ -150,7 +150,7 @@ internal static class Defaults public const double LearningRates = 0.2; } - public abstract class TreeOptions : LearnerInputBaseWithGroupId + public abstract class TreeOptions : TrainerInputBaseWithGroupId { /// /// Allows to choose Parallel FastTree Learning Algorithm. diff --git a/src/Microsoft.ML.FastTree/FastTreeClassification.cs b/src/Microsoft.ML.FastTree/FastTreeClassification.cs index 3fb48c1489..51b406f50e 100644 --- a/src/Microsoft.ML.FastTree/FastTreeClassification.cs +++ b/src/Microsoft.ML.FastTree/FastTreeClassification.cs @@ -146,7 +146,7 @@ internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastTreeBinaryClassificationTrainer(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { // Set the sigmoid parameter to the 2 * learning rate, for traditional FastTreeClassification loss _sigmoidParameter = 2.0 * FastTreeTrainerOptions.LearningRates; @@ -411,11 +411,11 @@ public static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnvironm host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastTreeBinaryClassificationTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.FastTree/FastTreeRanking.cs b/src/Microsoft.ML.FastTree/FastTreeRanking.cs index bd76ab847f..88e5c41485 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRanking.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRanking.cs @@ -89,7 +89,7 @@ internal FastTreeRankingTrainer(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastTreeRankingTrainer(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } @@ -1169,11 +1169,11 @@ public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, Fas host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastTreeRankingTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.FastTree/FastTreeRegression.cs b/src/Microsoft.ML.FastTree/FastTreeRegression.cs index 5b3df90aa8..3533adfd6a 100644 --- a/src/Microsoft.ML.FastTree/FastTreeRegression.cs +++ b/src/Microsoft.ML.FastTree/FastTreeRegression.cs @@ -77,7 +77,7 @@ internal FastTreeRegressionTrainer(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastTreeRegressionTrainer(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } @@ -507,11 +507,11 @@ public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment en host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastTreeRegressionTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs index e87c54f34f..b18ed335f3 100644 --- a/src/Microsoft.ML.FastTree/FastTreeTweedie.cs +++ b/src/Microsoft.ML.FastTree/FastTreeTweedie.cs @@ -79,7 +79,7 @@ internal FastTreeTweedieTrainer(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastTreeTweedieTrainer(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { Initialize(); } @@ -524,11 +524,11 @@ public static CommonOutputs.RegressionOutput TrainTweedieRegression(IHostEnviron host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastTreeTweedieTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.FastTree/GamClassification.cs b/src/Microsoft.ML.FastTree/GamClassification.cs index 6d2b110a97..ba75b315d6 100644 --- a/src/Microsoft.ML.FastTree/GamClassification.cs +++ b/src/Microsoft.ML.FastTree/GamClassification.cs @@ -50,7 +50,7 @@ public sealed class Options : OptionsBase /// Initializes a new instance of /// internal BinaryClassificationGamTrainer(IHostEnvironment env, Options options) - : base(env, options, LoadNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, options, LoadNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { _sigmoidParameter = 1; } diff --git a/src/Microsoft.ML.FastTree/GamRegression.cs b/src/Microsoft.ML.FastTree/GamRegression.cs index 74a9481e11..fc27185c02 100644 --- a/src/Microsoft.ML.FastTree/GamRegression.cs +++ b/src/Microsoft.ML.FastTree/GamRegression.cs @@ -39,7 +39,7 @@ public partial class Options : OptionsBase private protected override PredictionKind PredictionKind => PredictionKind.Regression; internal RegressionGamTrainer(IHostEnvironment env, Options options) - : base(env, options, LoadNameValue, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) { } + : base(env, options, LoadNameValue, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } /// /// Initializes a new instance of diff --git a/src/Microsoft.ML.FastTree/GamTrainer.cs b/src/Microsoft.ML.FastTree/GamTrainer.cs index fb081176b0..214a661000 100644 --- a/src/Microsoft.ML.FastTree/GamTrainer.cs +++ b/src/Microsoft.ML.FastTree/GamTrainer.cs @@ -53,7 +53,7 @@ public abstract partial class GamTrainerBase where TOptions : GamTrainerBase.OptionsBase, new() where TPredictor : class { - public abstract class OptionsBase : LearnerInputBaseWithWeight + public abstract class OptionsBase : TrainerInputBaseWithWeight { [Argument(ArgumentType.LastOccurenceWins, HelpText = "The entropy (regularization) coefficient between 0 and 1", ShortName = "e")] public double EntropyCoefficient; @@ -160,11 +160,11 @@ private protected GamTrainerBase(IHostEnvironment env, GamTrainerOptions.LearningRates = learningRate; GamTrainerOptions.MaxBins = maxBins; - GamTrainerOptions.LabelColumn = label.Name; - GamTrainerOptions.FeatureColumn = featureColumn; + GamTrainerOptions.LabelColumnName = label.Name; + GamTrainerOptions.FeatureColumnName = featureColumn; if (weightColumn != null) - GamTrainerOptions.WeightColumn = weightColumn; + GamTrainerOptions.ExampleWeightColumnName = weightColumn; Info = new TrainerInfo(normalization: false, calibration: NeedCalibration, caching: false, supportValid: true); _gainConfidenceInSquaredStandardDeviations = Math.Pow(ProbabilityFunctions.Probit(1 - (1 - GamTrainerOptions.GainConfidenceLevel) * 0.5), 2); @@ -174,8 +174,8 @@ private protected GamTrainerBase(IHostEnvironment env, } private protected GamTrainerBase(IHostEnvironment env, TOptions options, string name, SchemaShape.Column label) - : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), - label, TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), + label, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName)) { Contracts.CheckValue(env, nameof(env)); Host.CheckValue(options, nameof(options)); @@ -680,10 +680,10 @@ public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment en host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new RegressionGamTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } [TlcModule.EntryPoint(Name = "Trainers.GeneralizedAdditiveModelBinaryClassifier", Desc = BinaryClassificationGamTrainer.Summary, UserName = BinaryClassificationGamTrainer.UserNameValue, ShortName = BinaryClassificationGamTrainer.ShortName)] @@ -694,10 +694,10 @@ public static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnvironm host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new BinaryClassificationGamTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } diff --git a/src/Microsoft.ML.FastTree/RandomForestClassification.cs b/src/Microsoft.ML.FastTree/RandomForestClassification.cs index 77a45ade92..60fc2e6242 100644 --- a/src/Microsoft.ML.FastTree/RandomForestClassification.cs +++ b/src/Microsoft.ML.FastTree/RandomForestClassification.cs @@ -160,7 +160,7 @@ internal FastForestClassification(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastForestClassification(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { } @@ -259,11 +259,11 @@ public static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnvironm host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastForestClassification(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName), calibrator: input.Calibrator, maxCalibrationExamples: input.MaxCalibrationExamples); } diff --git a/src/Microsoft.ML.FastTree/RandomForestRegression.cs b/src/Microsoft.ML.FastTree/RandomForestRegression.cs index 7962f93810..359217da05 100644 --- a/src/Microsoft.ML.FastTree/RandomForestRegression.cs +++ b/src/Microsoft.ML.FastTree/RandomForestRegression.cs @@ -289,7 +289,7 @@ internal FastForestRegression(IHostEnvironment env, /// The instance of . /// Algorithm advanced settings. internal FastForestRegression(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn), true) + : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName), true) { } @@ -435,11 +435,11 @@ public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment en host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new FastForestRegression(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs b/src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs index b3b8387184..89d8021df5 100644 --- a/src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs +++ b/src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs @@ -36,9 +36,9 @@ public static OlsLinearRegressionTrainer OrdinaryLeastSquares(this RegressionCat var env = CatalogUtils.GetEnvironment(catalog); var options = new OlsLinearRegressionTrainer.Options { - LabelColumn = labelColumnName, - FeatureColumn = featureColumnName, - WeightColumn = exampleWeightColumnName + LabelColumnName = labelColumnName, + FeatureColumnName = featureColumnName, + ExampleWeightColumnName = exampleWeightColumnName }; return new OlsLinearRegressionTrainer(env, options); @@ -91,8 +91,8 @@ public static SymSgdClassificationTrainer SymbolicStochasticGradientDescent(this var options = new SymSgdClassificationTrainer.Options { - LabelColumn = labelColumnName, - FeatureColumn = featureColumnName, + LabelColumnName = labelColumnName, + FeatureColumnName = featureColumnName, }; return new SymSgdClassificationTrainer(env, options); diff --git a/src/Microsoft.ML.HalLearners/OlsLinearRegression.cs b/src/Microsoft.ML.HalLearners/OlsLinearRegression.cs index 5cb947cad7..8204ac87d7 100644 --- a/src/Microsoft.ML.HalLearners/OlsLinearRegression.cs +++ b/src/Microsoft.ML.HalLearners/OlsLinearRegression.cs @@ -35,7 +35,7 @@ namespace Microsoft.ML.Trainers.HalLearners public sealed class OlsLinearRegressionTrainer : TrainerEstimatorBase, OlsLinearRegressionModelParameters> { /// Advanced options for trainer. - public sealed class Options : LearnerInputBaseWithWeight + public sealed class Options : TrainerInputBaseWithWeight { // Adding L2 regularization turns this into a form of ridge regression, // rather than, strictly speaking, ordinary least squares. But it is an @@ -76,8 +76,8 @@ public sealed class Options : LearnerInputBaseWithWeight /// Initializes a new instance of /// internal OlsLinearRegressionTrainer(IHostEnvironment env, Options options) - : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), - TrainerUtils.MakeR4ScalarColumn(options.LabelColumn), TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), + TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName), TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName)) { Host.CheckValue(options, nameof(options)); Host.CheckUserArg(options.L2Weight >= 0, nameof(options.L2Weight), "L2 regularization term cannot be negative"); @@ -499,10 +499,10 @@ internal static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment host.CheckValue(options, nameof(options)); EntryPointUtils.CheckInputArgs(host, options); - return LearnerEntryPointsUtils.Train(host, options, + return TrainerEntryPointsUtils.Train(host, options, () => new OlsLinearRegressionTrainer(host, options), - () => LearnerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.ExampleWeightColumnName)); } } diff --git a/src/Microsoft.ML.HalLearners/SymSgdClassificationTrainer.cs b/src/Microsoft.ML.HalLearners/SymSgdClassificationTrainer.cs index 1581d50156..14da40b3a9 100644 --- a/src/Microsoft.ML.HalLearners/SymSgdClassificationTrainer.cs +++ b/src/Microsoft.ML.HalLearners/SymSgdClassificationTrainer.cs @@ -39,7 +39,7 @@ public sealed class SymSgdClassificationTrainer : TrainerEstimatorBase Advanced options for trainer. - public sealed class Options : LearnerInputBaseWithLabel + public sealed class Options : TrainerInputBaseWithLabel { /// /// Degree of lock-free parallelism. Determinism not guaranteed if this is set to higher than 1. @@ -198,8 +198,8 @@ private protected override TPredictor TrainModelCore(TrainContext context) /// Initializes a new instance of /// internal SymSgdClassificationTrainer(IHostEnvironment env, Options options) - : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), - TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), + TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { Host.CheckValue(options, nameof(options)); options.Check(Host); @@ -250,9 +250,9 @@ internal static CommonOutputs.BinaryClassificationOutput TrainSymSgd(IHostEnviro host.CheckValue(options, nameof(options)); EntryPointUtils.CheckInputArgs(host, options); - return LearnerEntryPointsUtils.Train(host, options, + return TrainerEntryPointsUtils.Train(host, options, () => new SymSgdClassificationTrainer(host, options), - () => LearnerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, options.TrainingData.Schema, options.LabelColumnName)); } // We buffer instances from the cursor (limited to memorySize) and passes that buffer to diff --git a/src/Microsoft.ML.ImageAnalytics/ImageGrayscale.cs b/src/Microsoft.ML.ImageAnalytics/ImageGrayscale.cs index 74ddee9ba0..0d541ec174 100644 --- a/src/Microsoft.ML.ImageAnalytics/ImageGrayscale.cs +++ b/src/Microsoft.ML.ImageAnalytics/ImageGrayscale.cs @@ -12,10 +12,10 @@ using Microsoft.ML; using Microsoft.ML.CommandLine; using Microsoft.ML.Data; -using Microsoft.ML.EntryPoints; using Microsoft.ML.ImageAnalytics; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(ImageGrayscalingTransformer.Summary, typeof(IDataTransform), typeof(ImageGrayscalingTransformer), typeof(ImageGrayscalingTransformer.Options), typeof(SignatureDataTransform), ImageGrayscalingTransformer.UserName, "ImageGrayscaleTransform", "ImageGrayscale")] diff --git a/src/Microsoft.ML.ImageAnalytics/ImageLoader.cs b/src/Microsoft.ML.ImageAnalytics/ImageLoader.cs index e5429ac8bf..cf2b19ed57 100644 --- a/src/Microsoft.ML.ImageAnalytics/ImageLoader.cs +++ b/src/Microsoft.ML.ImageAnalytics/ImageLoader.cs @@ -12,10 +12,10 @@ using Microsoft.ML; using Microsoft.ML.CommandLine; using Microsoft.ML.Data; -using Microsoft.ML.EntryPoints; using Microsoft.ML.ImageAnalytics; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(ImageLoadingTransformer.Summary, typeof(IDataTransform), typeof(ImageLoadingTransformer), typeof(ImageLoadingTransformer.Options), typeof(SignatureDataTransform), ImageLoadingTransformer.UserName, "ImageLoaderTransform", "ImageLoader")] diff --git a/src/Microsoft.ML.ImageAnalytics/ImagePixelExtractor.cs b/src/Microsoft.ML.ImageAnalytics/ImagePixelExtractor.cs index 8342f3a139..9666c1e79c 100644 --- a/src/Microsoft.ML.ImageAnalytics/ImagePixelExtractor.cs +++ b/src/Microsoft.ML.ImageAnalytics/ImagePixelExtractor.cs @@ -16,6 +16,7 @@ using Microsoft.ML.ImageAnalytics; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(ImagePixelExtractingTransformer.Summary, typeof(IDataTransform), typeof(ImagePixelExtractingTransformer), typeof(ImagePixelExtractingTransformer.Options), typeof(SignatureDataTransform), ImagePixelExtractingTransformer.UserName, "ImagePixelExtractorTransform", "ImagePixelExtractor")] diff --git a/src/Microsoft.ML.ImageAnalytics/ImageResizer.cs b/src/Microsoft.ML.ImageAnalytics/ImageResizer.cs index a40e5951ef..911f5d8d63 100644 --- a/src/Microsoft.ML.ImageAnalytics/ImageResizer.cs +++ b/src/Microsoft.ML.ImageAnalytics/ImageResizer.cs @@ -16,6 +16,7 @@ using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(ImageResizingTransformer.Summary, typeof(IDataTransform), typeof(ImageResizingTransformer), typeof(ImageResizingTransformer.Arguments), typeof(SignatureDataTransform), ImageResizingTransformer.UserName, "ImageResizerTransform", "ImageResizer")] diff --git a/src/Microsoft.ML.ImageAnalytics/VectorToImageTransform.cs b/src/Microsoft.ML.ImageAnalytics/VectorToImageTransform.cs index 86a8041ad7..539317aab9 100644 --- a/src/Microsoft.ML.ImageAnalytics/VectorToImageTransform.cs +++ b/src/Microsoft.ML.ImageAnalytics/VectorToImageTransform.cs @@ -11,10 +11,10 @@ using Microsoft.ML; using Microsoft.ML.CommandLine; using Microsoft.ML.Data; -using Microsoft.ML.EntryPoints; using Microsoft.ML.ImageAnalytics; using Microsoft.ML.Internal.Utilities; using Microsoft.ML.Model; +using Microsoft.ML.Transforms; [assembly: LoadableClass(VectorToImageConvertingTransformer.Summary, typeof(IDataTransform), typeof(VectorToImageConvertingTransformer), typeof(VectorToImageConvertingTransformer.Options), typeof(SignatureDataTransform), ImagePixelExtractingTransformer.UserName, "VectorToImageTransform", "VectorToImage")] diff --git a/src/Microsoft.ML.KMeansClustering/KMeansCatalog.cs b/src/Microsoft.ML.KMeansClustering/KMeansCatalog.cs index 29e0bf03c4..23ea30d466 100644 --- a/src/Microsoft.ML.KMeansClustering/KMeansCatalog.cs +++ b/src/Microsoft.ML.KMeansClustering/KMeansCatalog.cs @@ -37,8 +37,8 @@ public static KMeansPlusPlusTrainer KMeans(this ClusteringCatalog.ClusteringTrai var options = new KMeansPlusPlusTrainer.Options { - FeatureColumn = featureColumnName, - WeightColumn = exampleWeightColumnName, + FeatureColumnName = featureColumnName, + ExampleWeightColumnName = exampleWeightColumnName, ClustersCount = clustersCount }; return new KMeansPlusPlusTrainer(env, options); diff --git a/src/Microsoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs b/src/Microsoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs index 652c858af0..bd6db7c927 100644 --- a/src/Microsoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs +++ b/src/Microsoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs @@ -50,7 +50,7 @@ internal static class Defaults public const int ClustersCount = 5; } - public sealed class Options : UnsupervisedLearnerInputBaseWithWeight + public sealed class Options : UnsupervisedTrainerInputBaseWithWeight { /// /// The number of clusters. @@ -116,12 +116,12 @@ public sealed class Options : UnsupervisedLearnerInputBaseWithWeight /// The to use. /// The advanced options of the algorithm. internal KMeansPlusPlusTrainer(IHostEnvironment env, Options options) - : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), default, TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), default, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName)) { Host.CheckValue(options, nameof(options)); Host.CheckUserArg(options.ClustersCount > 0, nameof(options.ClustersCount), "Must be positive"); - _featureColumn = options.FeatureColumn; + _featureColumn = options.FeatureColumnName; _k = options.ClustersCount; @@ -248,9 +248,9 @@ internal static CommonOutputs.ClusteringOutput TrainKMeans(IHostEnvironment env, host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new KMeansPlusPlusTrainer(host, input), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } private protected override SchemaShape.Column[] GetOutputColumnsCore(SchemaShape inputSchema) diff --git a/src/Microsoft.ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs b/src/Microsoft.ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs index f8bdaebfb9..581bbc0b59 100644 --- a/src/Microsoft.ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs +++ b/src/Microsoft.ML.LightGBM.StaticPipe/LightGbmStaticExtensions.cs @@ -84,9 +84,9 @@ public static Scalar LightGbm(this RegressionCatalog.RegressionTrainers c var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new LightGbmRegressorTrainer(env, options); if (onFit != null) @@ -171,9 +171,9 @@ public static (Scalar score, Scalar probability, Scalar pred var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new LightGbmBinaryTrainer(env, options); @@ -257,10 +257,10 @@ public static Scalar LightGbm(this RankingCatalog.RankingTrainers c var rec = new TrainerEstimatorReconciler.Ranker( (env, labelName, featuresName, groupIdName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.GroupIdColumn = groupIdName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.RowGroupColumnName = groupIdName; + options.ExampleWeightColumnName = weightsName; var trainer = new LightGbmRankingTrainer(env, options); @@ -350,9 +350,9 @@ public static (Vector score, Key predictedLabel) var rec = new TrainerEstimatorReconciler.MulticlassClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new LightGbmMulticlassTrainer(env, options); diff --git a/src/Microsoft.ML.LightGBM/LightGbmArguments.cs b/src/Microsoft.ML.LightGBM/LightGbmArguments.cs index a0fc2ba344..0b635bfaed 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmArguments.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmArguments.cs @@ -10,6 +10,7 @@ using Microsoft.ML.EntryPoints; using Microsoft.ML.Internal.Internallearn; using Microsoft.ML.LightGBM; +using Microsoft.ML.Trainers; [assembly: LoadableClass(typeof(Options.TreeBooster), typeof(Options.TreeBooster.Options), typeof(SignatureLightGBMBooster), Options.TreeBooster.FriendlyName, Options.TreeBooster.Name)] @@ -40,7 +41,7 @@ public interface IBoosterParameter /// Parameters names comes from LightGBM library. /// See https://github.com/Microsoft/LightGBM/blob/master/docs/Parameters.rst. /// - public sealed class Options : LearnerInputBaseWithGroupId + public sealed class Options : TrainerInputBaseWithGroupId { public abstract class BoosterParameter : IBoosterParameter where TOptions : class, new() diff --git a/src/Microsoft.ML.LightGBM/LightGbmBinaryTrainer.cs b/src/Microsoft.ML.LightGBM/LightGbmBinaryTrainer.cs index cc4c9f68cc..5df67201f8 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmBinaryTrainer.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmBinaryTrainer.cs @@ -94,7 +94,7 @@ public sealed class LightGbmBinaryTrainer : LightGbmTrainerBase PredictionKind.BinaryClassification; internal LightGbmBinaryTrainer(IHostEnvironment env, Options options) - : base(env, LoadNameValue, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, LoadNameValue, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { } @@ -189,10 +189,10 @@ public static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnvironm host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LightGbmBinaryTrainer(host, input), - getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + getLabel: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } } diff --git a/src/Microsoft.ML.LightGBM/LightGbmMulticlassTrainer.cs b/src/Microsoft.ML.LightGBM/LightGbmMulticlassTrainer.cs index c64388b11f..67e709c5c6 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmMulticlassTrainer.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmMulticlassTrainer.cs @@ -34,7 +34,7 @@ public sealed class LightGbmMulticlassTrainer : LightGbmTrainerBase PredictionKind.MultiClassClassification; internal LightGbmMulticlassTrainer(IHostEnvironment env, Options options) - : base(env, LoadNameValue, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumn)) + : base(env, LoadNameValue, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumnName)) { _numClass = -1; } @@ -246,10 +246,10 @@ public static CommonOutputs.MulticlassClassificationOutput TrainMultiClass(IHost host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LightGbmMulticlassTrainer(host, input), - getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + getLabel: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } } diff --git a/src/Microsoft.ML.LightGBM/LightGbmRankingTrainer.cs b/src/Microsoft.ML.LightGBM/LightGbmRankingTrainer.cs index ed6676a110..482a04f0d9 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmRankingTrainer.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmRankingTrainer.cs @@ -81,7 +81,7 @@ public sealed class LightGbmRankingTrainer : LightGbmTrainerBase PredictionKind.Ranking; internal LightGbmRankingTrainer(IHostEnvironment env, Options options) - : base(env, LoadNameValue, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, LoadNameValue, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } @@ -201,11 +201,11 @@ public static CommonOutputs.RankingOutput TrainRanking(IHostEnvironment env, Opt host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LightGbmRankingTrainer(host, input), - getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), - getGroup: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.GroupIdColumn)); + getLabel: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), + getGroup: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.RowGroupColumnName)); } } } diff --git a/src/Microsoft.ML.LightGBM/LightGbmRegressionTrainer.cs b/src/Microsoft.ML.LightGBM/LightGbmRegressionTrainer.cs index 304aee24b7..3729154cbd 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmRegressionTrainer.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmRegressionTrainer.cs @@ -107,7 +107,7 @@ internal LightGbmRegressorTrainer(IHostEnvironment env, } internal LightGbmRegressorTrainer(IHostEnvironment env, Options options) - : base(env, LoadNameValue, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, LoadNameValue, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } @@ -174,10 +174,10 @@ public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment en host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LightGbmRegressorTrainer(host, input), - getLabel: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + getLabel: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } } diff --git a/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs b/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs index c47698f6f7..614251c117 100644 --- a/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs +++ b/src/Microsoft.ML.LightGBM/LightGbmTrainerBase.cs @@ -75,17 +75,17 @@ private protected LightGbmTrainerBase(IHostEnvironment env, LightGbmTrainerOptions.LearningRate = learningRate; LightGbmTrainerOptions.NumBoostRound = numBoostRound; - LightGbmTrainerOptions.LabelColumn = label.Name; - LightGbmTrainerOptions.FeatureColumn = featureColumn; - LightGbmTrainerOptions.WeightColumn = weightColumn; - LightGbmTrainerOptions.GroupIdColumn = groupIdColumn; + LightGbmTrainerOptions.LabelColumnName = label.Name; + LightGbmTrainerOptions.FeatureColumnName = featureColumn; + LightGbmTrainerOptions.ExampleWeightColumnName = weightColumn; + LightGbmTrainerOptions.RowGroupColumnName = groupIdColumn; InitParallelTraining(); } private protected LightGbmTrainerBase(IHostEnvironment env, string name, Options options, SchemaShape.Column label) - : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, - TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn), TrainerUtils.MakeU4ScalarColumn(options.GroupIdColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, + TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName), TrainerUtils.MakeU4ScalarColumn(options.RowGroupColumnName)) { Host.CheckValue(options, nameof(options)); diff --git a/src/Microsoft.ML.PCA/PcaTrainer.cs b/src/Microsoft.ML.PCA/PcaTrainer.cs index 8705b85f87..4f3733a4ea 100644 --- a/src/Microsoft.ML.PCA/PcaTrainer.cs +++ b/src/Microsoft.ML.PCA/PcaTrainer.cs @@ -47,7 +47,7 @@ public sealed class RandomizedPcaTrainer : TrainerEstimatorBase(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new RandomizedPcaTrainer(host, input), - getWeight: () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + getWeight: () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } diff --git a/src/Microsoft.ML.StandardLearners/FactorizationMachine/FactorizationMachineTrainer.cs b/src/Microsoft.ML.StandardLearners/FactorizationMachine/FactorizationMachineTrainer.cs index bd2e2d09e3..c9d009a8f4 100644 --- a/src/Microsoft.ML.StandardLearners/FactorizationMachine/FactorizationMachineTrainer.cs +++ b/src/Microsoft.ML.StandardLearners/FactorizationMachine/FactorizationMachineTrainer.cs @@ -39,7 +39,7 @@ public sealed class FieldAwareFactorizationMachineBinaryClassificationTrainer : internal const string LoadName = "FieldAwareFactorizationMachine"; internal const string ShortName = "ffm"; - public sealed class Options : LearnerInputBaseWithWeight + public sealed class Options : TrainerInputBaseWithWeight { /// /// Initial learning rate. @@ -83,7 +83,7 @@ public sealed class Options : LearnerInputBaseWithWeight public bool Normalize = true; /// - /// Extra feature column names. The column named stores features from the first field. + /// Extra feature column names. The column named stores features from the first field. /// The i-th string in stores the name of the (i+1)-th field's feature column. /// [Argument(ArgumentType.Multiple, HelpText = "Extra columns to use for feature vectors. The i-th specified string denotes the column containing features form the (i+1)-th field." + @@ -162,18 +162,18 @@ internal FieldAwareFactorizationMachineBinaryClassificationTrainer(IHostEnvironm Initialize(env, options); var extraColumnLength = (options.ExtraFeatureColumns != null ? options.ExtraFeatureColumns.Length : 0); - // There can be multiple feature columns in FFM, jointly specified by args.FeatureColumn and args.ExtraFeatureColumns. + // There can be multiple feature columns in FFM, jointly specified by args.FeatureColumnName and args.ExtraFeatureColumns. FeatureColumns = new SchemaShape.Column[1 + extraColumnLength]; // Treat the default feature column as the 1st field. - FeatureColumns[0] = new SchemaShape.Column(options.FeatureColumn, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false); + FeatureColumns[0] = new SchemaShape.Column(options.FeatureColumnName, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false); // Add 2nd, 3rd, and other fields from a FFM-specific argument, args.ExtraFeatureColumns. for (int i = 0; i < extraColumnLength; i++) FeatureColumns[i + 1] = new SchemaShape.Column(options.ExtraFeatureColumns[i], SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false); - LabelColumn = new SchemaShape.Column(options.LabelColumn, SchemaShape.Column.VectorKind.Scalar, BooleanDataViewType.Instance, false); - WeightColumn = options.WeightColumn != null ? new SchemaShape.Column(options.WeightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default; + LabelColumn = new SchemaShape.Column(options.LabelColumnName, SchemaShape.Column.VectorKind.Scalar, BooleanDataViewType.Instance, false); + WeightColumn = options.ExampleWeightColumnName != null ? new SchemaShape.Column(options.ExampleWeightColumnName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default; } /// @@ -513,8 +513,8 @@ internal static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnviro var host = env.Register("Train a field-aware factorization machine"); host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, () => new FieldAwareFactorizationMachineBinaryClassificationTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + return TrainerEntryPointsUtils.Train(host, input, () => new FieldAwareFactorizationMachineBinaryClassificationTrainer(host, input), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } /// diff --git a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LbfgsPredictorBase.cs b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LbfgsPredictorBase.cs index 42b0b78c5b..0dde905f31 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LbfgsPredictorBase.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LbfgsPredictorBase.cs @@ -20,7 +20,7 @@ public abstract class LbfgsTrainerBase : Trainer where TModel : class where TOptions : LbfgsTrainerBase.OptionsBase, new () { - public abstract class OptionsBase : LearnerInputBaseWithWeight + public abstract class OptionsBase : TrainerInputBaseWithWeight { [Argument(ArgumentType.AtMostOnce, HelpText = "L2 regularization weight", ShortName = "l2", SortOrder = 50)] [TGUI(Label = "L2 Weight", Description = "Weight of L2 regularizer term", SuggestedSweeps = "0,0.1,1")] @@ -162,9 +162,9 @@ internal LbfgsTrainerBase(IHostEnvironment env, bool enforceNoNegativity) : this(env, new TOptions { - FeatureColumn = featureColumn, - LabelColumn = labelColumn.Name, - WeightColumn = weightColumn, + FeatureColumnName = featureColumn, + LabelColumnName = labelColumn.Name, + ExampleWeightColumnName = weightColumn, L1Weight = l1Weight, L2Weight = l2Weight, OptTol = optimizationTolerance, @@ -179,8 +179,8 @@ internal LbfgsTrainerBase(IHostEnvironment env, TOptions options, SchemaShape.Column labelColumn, Action advancedSettings = null) - : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), - labelColumn, TrainerUtils.MakeR4ScalarWeightColumn(options.WeightColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), + labelColumn, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName)) { Host.CheckValue(options, nameof(options)); LbfgsTrainerOptions = options; @@ -188,9 +188,9 @@ internal LbfgsTrainerBase(IHostEnvironment env, // Apply the advanced args, if the user supplied any. advancedSettings?.Invoke(options); - options.FeatureColumn = FeatureColumn.Name; - options.LabelColumn = LabelColumn.Name; - options.WeightColumn = WeightColumn.Name; + options.FeatureColumnName = FeatureColumn.Name; + options.LabelColumnName = LabelColumn.Name; + options.ExampleWeightColumnName = WeightColumn.Name; Host.CheckUserArg(!LbfgsTrainerOptions.UseThreads || LbfgsTrainerOptions.NumThreads > 0 || LbfgsTrainerOptions.NumThreads == null, nameof(LbfgsTrainerOptions.NumThreads), "numThreads must be positive (or empty for default)"); Host.CheckUserArg(LbfgsTrainerOptions.L2Weight >= 0, nameof(LbfgsTrainerOptions.L2Weight), "Must be non-negative"); @@ -242,9 +242,9 @@ private static TOptions ArgsInit(string featureColumn, SchemaShape.Column labelC { var args = new TOptions { - FeatureColumn = featureColumn, - LabelColumn = labelColumn.Name, - WeightColumn = weightColumn, + FeatureColumnName = featureColumn, + LabelColumnName = labelColumn.Name, + ExampleWeightColumnName = weightColumn, L1Weight = l1Weight, L2Weight = l2Weight, OptTol = optimizationTolerance, @@ -252,7 +252,7 @@ private static TOptions ArgsInit(string featureColumn, SchemaShape.Column labelC EnforceNonNegativity = enforceNoNegativity }; - args.WeightColumn = weightColumn; + args.ExampleWeightColumnName = weightColumn; return args; } diff --git a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LogisticRegression.cs b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LogisticRegression.cs index 266135b551..e38f779d60 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LogisticRegression.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/LogisticRegression.cs @@ -98,7 +98,7 @@ internal LogisticRegression(IHostEnvironment env, /// Initializes a new instance of /// internal LogisticRegression(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { _posWeight = 0; ShowTrainingStats = LbfgsTrainerOptions.ShowTrainingStats; @@ -419,10 +419,10 @@ internal static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnviro host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LogisticRegression(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/MulticlassLogisticRegression.cs b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/MulticlassLogisticRegression.cs index 7a40960a68..4d4469c10c 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/MulticlassLogisticRegression.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/LogisticRegression/MulticlassLogisticRegression.cs @@ -101,7 +101,7 @@ internal MulticlassLogisticRegression(IHostEnvironment env, /// Initializes a new instance of /// internal MulticlassLogisticRegression(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumnName)) { ShowTrainingStats = LbfgsTrainerOptions.ShowTrainingStats; } @@ -1012,10 +1012,10 @@ internal static CommonOutputs.MulticlassClassificationOutput TrainMultiClass(IHo host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new MulticlassLogisticRegression(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/ModelStatistics.cs b/src/Microsoft.ML.StandardLearners/Standard/ModelStatistics.cs index 9c71cc9858..79f6a0dfa1 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/ModelStatistics.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/ModelStatistics.cs @@ -299,7 +299,7 @@ private List GetUnorderedCoefficientStatistics(LinearBina var names = default(VBuffer>); featureColumn.Annotations.GetValue(AnnotationUtils.Kinds.SlotNames, ref names); - _env.Assert(names.Length > 0, "FeatureColumn has no metadata."); + _env.Assert(names.Length > 0, "FeatureColumnName has no metadata."); ReadOnlySpan stdErrorValues = _coeffStdError.Value.GetValues(); const Double sqrt2 = 1.41421356237; // Math.Sqrt(2); diff --git a/src/Microsoft.ML.StandardLearners/Standard/MultiClass/MultiClassNaiveBayesTrainer.cs b/src/Microsoft.ML.StandardLearners/Standard/MultiClass/MultiClassNaiveBayesTrainer.cs index 41650b7c41..dd4c9ee3d2 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/MultiClass/MultiClassNaiveBayesTrainer.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/MultiClass/MultiClassNaiveBayesTrainer.cs @@ -33,7 +33,7 @@ public sealed class MultiClassNaiveBayesTrainer : TrainerEstimatorBase /// internal MultiClassNaiveBayesTrainer(IHostEnvironment env, Options options) - : base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), - TrainerUtils.MakeU4ScalarColumn(options.LabelColumn)) + : base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), + TrainerUtils.MakeU4ScalarColumn(options.LabelColumnName)) { Host.CheckValue(options, nameof(options)); } @@ -174,9 +174,9 @@ internal static CommonOutputs.MulticlassClassificationOutput TrainMultiClassNaiv host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new MultiClassNaiveBayesTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/Online/AveragedPerceptron.cs b/src/Microsoft.ML.StandardLearners/Standard/Online/AveragedPerceptron.cs index 45bec60c2b..c91fae0244 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/Online/AveragedPerceptron.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/Online/AveragedPerceptron.cs @@ -109,7 +109,7 @@ public override LinearBinaryModelParameters CreatePredictor() } internal AveragedPerceptronTrainer(IHostEnvironment env, Options options) - : base(options, env, UserNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(options, env, UserNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { _args = options; LossFunction = _args.LossFunction.CreateComponent(env); @@ -137,8 +137,8 @@ internal AveragedPerceptronTrainer(IHostEnvironment env, int numIterations = Options.AveragedDefault.NumIterations) : this(env, new Options { - LabelColumn = labelColumn, - FeatureColumn = featureColumn, + LabelColumnName = labelColumn, + FeatureColumnName = featureColumn, LearningRate = learningRate, DecreaseLearningRate = decreaseLearningRate, L2RegularizerWeight = l2RegularizerWeight, @@ -213,9 +213,9 @@ internal static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnviro host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new AveragedPerceptronTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), calibrator: input.Calibrator, maxCalibrationExamples: input.MaxCalibrationExamples); } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/Online/LinearSvm.cs b/src/Microsoft.ML.StandardLearners/Standard/Online/LinearSvm.cs index 522079a8bc..b9145818c8 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/Online/LinearSvm.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/Online/LinearSvm.cs @@ -241,8 +241,8 @@ internal LinearSvmTrainer(IHostEnvironment env, int numIterations = Options.OnlineDefault.NumIterations) : this(env, new Options { - LabelColumn = labelColumn, - FeatureColumn = featureColumn, + LabelColumnName = labelColumn, + FeatureColumnName = featureColumn, WeightColumn = weightColumn, NumberOfIterations = numIterations, }) @@ -250,7 +250,7 @@ internal LinearSvmTrainer(IHostEnvironment env, } internal LinearSvmTrainer(IHostEnvironment env, Options options) - : base(options, env, UserNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(options, env, UserNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { Contracts.CheckUserArg(options.Lambda > 0, nameof(options.Lambda), UserErrorPositive); Contracts.CheckUserArg(options.BatchSize > 0, nameof(options.BatchSize), UserErrorPositive); @@ -286,9 +286,9 @@ internal static CommonOutputs.BinaryClassificationOutput TrainLinearSvm(IHostEnv host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LinearSvmTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), calibrator: input.Calibrator, maxCalibrationExamples: input.MaxCalibrationExamples); } diff --git a/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineGradientDescent.cs b/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineGradientDescent.cs index dc13544c5c..771fe8b149 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineGradientDescent.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineGradientDescent.cs @@ -111,8 +111,8 @@ internal OnlineGradientDescentTrainer(IHostEnvironment env, DecreaseLearningRate = decreaseLearningRate, L2RegularizerWeight = l2RegularizerWeight, NumberOfIterations = numIterations, - LabelColumn = labelColumn, - FeatureColumn = featureColumn, + LabelColumnName = labelColumn, + FeatureColumnName = featureColumn, LossFunction = new TrivialFactory(lossFunction ?? new SquaredLoss()) }) { @@ -131,7 +131,7 @@ public TrivialFactory(IRegressionLoss loss) } internal OnlineGradientDescentTrainer(IHostEnvironment env, Options options) - : base(options, env, UserNameValue, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(options, env, UserNameValue, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { LossFunction = options.LossFunction.CreateComponent(env); } @@ -167,9 +167,9 @@ internal static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new OnlineGradientDescentTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } private protected override RegressionPredictionTransformer MakeTransformer(LinearRegressionModelParameters model, DataViewSchema trainSchema) diff --git a/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineLinear.cs b/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineLinear.cs index a80e9d61fb..ad571155de 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineLinear.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/Online/OnlineLinear.cs @@ -17,7 +17,7 @@ namespace Microsoft.ML.Trainers /// /// Arguments class for online linear trainers. /// - public abstract class OnlineLinearOptions : LearnerInputBaseWithLabel + public abstract class OnlineLinearOptions : TrainerInputBaseWithLabel { /// /// Number of passes through the training dataset. @@ -252,7 +252,7 @@ public virtual float Margin(in VBuffer feat) private protected virtual bool NeedCalibration => false; private protected OnlineLinearTrainer(OnlineLinearOptions options, IHostEnvironment env, string name, SchemaShape.Column label) - : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, TrainerUtils.MakeR4ScalarWeightColumn(options.InitialWeights)) + : base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(options.InitialWeights)) { Contracts.CheckValue(options, nameof(options)); Contracts.CheckUserArg(options.NumberOfIterations > 0, nameof(options.NumberOfIterations), UserErrorPositive); diff --git a/src/Microsoft.ML.StandardLearners/Standard/PoissonRegression/PoissonRegression.cs b/src/Microsoft.ML.StandardLearners/Standard/PoissonRegression/PoissonRegression.cs index 3315a0c01e..165f662cc9 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/PoissonRegression/PoissonRegression.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/PoissonRegression/PoissonRegression.cs @@ -70,7 +70,7 @@ internal PoissonRegression(IHostEnvironment env, /// Initializes a new instance of /// internal PoissonRegression(IHostEnvironment env, Options options) - : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName)) { } @@ -182,10 +182,10 @@ internal static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new PoissonRegression(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName)); } } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs b/src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs index d71eed286c..9c1c628101 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs @@ -157,7 +157,7 @@ public abstract class SdcaTrainerBase : Stochast // 3. Don't "guess" the iteration to converge. It is very data-set dependent and hard to control. Always check for at least once to ensure convergence. // 4. Use dual variable updates to infer whether a full iteration of convergence checking is necessary. Convergence checking iteration is time-consuming. - public abstract class OptionsBase : LearnerInputBaseWithLabel + public abstract class OptionsBase : TrainerInputBaseWithLabel { [Argument(ArgumentType.AtMostOnce, HelpText = "L2 regularizer constant. By default the l2 constant is automatically inferred based on data set.", NullName = "", ShortName = "l2", SortOrder = 1)] [TGUI(Label = "L2 Regularizer Constant", SuggestedSweeps = ",1e-7,1e-6,1e-5,1e-4,1e-3,1e-2")] @@ -250,8 +250,8 @@ private static TOptions ArgsInit(string featureColumnName, SchemaShape.Column la { var args = new TOptions(); - args.FeatureColumn = featureColumnName; - args.LabelColumn = labelColumn.Name; + args.FeatureColumnName = featureColumnName; + args.LabelColumnName = labelColumn.Name; return args; } @@ -264,7 +264,7 @@ internal SdcaTrainerBase(IHostEnvironment env, string featureColumnName, SchemaS internal SdcaTrainerBase(IHostEnvironment env, TOptions options, SchemaShape.Column label, SchemaShape.Column weight = default, float? l2Const = null, float? l1Threshold = null, int? maxIterations = null) - : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumn), label, weight) + : base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, weight) { SdcaTrainerOptions = options; SdcaTrainerOptions.L2Const = l2Const ?? options.L2Const; @@ -1463,7 +1463,7 @@ private protected SdcaBinaryTrainerBase(IHostEnvironment env, } private protected SdcaBinaryTrainerBase(IHostEnvironment env, BinaryOptionsBase options, ISupportSdcaClassificationLoss loss = null, bool doCalibration = false) - : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn)) + : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName)) { _loss = loss ?? new LogLossFactory().CreateComponent(env); Loss = _loss; @@ -1721,7 +1721,7 @@ public abstract class SgdBinaryTrainerBase : LinearTrainerBase, TModel> where TModel : class { - public class OptionsBase : LearnerInputBaseWithWeight + public class OptionsBase : TrainerInputBaseWithWeight { /// /// The L2 weight for regularization. @@ -1866,9 +1866,9 @@ internal SgdBinaryTrainerBase(IHostEnvironment env, _options.InitLearningRate = initLearningRate; _options.L2Weight = l2Weight; - _options.FeatureColumn = featureColumn; - _options.LabelColumn = labelColumn; - _options.WeightColumn = weightColumn; + _options.FeatureColumnName = featureColumn; + _options.LabelColumnName = labelColumn; + _options.ExampleWeightColumnName = weightColumn; Loss = loss ?? new LogLoss(); Info = new TrainerInfo(calibration: false, supportIncrementalTrain: true); } @@ -1881,7 +1881,7 @@ internal SgdBinaryTrainerBase(IHostEnvironment env, /// Loss function would be minimized. /// Set to true if a calibration step should be happen after training. Use false otherwise. internal SgdBinaryTrainerBase(IHostEnvironment env, OptionsBase options, IClassificationLoss loss = null, bool doCalibration = false) - : base(env, options.FeatureColumn, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn), options.WeightColumn) + : base(env, options.FeatureColumnName, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName), options.ExampleWeightColumnName) { options.Check(env); Loss = loss; @@ -2308,10 +2308,10 @@ internal static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnviro host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LegacySgdBinaryTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.ExampleWeightColumnName), calibrator: input.Calibrator, maxCalibrationExamples: input.MaxCalibrationExamples); } } @@ -2332,9 +2332,9 @@ internal static CommonOutputs.BinaryClassificationOutput TrainBinary(IHostEnviro host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new LegacySdcaBinaryTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn), + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName), calibrator: input.Calibrator, maxCalibrationExamples: input.MaxCalibrationExamples); } } diff --git a/src/Microsoft.ML.StandardLearners/Standard/SdcaMultiClass.cs b/src/Microsoft.ML.StandardLearners/Standard/SdcaMultiClass.cs index e7f2f8e1fa..561d8a97f1 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/SdcaMultiClass.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/SdcaMultiClass.cs @@ -84,7 +84,7 @@ internal SdcaMultiClassTrainer(IHostEnvironment env, Options options, } internal SdcaMultiClassTrainer(IHostEnvironment env, Options options) - : this(env, options, options.FeatureColumn, options.LabelColumn) + : this(env, options, options.FeatureColumnName, options.LabelColumnName) { } @@ -453,9 +453,9 @@ public static CommonOutputs.MulticlassClassificationOutput TrainMultiClass(IHost host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new SdcaMultiClassTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } } } \ No newline at end of file diff --git a/src/Microsoft.ML.StandardLearners/Standard/SdcaRegression.cs b/src/Microsoft.ML.StandardLearners/Standard/SdcaRegression.cs index 0288f3bc69..3cb1a42dae 100644 --- a/src/Microsoft.ML.StandardLearners/Standard/SdcaRegression.cs +++ b/src/Microsoft.ML.StandardLearners/Standard/SdcaRegression.cs @@ -87,7 +87,7 @@ internal SdcaRegressionTrainer(IHostEnvironment env, Options options, string fea } internal SdcaRegressionTrainer(IHostEnvironment env, Options options) - : this(env, options, options.FeatureColumn, options.LabelColumn) + : this(env, options, options.FeatureColumnName, options.LabelColumnName) { } @@ -176,9 +176,9 @@ public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment en host.CheckValue(input, nameof(input)); EntryPointUtils.CheckInputArgs(host, input); - return LearnerEntryPointsUtils.Train(host, input, + return TrainerEntryPointsUtils.Train(host, input, () => new SdcaRegressionTrainer(host, input), - () => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn)); + () => TrainerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumnName)); } } } \ No newline at end of file diff --git a/src/Microsoft.ML.StaticPipe/KMeansStatic.cs b/src/Microsoft.ML.StaticPipe/KMeansStatic.cs index fbd20d3dcd..784b9d1a1b 100644 --- a/src/Microsoft.ML.StaticPipe/KMeansStatic.cs +++ b/src/Microsoft.ML.StaticPipe/KMeansStatic.cs @@ -40,9 +40,9 @@ public static (Vector score, Key predictedLabel) KMeans(this Cluste { var options = new KMeansPlusPlusTrainer.Options { - FeatureColumn = featuresName, + FeatureColumnName = featuresName, ClustersCount = clustersCount, - WeightColumn = weightsName + ExampleWeightColumnName = weightsName }; var trainer = new KMeansPlusPlusTrainer(env, options); @@ -80,8 +80,8 @@ public static (Vector score, Key predictedLabel) KMeans(this Cluste var rec = new TrainerEstimatorReconciler.Clustering( (env, featuresName, weightsName) => { - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new KMeansPlusPlusTrainer(env, options); diff --git a/src/Microsoft.ML.StaticPipe/LbfgsStatic.cs b/src/Microsoft.ML.StaticPipe/LbfgsStatic.cs index 1c5eec3191..bc7066fbad 100644 --- a/src/Microsoft.ML.StaticPipe/LbfgsStatic.cs +++ b/src/Microsoft.ML.StaticPipe/LbfgsStatic.cs @@ -90,9 +90,9 @@ public static (Scalar score, Scalar probability, Scalar pred var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new LogisticRegression(env, options); @@ -186,9 +186,9 @@ public static Scalar PoissonRegression(this RegressionCatalog.RegressionT var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new PoissonRegression(env, options); @@ -283,9 +283,9 @@ public static (Vector score, Key predictedLabel) var rec = new TrainerEstimatorReconciler.MulticlassClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new MulticlassLogisticRegression(env, options); diff --git a/src/Microsoft.ML.StaticPipe/OnlineLearnerStatic.cs b/src/Microsoft.ML.StaticPipe/OnlineLearnerStatic.cs index 5030d44e63..8614a2c4fc 100644 --- a/src/Microsoft.ML.StaticPipe/OnlineLearnerStatic.cs +++ b/src/Microsoft.ML.StaticPipe/OnlineLearnerStatic.cs @@ -116,8 +116,8 @@ public static (Scalar score, Scalar predictedLabel) AveragedPercept var rec = new TrainerEstimatorReconciler.BinaryClassifierNoCalibration( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; var trainer = new AveragedPerceptronTrainer(env, options); @@ -220,8 +220,8 @@ public static Scalar OnlineGradientDescent(this RegressionCatalog.Regress var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; var trainer = new OnlineGradientDescentTrainer(env, options); diff --git a/src/Microsoft.ML.StaticPipe/SdcaStaticExtensions.cs b/src/Microsoft.ML.StaticPipe/SdcaStaticExtensions.cs index 2261c24e63..20b244a3a9 100644 --- a/src/Microsoft.ML.StaticPipe/SdcaStaticExtensions.cs +++ b/src/Microsoft.ML.StaticPipe/SdcaStaticExtensions.cs @@ -99,8 +99,8 @@ public static Scalar Sdca(this RegressionCatalog.RegressionTrainers catal var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; var trainer = new SdcaRegressionTrainer(env, options); if (onFit != null) @@ -203,8 +203,8 @@ public static (Scalar score, Scalar probability, Scalar pred var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; var trainer = new SdcaBinaryTrainer(env, options); if (onFit != null) @@ -310,8 +310,8 @@ public static (Scalar score, Scalar predictedLabel) SdcaNonCalibrat var rec = new TrainerEstimatorReconciler.BinaryClassifierNoCalibration( (env, labelName, featuresName, weightsName) => { - options.FeatureColumn = featuresName; - options.LabelColumn = labelName; + options.FeatureColumnName = featuresName; + options.LabelColumnName = labelName; var trainer = new SdcaNonCalibratedBinaryTrainer(env, options); if (onFit != null) @@ -407,8 +407,8 @@ public static (Vector score, Key predictedLabel) Sdca( var rec = new TrainerEstimatorReconciler.MulticlassClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; var trainer = new SdcaMultiClassTrainer(env, options); if (onFit != null) diff --git a/src/Microsoft.ML.StaticPipe/SgdStatic.cs b/src/Microsoft.ML.StaticPipe/SgdStatic.cs index d71d55db9d..dad7e9b57f 100644 --- a/src/Microsoft.ML.StaticPipe/SgdStatic.cs +++ b/src/Microsoft.ML.StaticPipe/SgdStatic.cs @@ -78,9 +78,9 @@ public static (Scalar score, Scalar probability, Scalar pred var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - options.FeatureColumn = featuresName; - options.LabelColumn = labelName; - options.WeightColumn = weightsName; + options.FeatureColumnName = featuresName; + options.LabelColumnName = labelName; + options.ExampleWeightColumnName = weightsName; var trainer = new SgdBinaryTrainer(env, options); @@ -161,9 +161,9 @@ public static (Scalar score, Scalar predictedLabel) StochasticGradi var rec = new TrainerEstimatorReconciler.BinaryClassifierNoCalibration( (env, labelName, featuresName, weightsName) => { - options.FeatureColumn = featuresName; - options.LabelColumn = labelName; - options.WeightColumn = weightsName; + options.FeatureColumnName = featuresName; + options.LabelColumnName = labelName; + options.ExampleWeightColumnName = weightsName; var trainer = new SgdNonCalibratedBinaryTrainer(env, options); diff --git a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs index f6c6132d80..49e12c4098 100644 --- a/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs +++ b/src/Microsoft.ML.StaticPipe/TreeTrainersStatic.cs @@ -92,9 +92,9 @@ public static Scalar FastTree(this RegressionCatalog.RegressionTrainers c var rec = new TrainerEstimatorReconciler.Regression( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new FastTreeRegressionTrainer(env, options); if (onFit != null) @@ -188,9 +188,9 @@ public static (Scalar score, Scalar probability, Scalar pred var rec = new TrainerEstimatorReconciler.BinaryClassifier( (env, labelName, featuresName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.ExampleWeightColumnName = weightsName; var trainer = new FastTreeBinaryClassificationTrainer(env, options); @@ -272,10 +272,10 @@ public static Scalar FastTree(this RankingCatalog.RankingTrainers c var rec = new TrainerEstimatorReconciler.Ranker( (env, labelName, featuresName, groupIdName, weightsName) => { - options.LabelColumn = labelName; - options.FeatureColumn = featuresName; - options.GroupIdColumn = groupIdName; - options.WeightColumn = weightsName; + options.LabelColumnName = labelName; + options.FeatureColumnName = featuresName; + options.RowGroupColumnName = groupIdName; + options.ExampleWeightColumnName = weightsName; var trainer = new FastTreeRankingTrainer(env, options); if (onFit != null) diff --git a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs index 6053bdc4bd..ae03f1ea98 100644 --- a/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs +++ b/src/Microsoft.ML.Sweeper/Algorithms/SmacSweeper.cs @@ -140,8 +140,8 @@ private FastForestRegressionModelParameters FitModel(IEnumerable pre FeatureFraction = _args.SplitRatio, NumTrees = _args.NumOfTrees, MinDocumentsInLeafs = _args.NMinForSplit, - LabelColumn = DefaultColumnNames.Label, - FeatureColumn = DefaultColumnNames.Features, + LabelColumnName = DefaultColumnNames.Label, + FeatureColumnName = DefaultColumnNames.Features, }); var predictor = trainer.Fit(view); diff --git a/test/BaselineOutput/Common/EntryPoints/core_manifest.json b/test/BaselineOutput/Common/EntryPoints/core_manifest.json index 984e570840..d3e0180dbd 100644 --- a/test/BaselineOutput/Common/EntryPoints/core_manifest.json +++ b/test/BaselineOutput/Common/EntryPoints/core_manifest.json @@ -2097,7 +2097,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -2118,7 +2118,7 @@ "Default": true }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -2130,7 +2130,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -2336,7 +2336,7 @@ "Default": true }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -2348,7 +2348,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -2360,7 +2360,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -4166,7 +4166,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -4178,7 +4178,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -4524,7 +4524,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -4548,7 +4548,7 @@ "Default": null }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -4725,7 +4725,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -4749,7 +4749,7 @@ "Default": null }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -4926,7 +4926,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -4950,7 +4950,7 @@ "Default": null }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -5144,7 +5144,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -5176,7 +5176,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -5188,7 +5188,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -5200,7 +5200,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -5794,7 +5794,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -5826,7 +5826,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -5838,7 +5838,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -5850,7 +5850,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -6418,7 +6418,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -6450,7 +6450,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -6480,7 +6480,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -6492,7 +6492,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -7329,7 +7329,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -7361,7 +7361,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -7391,7 +7391,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -7403,7 +7403,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -8321,7 +8321,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -8353,7 +8353,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -8383,7 +8383,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -8395,7 +8395,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -9220,7 +9220,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -9252,7 +9252,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -9282,7 +9282,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -9294,7 +9294,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -10125,7 +10125,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -10154,7 +10154,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -10184,7 +10184,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -10376,7 +10376,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -10408,7 +10408,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -10438,7 +10438,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -10676,7 +10676,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -10708,7 +10708,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -10738,7 +10738,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -10956,7 +10956,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -10968,7 +10968,7 @@ "Default": "Features" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -11221,7 +11221,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -11247,7 +11247,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -11259,7 +11259,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -11271,7 +11271,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -11724,7 +11724,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -11750,7 +11750,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -11762,7 +11762,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -11774,7 +11774,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -12227,7 +12227,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -12253,7 +12253,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -12265,7 +12265,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -12277,7 +12277,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -12730,7 +12730,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -12756,7 +12756,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -12768,7 +12768,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -12780,7 +12780,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -13152,7 +13152,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -13164,7 +13164,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -13420,7 +13420,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -13432,7 +13432,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -13444,7 +13444,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -13731,7 +13731,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -13743,7 +13743,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -13755,7 +13755,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -14042,7 +14042,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -14054,7 +14054,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -14139,7 +14139,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -14151,7 +14151,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -14452,7 +14452,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -14464,7 +14464,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -14476,7 +14476,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -14594,7 +14594,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -14606,7 +14606,7 @@ "Default": "Features" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -14760,7 +14760,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -14772,7 +14772,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -14784,7 +14784,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -15106,7 +15106,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -15118,7 +15118,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -15410,7 +15410,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -15422,7 +15422,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -15679,7 +15679,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -15691,7 +15691,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -15901,7 +15901,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -15913,7 +15913,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -15925,7 +15925,7 @@ "Default": "Label" }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -16185,7 +16185,7 @@ "IsNullable": false }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -16197,7 +16197,7 @@ "Default": "Features" }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -25116,7 +25116,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -25148,7 +25148,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -25178,7 +25178,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -25190,7 +25190,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -26009,7 +26009,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -26041,7 +26041,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -26071,7 +26071,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -26083,7 +26083,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -26983,7 +26983,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -27015,7 +27015,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -27045,7 +27045,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -27057,7 +27057,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ @@ -27864,7 +27864,7 @@ } }, { - "Name": "FeatureColumn", + "Name": "FeatureColumnName", "Type": "String", "Desc": "Column to use for features", "Aliases": [ @@ -27896,7 +27896,7 @@ } }, { - "Name": "LabelColumn", + "Name": "LabelColumnName", "Type": "String", "Desc": "Column to use for labels", "Aliases": [ @@ -27926,7 +27926,7 @@ } }, { - "Name": "WeightColumn", + "Name": "ExampleWeightColumnName", "Type": "String", "Desc": "Column to use for example weight", "Aliases": [ @@ -27938,7 +27938,7 @@ "Default": null }, { - "Name": "GroupIdColumn", + "Name": "RowGroupColumnName", "Type": "String", "Desc": "Column to use for example groupId", "Aliases": [ diff --git a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs index 69ee9afb81..87e788c31f 100644 --- a/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs +++ b/test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs @@ -366,18 +366,18 @@ public void EntryPointInputBuilderOptionals() InputBuilder ib1 = new InputBuilder(Env, typeof(LogisticRegression.Options), catalog); // Ensure that InputBuilder unwraps the Optional correctly. - var weightType = ib1.GetFieldTypeOrNull("WeightColumn"); + var weightType = ib1.GetFieldTypeOrNull("ExampleWeightColumnName"); Assert.True(weightType.Equals(typeof(string))); var instance = ib1.GetInstance() as LogisticRegression.Options; - Assert.True(instance.WeightColumn == null); + Assert.True(instance.ExampleWeightColumnName == null); - ib1.TrySetValue("WeightColumn", "OtherWeight"); - Assert.Equal("OtherWeight", instance.WeightColumn); + ib1.TrySetValue("ExampleWeightColumnName", "OtherWeight"); + Assert.Equal("OtherWeight", instance.ExampleWeightColumnName); var tok = (JToken)JValue.CreateString("AnotherWeight"); - ib1.TrySetValueJson("WeightColumn", tok); - Assert.Equal("AnotherWeight", instance.WeightColumn); + ib1.TrySetValueJson("ExampleWeightColumnName", tok); + Assert.Equal("AnotherWeight", instance.ExampleWeightColumnName); } [Fact] @@ -3528,10 +3528,10 @@ public void EntryPointTreeLeafFeaturizer() var fastTree = Trainers.FastTree.FastTree.TrainBinary(Env, new FastTreeBinaryClassificationTrainer.Options { - FeatureColumn = "Features", + FeatureColumnName = "Features", NumTrees = 5, NumLeaves = 4, - LabelColumn = DefaultColumnNames.Label, + LabelColumnName = DefaultColumnNames.Label, TrainingData = concat.OutputData }); @@ -3976,9 +3976,9 @@ public void TestSimpleTrainExperiment() 'Shuffle': false, 'CheckFrequency': null, 'BiasLearningRate': 0.0, - 'LabelColumn': 'Label', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_51d3ddc9792d4c6eb975e600e87b8cbc', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -4147,10 +4147,10 @@ public void TestCrossValidationMacro() 'NumThreads': 1, 'DenseOptimizer': false, 'EnforceNonNegativity': false, - 'WeightColumn': 'Weight1', - 'LabelColumn': 'Label', + 'ExampleWeightColumnName': 'Weight1', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_8b36a1e70c9f4504973140ad15eac72f', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -4333,9 +4333,9 @@ public void TestCrossValidationMacroWithMultiClass() 'Shuffle': true, 'CheckFrequency': null, 'BiasLearningRate': 0.0, - 'LabelColumn': 'Label', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_a060169d8a924964b71447904c0d2ee9', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -4570,10 +4570,10 @@ public void TestCrossValidationMacroMultiClassWithWarnings() 'NumThreads': 1, 'DenseOptimizer': false, 'EnforceNonNegativity': false, - 'WeightColumn': null, - 'LabelColumn': 'Label', + 'ExampleWeightColumnName': null, + 'LabelColumnName': 'Label', 'TrainingData': '$Var_fb8137cb48ac49a7b1b56aa3ed5e0b23', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -4740,9 +4740,9 @@ public void TestCrossValidationMacroWithStratification() 'Shuffle': true, 'CheckFrequency': null, 'BiasLearningRate': 0.0, - 'LabelColumn': 'Label', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_44f5c60e439b49fe9e5bf372be4613ee', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -5032,11 +5032,11 @@ public void TestCrossValidationMacroWithNonDefaultNames() 'PrintTestGraph': false, 'PrintTrainValidGraph': false, 'TestFrequency': 2147483647, - 'GroupIdColumn': 'GroupId1', - 'WeightColumn': null, - 'LabelColumn': 'Label1', + 'RowGroupColumnName': 'GroupId1', + 'ExampleWeightColumnName': null, + 'LabelColumnName': 'Label1', 'TrainingData': '$Var_8f51ed90f5b642b2a80eeb628d67a5b3', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -5248,9 +5248,9 @@ public void TestOvaMacro() 'Shuffle': true, 'CheckFrequency': null, 'BiasLearningRate': 0.0, - 'LabelColumn': 'Label', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_9aa1732198964d7f979a0bbec5db66c2', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -5263,10 +5263,10 @@ public void TestOvaMacro() 'Model': '$Var_a229f40df6494a93a794ffd5480d5549' }, 'UseProbabilities': true, - 'WeightColumn': null, - 'LabelColumn': 'Label', + 'ExampleWeightColumnName': null, + 'LabelColumnName': 'Label', 'TrainingData': '$Var_672f860e44304ba8bd1c1a6e4b5ba9c5', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -5418,9 +5418,9 @@ public void TestOvaMacroWithUncalibratedLearner() 'InitialWeights': null, 'InitialWeightsDiameter': 0.0, 'Shuffle': false, - 'LabelColumn': 'Label', + 'LabelColumnName': 'Label', 'TrainingData': '$Var_9ccc8bce4f6540eb8a244ab40585602a', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, @@ -5433,10 +5433,10 @@ public void TestOvaMacroWithUncalibratedLearner() 'Model': '$Var_b47f7facc1c540e39d8b82ab64df6592' }, 'UseProbabilities': true, - 'WeightColumn': null, - 'LabelColumn': 'Label', + 'ExampleWeightColumnName': null, + 'LabelColumnName': 'Label', 'TrainingData': '$Var_f38b99289df746319edd57a3ccfb85a2', - 'FeatureColumn': 'Features', + 'FeatureColumnName': 'Features', 'NormalizeFeatures': 'Auto', 'Caching': 'Auto' }, diff --git a/test/Microsoft.ML.Functional.Tests/Prediction.cs b/test/Microsoft.ML.Functional.Tests/Prediction.cs index 55da6e8814..9bad405571 100644 --- a/test/Microsoft.ML.Functional.Tests/Prediction.cs +++ b/test/Microsoft.ML.Functional.Tests/Prediction.cs @@ -43,7 +43,7 @@ public void ReconfigurablePrediction() // Todo #2465: Allow the setting of threshold and thresholdColumn for scoring. // This is no longer possible in the API - //var newModel = new BinaryPredictionTransformer>(ml, model.Model, trainData.Schema, model.FeatureColumn, threshold: 0.01f, thresholdColumn: DefaultColumnNames.Probability); + //var newModel = new BinaryPredictionTransformer>(ml, model.Model, trainData.Schema, model.FeatureColumnName, threshold: 0.01f, thresholdColumn: DefaultColumnNames.Probability); //var newScoredTest = newModel.Transform(pipeline.Transform(testData)); //var newMetrics = mlContext.BinaryClassification.Evaluate(scoredTest); // And the Threshold and ThresholdColumn properties are not settable. diff --git a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs index e91800259c..f7f24bf666 100644 --- a/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs +++ b/test/Microsoft.ML.Predictor.Tests/TestPredictors.cs @@ -610,10 +610,10 @@ public void TestTreeEnsembleCombiner() { fastTrees[i] = FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { - FeatureColumn = "Features", + FeatureColumnName = "Features", NumTrees = 5, NumLeaves = 4, - LabelColumn = DefaultColumnNames.Label, + LabelColumnName = DefaultColumnNames.Label, TrainingData = dataView }).PredictorModel; } @@ -632,11 +632,11 @@ public void TestTreeEnsembleCombinerWithCategoricalSplits() { fastTrees[i] = FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { - FeatureColumn = "Features", + FeatureColumnName = "Features", NumTrees = 5, NumLeaves = 4, CategoricalSplit = true, - LabelColumn = DefaultColumnNames.Label, + LabelColumnName = DefaultColumnNames.Label, TrainingData = cat }).PredictorModel; } @@ -732,32 +732,32 @@ public void TestEnsembleCombiner() { FastTree.TrainBinary(ML, new FastTreeBinaryClassificationTrainer.Options { - FeatureColumn = "Features", + FeatureColumnName = "Features", NumTrees = 5, NumLeaves = 4, - LabelColumn = DefaultColumnNames.Label, + LabelColumnName = DefaultColumnNames.Label, TrainingData = dataView }).PredictorModel, AveragedPerceptronTrainer.TrainBinary(ML, new AveragedPerceptronTrainer.Options() { - FeatureColumn = "Features", - LabelColumn = DefaultColumnNames.Label, + FeatureColumnName = "Features", + LabelColumnName = DefaultColumnNames.Label, NumberOfIterations = 2, TrainingData = dataView, NormalizeFeatures = NormalizeOption.No }).PredictorModel, LogisticRegression.TrainBinary(ML, new LogisticRegression.Options() { - FeatureColumn = "Features", - LabelColumn = DefaultColumnNames.Label, + FeatureColumnName = "Features", + LabelColumnName = DefaultColumnNames.Label, OptTol = 10e-4F, TrainingData = dataView, NormalizeFeatures = NormalizeOption.No }).PredictorModel, LogisticRegression.TrainBinary(ML, new LogisticRegression.Options() { - FeatureColumn = "Features", - LabelColumn = DefaultColumnNames.Label, + FeatureColumnName = "Features", + LabelColumnName = DefaultColumnNames.Label, OptTol = 10e-3F, TrainingData = dataView, NormalizeFeatures = NormalizeOption.No @@ -777,24 +777,24 @@ public void TestMultiClassEnsembleCombiner() { LightGbm.TrainMultiClass(Env, new Options { - FeatureColumn = "Features", + FeatureColumnName = "Features", NumBoostRound = 5, NumLeaves = 4, - LabelColumn = DefaultColumnNames.Label, + LabelColumnName = DefaultColumnNames.Label, TrainingData = dataView }).PredictorModel, LogisticRegression.TrainMultiClass(Env, new MulticlassLogisticRegression.Options() { - FeatureColumn = "Features", - LabelColumn = DefaultColumnNames.Label, + FeatureColumnName = "Features", + LabelColumnName = DefaultColumnNames.Label, OptTol = 10e-4F, TrainingData = dataView, NormalizeFeatures = NormalizeOption.No }).PredictorModel, LogisticRegression.TrainMultiClass(Env, new MulticlassLogisticRegression.Options() { - FeatureColumn = "Features", - LabelColumn = DefaultColumnNames.Label, + FeatureColumnName = "Features", + LabelColumnName = DefaultColumnNames.Label, OptTol = 10e-3F, TrainingData = dataView, NormalizeFeatures = NormalizeOption.No diff --git a/test/Microsoft.ML.Tests/OnnxConversionTest.cs b/test/Microsoft.ML.Tests/OnnxConversionTest.cs index b4808b4e7c..492a71a501 100644 --- a/test/Microsoft.ML.Tests/OnnxConversionTest.cs +++ b/test/Microsoft.ML.Tests/OnnxConversionTest.cs @@ -135,7 +135,7 @@ public void KmeansOnnxConversionTest() var pipeline = mlContext.Transforms.Normalize("Features"). Append(mlContext.Clustering.Trainers.KMeans(new Trainers.KMeansPlusPlusTrainer.Options { - FeatureColumn = DefaultColumnNames.Features, + FeatureColumnName = DefaultColumnNames.Features, MaxIterations = 1, ClustersCount = 4, NumThreads = 1, diff --git a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs index 0e2d53edf8..a5c9d81625 100644 --- a/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs +++ b/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs @@ -682,8 +682,8 @@ private void ExecuteTFTransformMNISTConvTrainingTest(bool shuffle, int? shuffleS .AppendCacheCheckpoint(mlContext) .Append(mlContext.MulticlassClassification.Trainers.LightGbm(new LightGBM.Options() { - LabelColumn = "Label", - FeatureColumn = "Features", + LabelColumnName = "Label", + FeatureColumnName = "Features", Seed = 1, NThread = 1, NumBoostRound = 1 diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/FAFMEstimator.cs b/test/Microsoft.ML.Tests/TrainerEstimators/FAFMEstimator.cs index 3bbc8b5df6..fdbf34ddaf 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/FAFMEstimator.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/FAFMEstimator.cs @@ -22,7 +22,7 @@ public void FfmBinaryClassificationWithAdvancedArguments() var ffmArgs = new FieldAwareFactorizationMachineBinaryClassificationTrainer.Options(); // Customized the field names. - ffmArgs.FeatureColumn = nameof(DatasetUtils.FfmExample.Field0); // First field. + ffmArgs.FeatureColumnName = nameof(DatasetUtils.FfmExample.Field0); // First field. ffmArgs.ExtraFeatureColumns = new[]{ nameof(DatasetUtils.FfmExample.Field1), nameof(DatasetUtils.FfmExample.Field2) }; var pipeline = mlContext.BinaryClassification.Trainers.FieldAwareFactorizationMachine(ffmArgs); @@ -45,7 +45,7 @@ public void FieldAwareFactorizationMachine_Estimator() .Load(GetDataPath(TestDatasets.breastCancer.trainFilename)); var ffmArgs = new FieldAwareFactorizationMachineBinaryClassificationTrainer.Options { - FeatureColumn = "Feature1", // Features from the 1st field. + FeatureColumnName = "Feature1", // Features from the 1st field. ExtraFeatureColumns = new[] { "Feature2", "Feature3", "Feature4" }, // 2nd field's feature column, 3rd field's feature column, 4th field's feature column. Shuffle = false, NumberOfIterations = 3, diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs index b048cc2393..990f8bbf2f 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/MetalinearEstimators.cs @@ -84,8 +84,8 @@ public void MetacomponentsFeaturesRenamed() var sdcaTrainer = ML.BinaryClassification.Trainers.StochasticDualCoordinateAscentNonCalibrated( new SdcaNonCalibratedBinaryTrainer.Options { - LabelColumn = "Label", - FeatureColumn = "Vars", + LabelColumnName = "Label", + FeatureColumnName = "Vars", MaxIterations = 100, Shuffle = true, NumThreads = 1, }); diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/TrainerEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/TrainerEstimators.cs index 71cac57d55..93e4f73e20 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/TrainerEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/TrainerEstimators.cs @@ -73,8 +73,8 @@ public void KMeansEstimator() // Pipeline. var pipeline = new KMeansPlusPlusTrainer(Env, new KMeansPlusPlusTrainer.Options { - FeatureColumn = featureColumn, - WeightColumn = weights, + FeatureColumnName = featureColumn, + ExampleWeightColumnName = weights, InitAlgorithm = KMeansPlusPlusTrainer.InitAlgorithm.KMeansParallel, }); diff --git a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs index 595cc76895..5e3ab89ea0 100644 --- a/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs +++ b/test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs @@ -114,9 +114,9 @@ public void FastTreeRankerEstimator() var trainer = ML.Ranking.Trainers.FastTree( new FastTreeRankingTrainer.Options { - FeatureColumn = "NumericFeatures", + FeatureColumnName = "NumericFeatures", NumTrees = 10, - GroupIdColumn = "Group" + RowGroupColumnName = "Group" }); var pipeWithTrainer = pipe.Append(trainer); @@ -135,7 +135,7 @@ public void LightGBMRankerEstimator() { var (pipe, dataView) = GetRankingPipeline(); - var trainer = ML.Ranking.Trainers.LightGbm(new Options() { LabelColumn = "Label0", FeatureColumn = "NumericFeatures", GroupIdColumn = "Group", LearningRate = 0.4 }); + var trainer = ML.Ranking.Trainers.LightGbm(new Options() { LabelColumnName = "Label0", FeatureColumnName = "NumericFeatures", RowGroupColumnName = "Group", LearningRate = 0.4 }); var pipeWithTrainer = pipe.Append(trainer); TestEstimatorCore(pipeWithTrainer, dataView);