Skip to content

Scrubbing SDCA learners #2825

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
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void Example()
// the "Features" column produced by FeaturizeText as the features column.
var pipeline = mlContext.Transforms.Text.FeaturizeText("SentimentText", "Features")
.AppendCacheCheckpoint(mlContext) // Add a data-cache step within a pipeline.
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Sentiment", featureColumnName: "Features", l2Const: 0.001f));
.Append(mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Sentiment", featureColumnName: "Features", l2Regularization: 0.001f));

// Step 3: Run Cross-Validation on this pipeline.
var cvResults = mlContext.BinaryClassification.CrossValidate(data, pipeline, labelColumn: "Sentiment");
Expand All @@ -65,7 +65,7 @@ public static void Example()
LabelColumnName = "Sentiment",
FeatureColumnName = "Features",
ConvergenceTolerance = 0.01f, // The learning rate for adjusting bias from being regularized
NumThreads = 2, // Degree of lock-free parallelism
NumberOfThreads = 2, // Degree of lock-free parallelism
}));

// Run Cross-Validation on this second pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void Example()
// Step 2: Create a binary classifier. This trainer may produce a logistic regression model.
// We set the "Label" column as the label of the dataset, and the "Features" column as the features column.
var pipeline = mlContext.BinaryClassification.Trainers.StochasticDualCoordinateAscentNonCalibrated(
labelColumnName: "Label", featureColumnName: "Features", loss: new HingeLoss(), l2Const: 0.001f);
labelColumnName: "Label", featureColumnName: "Features", loss: new HingeLoss(), l2Regularization: 0.001f);

// Step 3: Train the pipeline created.
var model = pipeline.Fit(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Example()
// Make the convergence tolerance tighter.
ConvergenceTolerance = 0.05f,
// Increase the maximum number of passes over training data.
MaxIterations = 30,
NumberOfIterations = 30,
// Give the instances of the positive class slightly more weight.
PositiveInstanceWeight = 1.2f,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static void Example()
.Trainers.StochasticGradientDescentNonCalibrated(
new SgdNonCalibratedBinaryTrainer.Options
{
InitLearningRate = 0.01,
MaxIterations = 10,
L2Weight = 1e-7f
InitialLearningRate = 0.01,
NumberOfIterations = 10,
L2Regularization = 1e-7f
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Example()
// Make the convergence tolerance tighter.
ConvergenceTolerance = 5e-5,
// Increase the maximum number of passes over training data.
MaxIterations = 30,
NumberOfIterations = 30,
// Give the instances of the positive class slightly more weight.
PositiveInstanceWeight = 1.2f,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void Example()
// Make the convergence tolerance tighter.
ConvergenceTolerance = 0.05f,
// Increase the maximum number of passes over training data.
MaxIterations = 30,
NumberOfIterations = 30,
};

// Create a pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void Example()
// Make the convergence tolerance tighter.
ConvergenceTolerance = 0.02f,
// Increase the maximum number of passes over training data.
MaxIterations = 30,
NumberOfIterations = 30,
// Increase learning rate for bias
BiasLearningRate = 0.1f
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void SdcaBinaryClassification()
row.Label,
row.Features,
l1Threshold: 0.25f,
maxIterations: 100)))
numberOfIterations: 100)))
.Append(row => (
Label: row.Label,
Score: row.Score,
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/Microsoft.ML.Samples/Static/SDCARegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void SdcaRegression()
r.label,
r.features,
l1Threshold: 0f,
maxIterations: 100,
numberOfIterations: 100,
onFit: p => pred = p)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ ValueMapper<TSrc, VBuffer<float>> IFeatureContributionMapper.GetFeatureContribut
}
}

/// <summary>
/// The model parameters class for linear binary trainer estimators.
/// </summary>
public sealed partial class LinearBinaryModelParameters : LinearModelParameters,
ICanGetSummaryInKeyValuePairs,
IParameterMixer<float>
Expand Down Expand Up @@ -577,6 +580,9 @@ private protected override void SaveAsIni(TextWriter writer, RoleMappedSchema sc
}
}

/// <summary>
/// The model parameters class for linear regression.
/// </summary>
public sealed class LinearRegressionModelParameters : RegressionModelParameters,
IParameterMixer<float>,
ICanGetSummaryInKeyValuePairs
Expand Down
Loading