- 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.
推薦閱讀
- Spring 5.0 Microservices(Second Edition)
- WildFly:New Features
- Redis Applied Design Patterns
- JavaScript 網頁編程從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Learning Informatica PowerCenter 10.x(Second Edition)
- Building a Quadcopter with Arduino
- Getting Started with NativeScript
- 組態軟件技術與應用
- 低代碼平臺開發實踐:基于React
- Elasticsearch Essentials
- INSTANT Premium Drupal Themes
- XML程序設計(第二版)
- Learning WordPress REST API
- 青少年Python趣味編程
- Java EE框架開發技術與案例教程