官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 呼图壁县| 浦城县| 伽师县| 广宗县| 丹寨县| 合江县| 保定市| 登封市| 汶川县| 龙岩市| 思南县| 威海市| 读书| 金湖县| 大方县| 凤庆县| 顺义区| 平谷区| 喀什市| 凉城县| 桂阳县| 阳山县| 镶黄旗| 阳高县| 张家口市| 溧水县| 浠水县| 无棣县| 石台县| 秦皇岛市| 晋城| 镇江市| 科尔| 崇州市| 岳阳市| 葫芦岛市| 石景山区| 盐津县| 四川省| 天镇县| 庆云县|