- Machine Learning for OpenCV
- Michael Beyeler
- 101字
- 2021-07-02 19:47:26
Testing the classifier
Let's see for ourselves by calculating the accuracy score on the training set:
In [19]: ret, y_pred = lr.predict(X_train)
In [20]: metrics.accuracy_score(y_train, y_pred)
Out[20]: 1.0
Perfect score! However, this only means that the model was able to perfectly memorize the training dataset. This does not mean that the model would be able to classify a new, unseen data point. For this, we need to check the test dataset:
In [21]: ret, y_pred = lr.predict(X_test)
... metrics.accuracy_score(y_test, y_pred)
Out[21]: 1.0
Luckily, we get another perfect score! Now we can be sure that the model we built is truly awesome.
推薦閱讀
- Data Visualization with D3 4.x Cookbook(Second Edition)
- Getting Started with Citrix XenApp? 7.6
- Mastering Scientific Computing with R
- concrete5 Cookbook
- Visual Basic程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)(第二版)
- Mastering ArcGIS Enterprise Administration
- Swift 4從零到精通iOS開(kāi)發(fā)
- Java零基礎(chǔ)實(shí)戰(zhàn)
- 零基礎(chǔ)學(xué)C語(yǔ)言程序設(shè)計(jì)
- Tableau Desktop可視化高級(jí)應(yīng)用
- 遠(yuǎn)方:兩位持續(xù)創(chuàng)業(yè)者的點(diǎn)滴思考
- jQuery從入門(mén)到精通(微課精編版)
- Swift Essentials(Second Edition)
- Java Web 從入門(mén)到項(xiàng)目實(shí)踐(超值版)
- CorelDRAW X6中文版應(yīng)用教程(第二版)