- 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.
推薦閱讀
- Mastering Entity Framework Core 2.0
- Git Version Control Cookbook
- C語言程序設計(第2 版)
- Building a Game with Unity and Blender
- 深入淺出Java虛擬機:JVM原理與實戰
- 跟小海龜學Python
- Blender 3D Incredible Machines
- Python機器學習實戰
- 零基礎學Python數據分析(升級版)
- C語言程序設計
- ASP.NET開發與應用教程
- Principles of Strategic Data Science
- GitHub入門與實踐
- Android應用開發實戰(第2版)
- Python Machine Learning Cookbook