Skip to content

DOC small typos and fixes for poisson example #17078

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 2 commits into from
Apr 29, 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
19 changes: 9 additions & 10 deletions examples/linear_model/plot_poisson_regression_non_normal_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,9 @@ def score_estimator(estimator, df_test):


##############################################################################
# Like the Ridge regression above, the gradient boosted trees model minimizes
# the conditional squared error. However, because of a higher predictive power,
# it also results in a smaller Poisson deviance than the linear Poisson
# regression model.
# Like the Poisson GLM above, the gradient boosted trees model minimizes
# the Poisson deviance. However, because of a higher predictive power,
# it reaches lower values of Poisson deviance.
#
# Evaluating models with a single train / test split is prone to random
# fluctuations. If computing resources allow, it should be verified that
Expand Down Expand Up @@ -339,7 +338,7 @@ def score_estimator(estimator, df_test):
#
# Note that we could have used the least squares loss for the
# ``HistGradientBoostingRegressor`` model. This would wrongly assume a normal
# distribution the response variable as for the `Ridge` model, and possibly
# distributed response variable as does the `Ridge` model, and possibly
# also lead to slightly negative predictions. However the gradient boosted
# trees would still perform relatively well and in particular better than
# ``PoissonRegressor`` thanks to the flexibility of the trees combined with the
Expand Down Expand Up @@ -533,13 +532,9 @@ def lorenz_curve(y_true, y_pred, exposure):
# Main takeaways
# --------------
#
# - The performance of the models can be evaluted by their ability to yield
# - The performance of the models can be evaluated by their ability to yield
# well-calibrated predictions and a good ranking.
#
# - The Gini index reflects the ability of a model to rank predictions
# irrespective of their absolute values, and therefore only assess their
# ranking power.
#
# - The calibration of the model can be assessed by plotting the mean observed
# value vs the mean predicted value on groups of test samples binned by
# predicted risk.
Expand All @@ -552,6 +547,10 @@ def lorenz_curve(y_true, y_pred, exposure):
# - Using the Poisson loss with a log-link can correct these problems and lead
# to a well-calibrated linear model.
#
# - The Gini index reflects the ability of a model to rank predictions
# irrespective of their absolute values, and therefore only assess their
# ranking power.
#
# - Despite the improvement in calibration, the ranking power of both linear
# models are comparable and well below the ranking power of the Gradient
# Boosting Regression Trees.
Expand Down