8000 DOC: Add example to linear_model.PoissonRegressor by nuka137 · Pull Request #17453 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC: Add example to linear_model.PoissonRegressor #17453

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 5 commits into from
Jun 7, 2020
Merged
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
17 changes: 17 additions & 0 deletions sklearn/linear_model/_glm/glm.py
7E5A
Original file line numberDiff line number Diff line change
Expand Up @@ -430,6 +430,23 @@ class PoissonRegressor(GeneralizedLinearRegressor):

n_iter_ : int
Actual number of iterations used in the solver.

Examples
----------
>>> from sklearn import linear_model
>>> clf = linear_model.PoissonRegressor()
>>> X = [[1, 2], [2, 3], [3, 4], [4, 3]]
>>> y = [12, 17, 22, 21]
>>> clf.fit(X, y)
PoissonRegressor()
>>> clf.score(X, y)
0.990...
>>> clf.coef_
array([0.121..., 0.158...])
>>> clf.intercept_
2.088...
>>> clf.predict([[1, 1], [3, 4]])
array([10.676..., 21.875...])
"""
def __init__(self, *, alpha=1.0, fit_intercept=True, max_iter=100,
tol=1e-4, warm_start=False, verbose=0):
Expand Down
0