- 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.
推薦閱讀
- Learning Microsoft Windows Server 2012 Dynamic Access Control
- Web應用系統開發實踐(C#)
- Python爬蟲開發與項目實戰
- Learning SQLite for iOS
- 區塊鏈:以太坊DApp開發實戰
- KnockoutJS Starter
- Node.js:來一打 C++ 擴展
- 現代C++編程實戰:132個核心技巧示例(原書第2版)
- Python網絡爬蟲實例教程(視頻講解版)
- 實戰Python網絡爬蟲
- Java RESTful Web Service實戰
- Java程序設計入門(第2版)
- PyTorch生成對抗網絡編程
- JSP大學實用教程
- Python程序設計