Skip to content

Commit fcc7e01

Browse files
committed
Nina's gain curve axis fix
1 parent 33ef447 commit fcc7e01

File tree

10 files changed

+22
-18
lines changed

10 files changed

+22
-18
lines changed

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Win Vector LLC extras for teaching data science in Python 3
22

33
pip install wvpy
4-
# or: pip install https://github.com/WinVector/wvpy/raw/master/dist/wvpy-0.1.4.tar.gz
4+
# or: pip install https://github.com/WinVector/wvpy/raw/master/dist/wvpy-0.1.5.tar.gz
55

66
~/anaconda3/bin/python3
77

pkg/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Win Vector LLC extras for teaching data science in Python 3
22

33
pip install wvpy
4-
# or: pip install https://github.com/WinVector/wvpy/raw/master/dist/wvpy-0.1.4.tar.gz
4+
# or: pip install https://github.com/WinVector/wvpy/raw/master/dist/wvpy-0.1.5.tar.gz
55

66
~/anaconda3/bin/python3
77

pkg/build/lib/wvpy/util.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def dual_hist_plot_proba1(probs, istrue):
132132
matplotlib.pyplot.show()
133133

134134

135-
def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
135+
def gain_curve_plot_working(prediction, outcome, title="Gain curve plot"):
136136
"""plot cumulative outcome as a function of prediction order (descending)"""
137137
df = pandas.DataFrame({"prediction": prediction, "outcome": outcome})
138138

@@ -156,12 +156,6 @@ def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
156156
df["cumulative_outcome_by_wizard"]
157157
)
158158

159-
seaborn.lineplot(
160-
x="fraction_of_observations_by_prediction",
161-
y="cumulative_outcome_fraction",
162-
data=df,
163-
)
164-
165159
seaborn.lineplot(
166160
x="fraction_of_observations_by_wizard",
167161
y="cumulative_outcome_fraction_wizard",
@@ -170,7 +164,15 @@ def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
170164
data=df,
171165
)
172166

167+
seaborn.lineplot(
168+
x="fraction_of_observations_by_prediction",
169+
y="cumulative_outcome_fraction",
170+
data=df,
171+
)
172+
173173
seaborn.lineplot(x=[0, 1], y=[0, 1], color="red")
174+
matplotlib.pyplot.xlabel("fraction of observations by sort criterion")
175+
matplotlib.pyplot.ylabel("cumulative outcome fraction")
174176
matplotlib.pyplot.title(title)
175177
matplotlib.pyplot.show()
176178

-5.39 KB
Binary file not shown.

pkg/dist/wvpy-0.1.4.tar.gz

-4.47 KB
Binary file not shown.
5.42 KB
Binary file not shown.

pkg/dist/wvpy-0.1.5.tar.gz

4.5 KB
Binary file not shown.

pkg/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
setuptools.setup(name='wvpy',
10-
version='0.1.4',
10+
version='0.1.5',
1111
author='John Mount',
1212
author_email='[email protected]',
1313
url='https://github.com/WinVector/wvpy',

pkg/wvpy.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: wvpy
3-
Version: 0.1.4
3+
Version: 0.1.5
44
Summary: Simple utilities for teaching Pandas and scikit learn.
55
Home-page: https://github.com/WinVector/wvpy
66
Author: John Mount

pkg/wvpy/util.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def dual_hist_plot_proba1(probs, istrue):
132132
matplotlib.pyplot.show()
133133

134134

135-
def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
135+
def gain_curve_plot_working(prediction, outcome, title="Gain curve plot"):
136136
"""plot cumulative outcome as a function of prediction order (descending)"""
137137
df = pandas.DataFrame({"prediction": prediction, "outcome": outcome})
138138

@@ -156,12 +156,6 @@ def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
156156
df["cumulative_outcome_by_wizard"]
157157
)
158158

159-
seaborn.lineplot(
160-
x="fraction_of_observations_by_prediction",
161-
y="cumulative_outcome_fraction",
162-
data=df,
163-
)
164-
165159
seaborn.lineplot(
166160
x="fraction_of_observations_by_wizard",
167161
y="cumulative_outcome_fraction_wizard",
@@ -170,7 +164,15 @@ def gain_curve_plot(prediction, outcome, title="Gain curve plot"):
170164
data=df,
171165
)
172166

167+
seaborn.lineplot(
168+
x="fraction_of_observations_by_prediction",
169+
y="cumulative_outcome_fraction",
170+
data=df,
171+
)
172+
173173
seaborn.lineplot(x=[0, 1], y=[0, 1], color="red")
174+
matplotlib.pyplot.xlabel("fraction of observations by sort criterion")
175+
matplotlib.pyplot.ylabel("cumulative outcome fraction")
174176
matplotlib.pyplot.title(title)
175177
matplotlib.pyplot.show()
176178

0 commit comments

Comments
 (0)