-
Notifications
You must be signed in to change notification settings - Fork 1.9k
More pigstensions #1084
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
More pigstensions #1084
Conversation
adding pigstensions for lr, multilr, possion
Removing the AP xtension that produces the probability column.
/// the linear model that was trained. Note that this action cannot change the result in any way; it is only a way for the caller to | ||
/// be informed about what was learnt.</param> | ||
/// <returns>The predicted output.</returns> | ||
public static (Scalar<float> score, Scalar<float> probability, Scalar<bool> predictedLabel) LogisticRegression(this BinaryClassificationContext.BinaryClassificationTrainers ctx, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogisticRegression [](start = 100, length = 18)
rename to LogisticRegressionBinaryClassifier #Resolved
} | ||
return trainer; | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove #Resolved
/// <summary> | ||
/// Predict a target using a linear binary classification model trained with the SDCA trainer, and a custom loss. | ||
/// Note that because we cannot be sure that all loss functions will produce naturally calibrated outputs, setting | ||
/// a custom loss function will not produce a calibrated probability column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove #Resolved
.Append(r => (r.label, preds: ctx.Trainers.Sdca(r.label, r.features, | ||
maxIterations: 2, | ||
loss: loss, onFit: p => pred = p))); | ||
.Append(r => (r.label, preds: ctx.Trainers.AveragedPerceptron(loss, r.label, r.features, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AveragedPerceptron [](start = 59, length = 18)
revert #Resolved
using Microsoft.ML.StaticPipe; | ||
using Microsoft.ML.StaticPipe.Runtime; | ||
|
||
namespace Microsoft.ML.Trainers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft.ML.Trainers [](start = 10, length = 21)
change namespace #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Microsoft.ML.StaticPipe.Runtime; | ||
using System; | ||
|
||
namespace Microsoft.ML.Trainers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft.ML.Trainers [](start = 10, length = 21)
change namespace #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually moving to ML.StaticPipe namespace won't fix it by itself. All the contexts are in Microsoft.ML.
@TomFinley move the contexts in StaticPipe as well?
In reply to: 221111449 [](ancestors = 221111449)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If the user opts into the static pipe, they will see the trainers. It's good enough for me
In reply to: 221299214 [](ancestors = 221299214,221111449)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context is in Microsoft.ML, i don't see anything import staticPipe.
In reply to: 221307154 [](ancestors = 221307154,221299214,221111449)
@@ -25,7 +25,7 @@ public void OnlineLinearWorkout() | |||
|
|||
var trainData = pipe.Fit(data).Transform(data).AsDynamic; | |||
|
|||
IEstimator<ITransformer> est = new OnlineGradientDescentTrainer(Env, new OnlineGradientDescentTrainer.Arguments()); | |||
IEstimator<ITransformer> est = new OnlineGradientDescentTrainer(Env, "Label", "Features"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Label" [](start = 81, length = 7)
Any chance I can convince you to use DefaultColumnNames.Label? #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change, it; it won't be any better than it is.
This is "Label", because in like 20 we defined r.Label.
There is no way to type the the member name to be the same as a particular string.
(might be the only thing i miss from javascript :P)
In reply to: 221112970 [](ancestors = 221112970)
/// <param name="weightsColumn">The name of the weights column.</param> | ||
/// <param name="lossFunction">The custom loss functions. Defaults to <see cref="SquaredLoss"/> if not provided.</param> | ||
public OnlineGradientDescentTrainer(IHostEnvironment env, | ||
string labelColumn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labelColumn [](start = 19, length = 11)
any reason not to use default values here? #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we have marked the label and feature columns as required everywhere.
In reply to: 221113276 [](ancestors = 221113276)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L1Weight = Args.L1Weight; | ||
OptTol = Args.OptTol; | ||
MemorySize = Args.MemorySize; | ||
Contracts.CheckParam(l2Weight >= 0, nameof(l2Weight), "Must be non-negative, if provided."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contracts [](start = 12, length = 9)
why not Host? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Action<LinearBinaryPredictor> onFit = null | ||
) | ||
{ | ||
Contracts.CheckValue(label, nameof(label)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contracts [](start = 12, length = 9)
technically you have ctx.Environment #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx is just the trainers, not the context. I don't have the env.
In reply to: 221115177 [](ancestors = 221115177)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you do. You need to call StaticPipeUtils.GetEnvironment
to get it
In reply to: 221295921 [](ancestors = 221295921,221115177)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That requires a SchemaBearing, as argument. Doesn't seem worth to construct one to just check on the params..
In reply to: 221307369 [](ancestors = 221307369,221295921,221115177)
|
||
} | ||
|
||
internal sealed class LbfgsStaticsUtils{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Statics [](start = 31, length = 7)
static
? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <param name="features">The features, or independent variables.</param> | ||
/// <param name="weights">The optional example weights.</param> | ||
/// <param name="enoforceNoNegativity">Enforce non-negative weights.</param> | ||
/// <param name="l1Weight">Weight of L1 regularizer term.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is more standard to say regularization, instead of regularizer. #Resolved
more checks on user params
string labelColumn, | ||
string featureColumn, | ||
float learningRate = Arguments.OgdDefaultArgs.LearningRate, | ||
bool decreaseLearningRate =Arguments.OgdDefaultArgs.DecreaseLearningRate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space after equal. #Resolved
@@ -46,10 +46,22 @@ public sealed class Arguments : ArgumentsBase | |||
/// <param name="labelColumn">The name of the label column.</param> | |||
/// <param name="featureColumn">The name of the feature column.</param> | |||
/// <param name="weightColumn">The name for the example weight column.</param> | |||
/// <param name="enforceNoNegativity">Enforce non-negative weights.</param> | |||
/// <param name="l1Weight">Weight of L1 regularizer term.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regularizer [](start = 48, length = 11)
regularizer pops up in many files, let me see if I can help you find them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off by one fix .
ongoing work to address #754.
This PR adds the xtensions for AP, OGD, LR, Multi-LR, and Poisson Regression.