Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Add l2_penalty property to text_classifier create method (#3285)
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasbohacek committed Jul 31, 2020
1 parent 6716bbe commit dadfae5
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def create(
method="auto",
validation_set="auto",
max_iterations=10,
l2_penalty=0.2,
):
"""
Create a model that trains a classifier to classify text from a
Expand Down Expand Up @@ -88,6 +89,14 @@ def create(
increasing this (the default value is 10) if the training accuracy is
low and the *Grad-Norm* in the display is large.
l2_penalty : float, optional
Weight on l2 regularization of the model. The larger this weight, the
more the model coefficients shrink toward 0. This introduces bias into
the model but decreases variance, potentially leading to better
predictions. The default value is 0.2; setting this parameter to 0
corresponds to unregularized logistic regression. See the ridge
regression reference for more detail.
Returns
-------
out : :class:`~TextClassifier`
Expand Down Expand Up @@ -145,7 +154,7 @@ def create(
train,
target=target,
features=features,
l2_penalty=0.2,
l2_penalty=l2_penalty,
max_iterations=max_iterations,
validation_set=validation_set,
)
Expand Down

0 comments on commit dadfae5

Please sign in to comment.