Skip to content

disable ols #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 9, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/Microsoft.ML.StandardLearners/Standard/OlsLinearRegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,20 +491,6 @@ public static void Pptri(Layout layout, UpLo uplo, int n, Double[] ap)
}
}
}

[TlcModule.EntryPoint(Name= "Trainers.OrdinaryLeastSquaresRegressor", Desc = "Train an OLS regression model.", UserName = UserNameValue, ShortName = ShortName)]
public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment env, Arguments input)
{
Contracts.CheckValue(env, nameof(env));
var host = env.Register("TrainOLS");
host.CheckValue(input, nameof(input));
EntryPointUtils.CheckInputArgs(host, input);

return LearnerEntryPointsUtils.Train<Arguments, CommonOutputs.RegressionOutput>(host, input,
() => new OlsLinearRegressionTrainer(host, input),
() => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.LabelColumn),
() => LearnerEntryPointsUtils.FindColumn(host, input.TrainingData.Schema, input.WeightColumn));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than just remove the entry-point, could we temporarily just remove the entire file from this repo since none of it is useful now, and only reintroduce it once we decide exactly what we're going to do about the underlying math library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@glebuk

Gal, I suggest
we remove the OLS for now (do not expose it as the LearnignPipelineItem, but keep in the runtime source code).

I don't mind to delete it, but if we plan to enable it one day, maybe it make more sense to keep it here, instead of shuffling around.

Copy link
Contributor

Choose a reason for hiding this comment

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

Very well. @glebk is the one whose opinions on this matter are the ones that are most relevant. If he has reasoned through the implications of this (e.g., everything that uses entry-points will no longer have access to this) and has concluded there are no reasons for concerns, then I have no concerns either.

}

/// <summary>
Expand Down
101 changes: 0 additions & 101 deletions src/Microsoft.ML/CSharpApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,18 +562,6 @@ public void Add(Microsoft.ML.Trainers.OnlineGradientDescentRegressor input, Micr
_jsonNodes.Add(Serialize("Trainers.OnlineGradientDescentRegressor", input, output));
}

public Microsoft.ML.Trainers.OrdinaryLeastSquaresRegressor.Output Add(Microsoft.ML.Trainers.OrdinaryLeastSquaresRegressor input)
{
var output = new Microsoft.ML.Trainers.OrdinaryLeastSquaresRegressor.Output();
Add(input, output);
return output;
}

public void Add(Microsoft.ML.Trainers.OrdinaryLeastSquaresRegressor input, Microsoft.ML.Trainers.OrdinaryLeastSquaresRegressor.Output output)
{
_jsonNodes.Add(Serialize("Trainers.OrdinaryLeastSquaresRegressor", input, output));
}

public Microsoft.ML.Trainers.PcaAnomalyDetector.Output Add(Microsoft.ML.Trainers.PcaAnomalyDetector input)
{
var output = new Microsoft.ML.Trainers.PcaAnomalyDetector.Output();
Expand Down Expand Up @@ -6974,95 +6962,6 @@ public OnlineGradientDescentRegressorPipelineStep(Output output)
}
}

namespace Trainers
{

/// <summary>
/// Train an OLS regression model.
/// </summary>
public sealed partial class OrdinaryLeastSquaresRegressor : Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITrainerInputWithWeight, Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITrainerInputWithLabel, Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITrainerInput, Microsoft.ML.ILearningPipelineItem
{


/// <summary>
/// L2 regularization weight
/// </summary>
[TlcModule.SweepableDiscreteParamAttribute("L2Weight", new object[]{1E-06f, 0.1f, 1f})]
public float L2Weight { get; set; } = 1E-06f;

/// <summary>
/// Whether to calculate per parameter significance statistics
/// </summary>
public bool PerParameterSignificance { get; set; } = true;

/// <summary>
/// Column to use for example weight
/// </summary>
public Microsoft.ML.Runtime.EntryPoints.Optional<string> WeightColumn { get; set; }

/// <summary>
/// Column to use for labels
/// </summary>
public string LabelColumn { get; set; } = "Label";

/// <summary>
/// The data to be used for training
/// </summary>
public Var<Microsoft.ML.Runtime.Data.IDataView> TrainingData { get; set; } = new Var<Microsoft.ML.Runtime.Data.IDataView>();

/// <summary>
/// Column to use for features
/// </summary>
public string FeatureColumn { get; set; } = "Features";

/// <summary>
/// Normalize option for the feature column
/// </summary>
public Models.NormalizeOption NormalizeFeatures { get; set; } = Models.NormalizeOption.Auto;

/// <summary>
/// Whether learner should cache input training data
/// </summary>
public Models.CachingOptions Caching { get; set; } = Models.CachingOptions.Auto;


public sealed class Output : Microsoft.ML.Runtime.EntryPoints.CommonOutputs.IRegressionOutput, Microsoft.ML.Runtime.EntryPoints.CommonOutputs.ITrainerOutput
{
/// <summary>
/// The trained model
/// </summary>
public Var<Microsoft.ML.Runtime.EntryPoints.IPredictorModel> PredictorModel { get; set; } = new Var<Microsoft.ML.Runtime.EntryPoints.IPredictorModel>();

}
public Var<IDataView> GetInputData() => TrainingData;

public ILearningPipelineStep ApplyStep(ILearningPipelineStep previousStep, Experiment experiment)
{
if (previousStep != null)
{
if (!(previousStep is ILearningPipelineDataStep dataStep))
{
throw new InvalidOperationException($"{ nameof(OrdinaryLeastSquaresRegressor)} only supports an { nameof(ILearningPipelineDataStep)} as an input.");
}

TrainingData = dataStep.Data;
}
Output output = experiment.Add(this);
return new OrdinaryLeastSquaresRegressorPipelineStep(output);
}

private class OrdinaryLeastSquaresRegressorPipelineStep : ILearningPipelinePredictorStep
{
public OrdinaryLeastSquaresRegressorPipelineStep(Output output)
{
Model = output.PredictorModel;
}

public Var<IPredictorModel> Model { get; }
}
}
}

