Skip to content

DOC Ensures that PoissonRegressor passes numpydoc validation #20386

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 7 commits into from
Jul 7, 2021
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
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
"PassiveAggressiveRegressor",
"PatchExtractor",
"Pipeline",
"PoissonRegressor",
"PolynomialCountSketch",
"PolynomialFeatures",
"PowerTransformer",
Expand Down
9 changes: 8 additions & 1 deletion sklearn/linear_model/_glm/glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def fit(self, X, y, sample_weight=None):

Returns
-------
self : returns an instance of self.
self : object
Fitted model.
"""
if isinstance(self.family, ExponentialDispersionModel):
self._family_instance = self.family
Expand Down Expand Up @@ -498,6 +499,11 @@ class PoissonRegressor(GeneralizedLinearRegressor):
2.088...
>>> clf.predict([[1, 1], [3, 4]])
array([10.676..., 21.875...])

See Also
----------
GeneralizedLinearRegressor : Generalized Linear Model with a Poisson
distribution.
"""

def __init__(
Expand All @@ -524,6 +530,7 @@ def __init__(

@property
def family(self):
"""Return the string `'poisson'`."""
# Make this attribute read-only to avoid mis-uses e.g. in GridSearch.
return "poisson"

Expand Down