-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add LR XML doc #3385
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
Add LR XML doc #3385
Changes from 2 commits
9e4b1f8
5d5e26f
7bbf3b3
b2d48fa
3b3ab5b
190cd1f
4cb45a2
7a2098d
a1b3d76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,55 @@ | |
namespace Microsoft.ML.Trainers | ||
{ | ||
|
||
/// <include file='doc.xml' path='doc/members/member[@name="LBFGS"]/*' /> | ||
/// <include file='doc.xml' path='docs/members/example[@name="LogisticRegressionBinaryClassifier"]/*' /> | ||
/// <summary> | ||
/// The <see cref="IEstimator{TTransformer}"/> to predict a target using a linear logistic regression model trained with L-BFGS method. | ||
/// </summary> | ||
/// <remarks> | ||
/// <format type="text/markdown"><) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
this UID won't work, you need fully qualified names. please use https://xref.docs.microsoft.com/autocomplete?text=LbfgsLogisticRegression to get the UID. It's this one: Microsoft.ML.StandardTrainersCatalog.LbfgsLogisticRegression(Microsoft.ML.BinaryClassificationCatalog.BinaryClassificationTrainers,System.String,System.String,System.String,System.Single,System.Single,System.Single,System.Int32,System.Boolean) please also fix for the other one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/// or [LbfgsLogisticRegression(Options)](xref:Microsoft.ML.StandardTrainersCatalog.LbfgsLogisticRegression(BinaryClassificationCatalog.BinaryClassificationTrainers, LbfgsLogisticRegressionBinaryTrainer.Options)). | ||
/// | ||
/// [!include[io](~/../docs/samples/docs/api-reference/io-columns-binary-classification.md)] | ||
/// | ||
/// ### Trainer Characteristics | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be Estimator Characteristics? #Resolved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/// | | | | ||
/// | -- | -- | | ||
/// | Machine learning task | Binary classification | | ||
/// | Is normalization required? | Yes | | ||
/// | Is caching required? | No | | ||
/// | Required NuGet in addition to Microsoft.ML | None | | ||
/// | ||
/// ### Scoring Function | ||
/// Linear logistic regression is a variant of linear model. It maps feature vector $\hat{y}\left(\boldsymbol{x}\right) = \boldsymbol{x} \in {\mathbb R}^n$ to a score by using $\boldsymbol{w}^T \boldsymbol{x} + b$, | ||
/// where the $j$-th element in $\boldsymbol{w}$ is the $j$-th feature's coefficient and $b$ is a learnable bias term. | ||
/// The corresponding probability of getting a true label is $\frac{1}{1 + e^{\hat{y}\left(\boldsymbol{x}\right)}}$. | ||
/// | ||
/// ### Training Algorithm Details | ||
/// The optimization technique implemented is based on [the limited memory Broyden-Fletcher-Goldfarb-Shanno method (L-BFGS)](https://en.wikipedia.org/wiki/Limited-memory_BFGS). | ||
/// L-BFGS is a [quasi-Newtonian method](https://en.wikipedia.org/wiki/Quasi-Newton_method) which replaces the expensive computation cost of Hessian matrix with an approximation but still enjoys a fast convergence rate like [Newton method](https://en.wikipedia.org/wiki/Newton%27s_method_in_optimization) where the full Hessian matrix is computed. | ||
/// Since L-BFGS approximation uses only a limited amount of historical states to compute the next step direction, it is especially suited for problems with high-dimensional feature vector. | ||
/// The number of historical states is a user-specified parameter, using a larger number may lead to a better approximation to the Hessian matrix but also a higher computation cost per step. | ||
/// | ||
/// Regularization is a method that can render an ill-posed problem more tractable by imposing constraints that provide information to supplement the data and that prevents overfitting by penalizing model's magnitude usually measured by some norm functions. | ||
/// This can improve the generalization of the model learned by selecting the optimal complexity in the bias-variance tradeoff. | ||
/// Regularization works by adding the penalty that is associated with coefficient values to the error of the hypothesis. | ||
/// An accurate model with extreme coefficient values would be penalized more, but a less accurate model with more conservative values would be penalized less. | ||
/// | ||
/// This learner supports [elastic net regularization](https://en.wikipedia.org/wiki/Elastic_net_regularization): a linear combination of L1-norm (LASSO), $|| \boldsymbol{w} ||_1$, and L2-norm (ridge), $|| \boldsymbol{w} ||_2^2$ regularizations. | ||
/// L1-nrom and L2-norm regularizations have different effects and uses that are complementary in certain respects. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
L1-norm #Resolved |
||
/// Using L1-norm can increase sparsity of the trained $\boldsymbol{w}$. | ||
/// When working with high-dimensional data, it shrinks small weights of irrevalent features to 0 and therefore no reource will be spent on those bad features when making prediction. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
irrelavent #Resolved |
||
/// If L1-norm regularization is used, the used training algorithm would be [QWL-QN](http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.68.5260). | ||
/// L2-norm regularization is preferable for data that is not sparse and it largely penalizes the existence of large weights. | ||
/// | ||
/// An agressive regularization (that is, assigning large coefficients to L1-norm or L2-norm regularization terms) can harm predictive capacity by excluding important variables out of the model. | ||
/// Therefore, choosing the right regularization coefficients is important when applying logistic regression. | ||
/// ]]> | ||
/// </format> | ||
/// </remarks> | ||
/// <seealso cref="Microsoft.ML.StandardTrainersCatalog.LbfgsLogisticRegression(BinaryClassificationCatalog.BinaryClassificationTrainers, string, string, string, float, float, float, int, bool)"/> | ||
/// <seealso cref="Microsoft.ML.StandardTrainersCatalog.LbfgsLogisticRegression(BinaryClassificationCatalog.BinaryClassificationTrainers, LbfgsLogisticRegressionBinaryTrainer.Options)"/> | ||
/// <seealso cref="Options"/> | ||
public sealed partial class LbfgsLogisticRegressionBinaryTrainer : LbfgsTrainerBase<LbfgsLogisticRegressionBinaryTrainer.Options, | ||
BinaryPredictionTransformer<CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator>>, | ||
CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator>> | ||
|
@@ -39,6 +86,10 @@ public sealed partial class LbfgsLogisticRegressionBinaryTrainer : LbfgsTrainerB | |
internal const string Summary = "Logistic Regression is a method in statistics used to predict the probability of occurrence of an event and can " | ||
+ "be used as a classification algorithm. The algorithm predicts the probability of occurrence of an event by fitting data to a logistical function."; | ||
|
||
/// <summary> | ||
/// Options for the <see cref="LbfgsLogisticRegressionBinaryTrainer"/> as used in | ||
/// [LbfgsLogisticRegression(Options)](xref:Microsoft.ML.StandardTrainersCatalog.LbfgsLogisticRegression(BinaryClassificationCatalog.BinaryClassificationTrainers, LbfgsLogisticRegressionBinaryTrainer.Options)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
ditto: fix uid more info: https://microsoft.sharepoint.com/teams/ML.NET/_layouts/OneNote.aspx?id=%2Fteams%2FML.NET%2FSiteAssets%2FML.NET%20Notebook&wd=target%28Specs.one%7C19A109F5-7BDE-4447-B63E-3934EAD9615D%2FML.Net%20API%20documentation%20fit%20and%20finish%7CC15DB5A6-712C-469F-BDED-5B02554A1238%2F%29 |
||
/// </summary> | ||
public sealed class Options : OptionsBase | ||
{ | ||
/// <summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,11 +518,11 @@ public static OnlineGradientDescentTrainer OnlineGradientDescent(this Regression | |
} | ||
|
||
/// <summary> | ||
/// Predict a target using a linear binary classification model trained with the <see cref="Trainers.LbfgsLogisticRegressionBinaryTrainer"/> trainer. | ||
/// Create an <see cref="Trainers.LbfgsLogisticRegressionBinaryTrainer"/>, which predicts a target using a linear binary classification model trained over boolean label data. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can you please check with Shahab/@natke if we need "an"? In my PRs it was just Create There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Create a" or just "Create" #Resolved |
||
/// </summary> | ||
/// <param name="catalog">The binary classification catalog trainer object.</param> | ||
/// <param name="labelColumnName">The name of the label column.</param> | ||
/// <param name="featureColumnName">The name of the feature column.</param> | ||
/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Boolean"/>.</param> | ||
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> | ||
/// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> | ||
/// <param name="enforceNonNegativity">Enforce non-negative weights.</param> | ||
/// <param name="l1Regularization">The L1 <a href='tmpurl_regularization'>regularization</a> hyperparameter. Higher values will tend to lead to more sparse model.</param> | ||
|
@@ -552,7 +552,7 @@ public static LbfgsLogisticRegressionBinaryTrainer LbfgsLogisticRegression(this | |
} | ||
|
||
/// <summary> | ||
/// Predict a target using a linear binary classification model trained with the <see cref="Trainers.LbfgsLogisticRegressionBinaryTrainer"/> trainer. | ||
/// Create an <see cref="Trainers.LbfgsLogisticRegressionBinaryTrainer"/> with advanced options, which predicts a target using a linear binary classification model trained over boolean label data. | ||
/// </summary> | ||
/// <param name="catalog">The binary classification catalog trainer object.</param> | ||
/// <param name="options">Advanced arguments to the algorithm.</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.
please delete these sections that you moved here from doc.xml #Resolved