Skip to content

Commit 83a92ad

Browse files
authored
XML documentation for SDCA regression trainer. (#3403)
* XML documentation for SDCA regression trainer. * PR feedback. * PR feedback.
1 parent 548f323 commit 83a92ad

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Training Algorithm Details
2+
This trainer is based on the Stochastic Dual Coordinate Ascent (SDCA) method, a
3+
state-of-the-art optimization technique for convex objective functions. The
4+
algorithm can be scaled for use on large out-of-memory data sets due to a
5+
semi-asynchronized implementation that supports multi-threading.
6+
7+
Convergence is underwritten by periodically enforcing synchronization between
8+
primal and dual variables in a separate thread. Several choices of loss
9+
functions are also provided.
10+
11+
Note that SDCA is a stochastic and streaming optimization algorithm. The result
12+
depends on the order of training data because the stopping tolerance is not
13+
tight enough. In strongly-convex optimization, the optimal solution is unique
14+
and therefore everyone eventually reaches the same place. Even in
15+
non-strongly-convex cases, you will get equally-good solutions from run to run.
16+
For reproducible results, it is recommended that one sets 'Shuffle' to False and
17+
'NumThreads' to 1. Elastic net regularization can be specified by the 'L2Const'
18+
and 'L1Threshold' parameters. Note that the 'L2Const' has an effect on the rate
19+
of convergence. In general, the larger the 'L2Const', the faster SDCA converges.
20+
21+
For more information, see:
22+
* [Scaling Up Stochastic Dual Coordinate
23+
Ascent.](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/06/main-3.pdf)
24+
* [Stochastic Dual Coordinate Ascent Methods for Regularized Loss
25+
Minimization.](http://www.jmlr.org/papers/volume14/shalev-shwartz13a/shalev-shwartz13a.pdf)

src/Microsoft.ML.StandardTrainers/Standard/SdcaRegression.cs

+22-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,28 @@ namespace Microsoft.ML.Trainers
2424
/// <summary>
2525
/// The <see cref="IEstimator{TTransformer}"/> for training a regression model using the stochastic dual coordinate ascent method.
2626
/// </summary>
27-
/// <include file='doc.xml' path='doc/members/member[@name="SDCA_remarks"]/*' />
27+
/// <remarks>
28+
/// <format type="text/markdown"><![CDATA[
29+
/// To create this trainer, use [Sdca](xref:Microsoft.ML.StandardTrainersCatalog.Sdca(Microsoft.ML.RegressionCatalog.RegressionTrainers,System.String,System.String,System.String,Microsoft.ML.Trainers.ISupportSdcaRegressionLoss,System.Nullable{System.Single},System.Nullable{System.Single},System.Nullable{System.Int32}))
30+
/// or [Sdca(Options)](xref:Microsoft.ML.StandardTrainersCatalog.Sdca(Microsoft.ML.RegressionCatalog.RegressionTrainers,Microsoft.ML.Trainers.SdcaRegressionTrainer.Options)).
31+
///
32+
/// [!include[io](~/../docs/samples/docs/api-reference/io-columns-regression.md)]
33+
///
34+
/// ### Trainer Characteristics
35+
/// | | |
36+
/// | -- | -- |
37+
/// | Machine learning task | Regression |
38+
/// | Is normalization required? | Yes |
39+
/// | Is caching required? | No |
40+
/// | Required NuGet in addition to Microsoft.ML | None |
41+
///
42+
/// [!include[io](~/../docs/samples/docs/api-reference/algo-details-sdca.md)]
43+
/// ]]>
44+
/// </format>
45+
/// </remarks>
46+
/// <seealso cref="StandardTrainersCatalog.Sdca(RegressionCatalog.RegressionTrainers, string, string, string, ISupportSdcaRegressionLoss, float?, float?, int?)"/>
47+
/// <seealso cref="StandardTrainersCatalog.Sdca(RegressionCatalog.RegressionTrainers, SdcaRegressionTrainer.Options)"/>
48+
/// <seealso cref="Options"/>
2849
public sealed class SdcaRegressionTrainer : SdcaTrainerBase<SdcaRegressionTrainer.Options, RegressionPredictionTransformer<LinearRegressionModelParameters>, LinearRegressionModelParameters>
2950
{
3051
internal const string LoadNameValue = "SDCAR";

src/Microsoft.ML.StandardTrainers/StandardTrainersCatalog.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ public static SgdNonCalibratedTrainer SgdNonCalibrated(this BinaryClassification
129129
}
130130

131131
/// <summary>
132-
/// Predict a target using a linear regression model trained with <see cref="SdcaRegressionTrainer"/>.
132+
/// Create <see cref="SdcaRegressionTrainer"/>, which predicts a target using a linear regression model.
133133
/// </summary>
134134
/// <param name="catalog">The regression catalog trainer object.</param>
135-
/// <param name="labelColumnName">The name of the label column.</param>
136-
/// <param name="featureColumnName">The name of the feature column.</param>
135+
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/></param>
136+
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/></param>
137137
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param>
138138
/// <param name="lossFunction">The <a href="https://en.wikipedia.org/wiki/Loss_function">loss</a> function minimized in the training process. Using, for example, its default <see cref="SquaredLoss"/> leads to a least square trainer.</param>
139139
/// <param name="l2Regularization">The L2 weight for <a href='https://en.wikipedia.org/wiki/Regularization_(mathematics)'>regularization</a>.</param>
@@ -160,7 +160,7 @@ public static SdcaRegressionTrainer Sdca(this RegressionCatalog.RegressionTraine
160160
}
161161

162162
/// <summary>
163-
/// Predict a target using a linear regression model trained with <see cref="SdcaRegressionTrainer"/> and advanced options.
163+
/// Create <see cref="SdcaRegressionTrainer"/> with advanced options, which predicts a target using a linear regression model.
164164
/// </summary>
165165
/// <param name="catalog">The regression catalog trainer object.</param>
166166
/// <param name="options">Trainer options.</param>
@@ -181,11 +181,11 @@ public static SdcaRegressionTrainer Sdca(this RegressionCatalog.RegressionTraine
181181
}
182182

183183
/// <summary>
184-
/// Predict a target using a linear classification model trained with <see cref="SdcaLogisticRegressionBinaryTrainer"/>.
184+
/// Create <see cref="SdcaLogisticRegressionBinaryTrainer"/>, which predicts a target using a linear classification model.
185185
/// </summary>
186186
/// <param name="catalog">The binary classification catalog trainer object.</param>
187-
/// <param name="labelColumnName">The name of the label column.</param>
188-
/// <param name="featureColumnName">The name of the feature column.</param>
187+
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param>
188+
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
189189
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param>
190190
/// <param name="l2Regularization">The L2 weight for <a href='https://en.wikipedia.org/wiki/Regularization_(mathematics)'>regularization</a>.</param>
191191
/// <param name="l1Regularization">The L1 <a href='https://en.wikipedia.org/wiki/Regularization_(mathematics)'>regularization</a> hyperparameter. Higher values will tend to lead to more sparse model.</param>
@@ -211,7 +211,7 @@ public static SdcaLogisticRegressionBinaryTrainer SdcaLogisticRegression(
211211
}
212212

213213
/// <summary>
214-
/// Predict a target using a linear classification model trained with <see cref="SdcaLogisticRegressionBinaryTrainer"/> and advanced options.
214+
/// Create <see cref="SdcaLogisticRegressionBinaryTrainer"/> using advanced options, which predicts a target using a linear classification model.
215215
/// </summary>
216216
/// <param name="catalog">The binary classification catalog trainer object.</param>
217217
/// <param name="options">Trainer options.</param>

0 commit comments

Comments
 (0)