Skip to content

Commit fd1f493

Browse files
committed
adjustments for upcoming revision
1 parent 057762f commit fd1f493

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

code/ch09/1st_flask_app_2/templates/_formhelpers.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
</ul>
1010
{% endif %}
1111
</dd>
12-
{% endmacro %}
12+
</dt>
13+
{% endmacro %}

code/ch09/ch09.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
"example = ['I love this movie']\n",
501501
"X = vect.transform(example)\n",
502502
"print('Prediction: %s\\nProbability: %.2f%%' %\\\n",
503-
" (label[clf.predict(X)[0]], np.max(clf.predict_proba(X))*100))"
503+
" (label[clf.predict(X)[0]], clf.predict_proba(X).max()*100))"
504504
]
505505
},
506506
{

code/ch09/movieclassifier/static/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ body{
22
width:600px;
33
}
44

5-
#button{
5+
.button{
66
padding-top: 20px;
7-
}
7+
}

code/ch09/movieclassifier_with_update/static/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ body{
22
width:600px;
33
}
44

5-
#button{
5+
.button{
66
padding-top: 20px;
7-
}
7+
}

code/ch09/movieclassifier_with_update/update.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ def update_model(db_path, model, batch_size=10000):
2020

2121
classes = np.array([0, 1])
2222
X_train = vect.transform(X)
23-
clf.partial_fit(X_train, y, classes=classes)
23+
model.partial_fit(X_train, y, classes=classes)
2424
results = c.fetchmany(batch_size)
2525

2626
conn.close()
27-
return None
27+
return model
2828

2929
cur_dir = os.path.dirname(__file__)
3030

3131
clf = pickle.load(open(os.path.join(cur_dir,
32-
'pkl_objects',
33-
'classifier.pkl'), 'rb'))
32+
'pkl_objects',
33+
'classifier.pkl'), 'rb'))
3434
db = os.path.join(cur_dir, 'reviews.sqlite')
3535

36-
update_model(db_path=db, model=clf, batch_size=10000)
36+
clf = update_model(db_path=db, model=clf, batch_size=10000)
3737

3838
# Uncomment the following lines if you are sure that
3939
# you want to update your classifier.pkl file

0 commit comments

Comments
 (0)