Skip to content

Commit 1aab180

Browse files
committed
2 parents 22aecd7 + 0fa2e3d commit 1aab180

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎ch05/log_reg_example.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#
66
# It is made available under the MIT License
77

8+
import os
9+
from data import CHART_DIR
10+
811
import numpy as np
912
from scipy.stats import norm
1013

@@ -35,7 +38,7 @@ def lr_model(clf, X):
3538
pyplot.xlabel("feature value")
3639
pyplot.ylabel("class")
3740
pyplot.grid(True, linestyle='-', color='0.75')
38-
pyplot.savefig("log_reg_example_data.png", bbox_inches="tight")
41+
pyplot.savefig(os.path.join(CHART_DIR, "log_reg_example_data.png"), bbox_inches="tight")
3942

4043

4144
def lin_model(clf, X):
@@ -66,7 +69,7 @@ def lin_model(clf, X):
6669
pyplot.ylabel("class")
6770
pyplot.title("linear fit on additional data")
6871
pyplot.grid(True, linestyle='-', color='0.75')
69-
pyplot.savefig("log_reg_log_linear_fit.png", bbox_inches="tight")
72+
pyplot.savefig(os.path.join(CHART_DIR, "log_reg_log_linear_fit.png"), bbox_inches="tight")
7073

7174
pyplot.figure(figsize=(10, 4))
7275
pyplot.xlim((-5, 20))
@@ -76,7 +79,7 @@ def lin_model(clf, X):
7679
pyplot.xlabel("feature value")
7780
pyplot.ylabel("class")
7881
pyplot.grid(True, linestyle='-', color='0.75')
79-
pyplot.savefig("log_reg_example_fitted.png", bbox_inches="tight")
82+
pyplot.savefig(os.path.join(CHART_DIR, "log_reg_example_fitted.png"), bbox_inches="tight")
8083

8184
X = np.arange(0, 1, 0.001)
8285
pyplot.figure(figsize=(10, 4))
@@ -94,4 +97,4 @@ def lin_model(clf, X):
9497
pyplot.xlabel("P")
9598
pyplot.ylabel("log(odds) = log(P / (1-P))")
9699
pyplot.grid(True, linestyle='-', color='0.75')
97-
pyplot.savefig("log_reg_log_odds.png", bbox_inches="tight")
100+
pyplot.savefig(os.path.join(CHART_DIR, "log_reg_log_odds.png"), bbox_inches="tight")

‎ch06/install.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
import twitter
4242
except ImportError:
4343
print("""\
44-
You need to install python-twitter.
45-
On Linux:
46-
sudo pip install python-twitter
47-
On Windows:
48-
Follow instructions at http://code.google.com/p/python-twitter/ """)
44+
You need to install python-twitter:
45+
pip install python-twitter
46+
If pip is not found you might have to install it using easy_install.
47+
If it does not work on your system, you might want to follow instructions
48+
at http://code.google.com/p/python-twitter/ """)
4949

5050
sys.exit(1)
5151

0 commit comments

Comments
 (0)