-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Gains chart and Lift chart (#71)
* add unfinished plot_cumulative_gain and some stylefixes * write out interface for important helper function cumulative_gain_curve * finish plot_cumulative_gain and add example * add tests to plot_cumulative_gain * add plot_lift_curve, tests, and example * add example images and new metrics in docs
- Loading branch information
1 parent
7d39a7b
commit 3378c28
Showing
8 changed files
with
389 additions
and
21 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
An example showing the plot_cumulative_gain method used | ||
by a scikit-learn classifier | ||
""" | ||
from __future__ import absolute_import | ||
import matplotlib.pyplot as plt | ||
from sklearn.linear_model import LogisticRegression | ||
from sklearn.datasets import load_breast_cancer as load_data | ||
import scikitplot as skplt | ||
|
||
|
||
X, y = load_data(return_X_y=True) | ||
lr = LogisticRegression() | ||
lr.fit(X, y) | ||
probas = lr.predict_proba(X) | ||
skplt.metrics.plot_cumulative_gain(y_true=y, y_probas=probas) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
An example showing the plot_lift_curve method used | ||
by a scikit-learn classifier | ||
""" | ||
from __future__ import absolute_import | ||
import matplotlib.pyplot as plt | ||
from sklearn.linear_model import LogisticRegression | ||
from sklearn.datasets import load_breast_cancer as load_data | ||
import scikitplot as skplt | ||
|
||
|
||
X, y = load_data(return_X_y=True) | ||
lr = LogisticRegression() | ||
lr.fit(X, y) | ||
probas = lr.predict_proba(X) | ||
skplt.metrics.plot_lift_curve(y_true=y, y_probas=probas) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.