- Learning Data Mining with Python(Second Edition)
- Robert Layton
- 97字
- 2021-07-02 23:40:07
Putting it all together
We can now create a workflow by combining the code from the previous sections, using the broken dataset previously calculated:
X_transformed = MinMaxScaler().fit_transform(X_broken)
estimator = KNeighborsClassifier()
transformed_scores = cross_val_score(estimator, X_transformed, y, scoring='accuracy')
print("The average accuracy for is {0:.1f}%".format(np.mean(transformed_scores) * 100))
We now recover our original score of 82.3 percent accuracy. The MinMaxScaler resulted in features of the same scale, meaning that no features overpowered others by simply being bigger values. While the Nearest Neighbor algorithm can be confused with larger features, some algorithms handle scale differences better. In contrast, some are much worse!
推薦閱讀
- GraphQL學習指南
- 微服務與事件驅動架構
- Learn to Create WordPress Themes by Building 5 Projects
- 算法訓練營:入門篇(全彩版)
- Responsive Web Design with HTML5 and CSS3
- Magento 2 Development Cookbook
- 程序是怎樣跑起來的(第3版)
- H5頁面設計:Mugeda版(微課版)
- Java程序設計
- Yii Project Blueprints
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- 響應式Web設計:HTML5和CSS3實戰(第2版)
- Fast Data Processing with Spark(Second Edition)
- Buildbox 2.x Game Development
- 區塊鏈國產化實踐指南:基于Fabric 2.0