namespace Trainers
{

Expand Down
1 change: 0 additions & 1 deletion test/BaselineOutput/Common/EntryPoints/core_ep-list.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Trainers.LogisticRegressionBinaryClassifier Train a logistic regression binary m
Trainers.LogisticRegressionClassifier Train a logistic regression multi class model Microsoft.ML.Runtime.Learners.LogisticRegression TrainMultiClass Microsoft.ML.Runtime.Learners.MulticlassLogisticRegression+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+MulticlassClassificationOutput
Trainers.NaiveBayesClassifier Train a MultiClassNaiveBayesTrainer. Microsoft.ML.Runtime.Learners.MultiClassNaiveBayesTrainer TrainMultiClassNaiveBayesTrainer Microsoft.ML.Runtime.Learners.MultiClassNaiveBayesTrainer+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+MulticlassClassificationOutput
Trainers.OnlineGradientDescentRegressor Train a Online gradient descent perceptron. Microsoft.ML.Runtime.Learners.OnlineGradientDescentTrainer TrainRegression Microsoft.ML.Runtime.Learners.OnlineGradientDescentTrainer+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+RegressionOutput
Trainers.OrdinaryLeastSquaresRegressor Train an OLS regression model. Microsoft.ML.Runtime.Learners.OlsLinearRegressionTrainer TrainRegression Microsoft.ML.Runtime.Learners.OlsLinearRegressionTrainer+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+RegressionOutput
Trainers.PcaAnomalyDetector Train an PCA Anomaly model. Microsoft.ML.Runtime.PCA.RandomizedPcaTrainer TrainPcaAnomaly Microsoft.ML.Runtime.PCA.RandomizedPcaTrainer+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+AnomalyDetectionOutput
Trainers.PoissonRegressor Train an Poisson regression model. Microsoft.ML.Runtime.Learners.PoissonRegression TrainRegression Microsoft.ML.Runtime.Learners.PoissonRegression+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+RegressionOutput
Trainers.StochasticDualCoordinateAscentBinaryClassifier Train an SDCA binary model. Microsoft.ML.Runtime.Learners.Sdca TrainBinary Microsoft.ML.Runtime.Learners.LinearClassificationTrainer+Arguments Microsoft.ML.Runtime.EntryPoints.CommonOutputs+BinaryClassificationOutput
Expand Down
143 changes: 0 additions & 143 deletions test/BaselineOutput/Common/EntryPoints/core_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10682,149 +10682,6 @@
"ITrainerOutput"
]
},
{
"Name": "Trainers.OrdinaryLeastSquaresRegressor",
"Desc": "Train an OLS regression model.",
"FriendlyName": "Ordinary Least Squares (Regression)",
"ShortName": "ols",
"Inputs": [
{
"Name": "TrainingData",
"Type": "DataView",
"Desc": "The data to be used for training",
"Aliases": [
"data"
],
"Required": true,
"SortOrder": 1.0,
"IsNullable": false
},
{
"Name": "FeatureColumn",
"Type": "String",
"Desc": "Column to use for features",
"Aliases": [
"feat"
],
"Required": false,
"SortOrder": 2.0,
"IsNullable": false,
"Default": "Features"
},
{
"Name": "LabelColumn",
"Type": "String",
"Desc": "Column to use for labels",
"Aliases": [
"lab"
],
"Required": false,
"SortOrder": 3.0,
"IsNullable": false,
"Default": "Label"
},
{
"Name": "WeightColumn",
"Type": "String",
"Desc": "Column to use for example weight",
"Aliases": [
"weight"
],
"Required": false,
"SortOrder": 4.0,
"IsNullable": false,
"Default": "Weight"
},
{
"Name": "NormalizeFeatures",
"Type": {
"Kind": "Enum",
"Values": [
"No",
"Warn",
"Auto",
"Yes"
]
},
"Desc": "Normalize option for the feature column",
"Aliases": [
"norm"
],
"Required": false,
"SortOrder": 5.0,
"IsNullable": false,
"Default": "Auto"
},
{
"Name": "Caching",
"Type": {
"Kind": "Enum",
"Values": [
"Auto",
"Memory",
"Disk",
"None"
]
},
"Desc": "Whether learner should cache input training data",
"Aliases": [
"cache"
],
"Required": false,
"SortOrder": 6.0,
"IsNullable": false,
"Default": "Auto"
},
{
"Name": "L2Weight",
"Type": "Float",
"Desc": "L2 regularization weight",
"Aliases": [
"l2"
],
"Required": false,
"SortOrder": 50.0,
"IsNullable": false,
"Default": 1E-06,
"SweepRange": {
"RangeType": "Discrete",
"Values": [
1E-06,
0.1,
1.0
]
}
},
{
"Name": "PerParameterSignificance",
"Type": "Bool",
"Desc": "Whether to calculate per parameter significance statistics",
"Aliases": [
"sig"
],
"Required": false,
"SortOrder": 150.0,
"IsNullable": false,
"Default": true
}
],
"Outputs": [
{
"Name": "PredictorModel",
"Type": "PredictorModel",
"Desc": "The trained model"
}
],
"InputKind": [
"ITrainerInputWithWeight",
"ITrainerInputWithLabel",
"ITrainerInput"
],
"OutputKind": [
"IRegressionOutput",
"ITrainerOutput"
]
},
{
"Name": "Trainers.PcaAnomalyDetector",
"Desc": "Train an PCA Anomaly model.",
Expand Down