- 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 RabbitMQ
- Python程序設計(第3版)
- Java程序員面試算法寶典
- 云原生Spring實戰
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- PhoneGap:Beginner's Guide(Third Edition)
- Learning Laravel's Eloquent
- Unity Character Animation with Mecanim
- OpenCV with Python Blueprints
- Kotlin進階實戰
- Python預測之美:數據分析與算法實戰(雙色)
- INSTANT JQuery Flot Visual Data Analysis
- 分布式數據庫HBase案例教程
- Microsoft Windows Identity Foundation Cookbook