原书出处
Natural Language Processing in Action, Second Edition
>>> nb = nb.fit(df_movies, movies.sentiment > 0) #1 >>> movies['pred_senti'] = ( ... nb.predict_proba(df_movies))[:, 1] * 8 - 4 #2 >>> movies['error'] = movies.pred_senti - movies.sentiment >>> mae = movies['error'].abs().mean().round(1) #3 >>> mae 1.9 #1 Naive Bayes models are classifiers, so you need to convert your output variable (sentiment float) to a discrete label (integer, string, or bool). #2 Converts your discrete classification variable back
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-2.html
EPUB SHA-256:0e9a35e49ca446e322e5524e53f39fb6bee5b2b23d9cda10ef052aca770b0b36