- 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!
推薦閱讀
- 區塊鏈架構與實現:Cosmos詳解
- Java游戲服務器架構實戰
- Hadoop+Spark大數據分析實戰
- Oracle Exadata專家手冊
- 從0到1:Python數據分析
- RISC-V體系結構編程與實踐(第2版)
- 數據結構習題解析與實驗指導
- Visual Studio Code 權威指南
- Machine Learning for Developers
- ASP.NET 4.0 Web程序設計
- 數據科學中的實用統計學(第2版)
- Using Yocto Project with BeagleBone Black
- Software Architecture with Python
- Enterprise Application Architecture with .NET Core
- 多接入邊緣計算實戰