設計思路
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5yM5UWNwIGMmRWZ4UWN1YWYjFjM0UmMkRTNzUGZjZTN28CX5d2bs92Yl1iclB3bsVmdlR2LcNWaw9CXt92Yu4GZjlGbh5yYjV3Lc9CX6MHc0RHaiojIsJye.png)
輸出結果
實作代碼
F:\Program Files\Python\Python36\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The 'normed' kwarg is deprecated, and has been replaced by the 'density' kwarg.
warnings.warn("The 'normed' kwarg is deprecated, and has been "
0 284315
1 492
Name: Class, dtype: int64
Default 方法
Undersampling RandomUnderSampler 方法
F:\Program Files\Python\Python36\lib\site-packages\imblearn\under_sampling\_prototype_selection\_nearmiss.py:178: UserWarning: The number of the samples to be selected is larger than the number of samples available. The balancing ratio cannot be ensure and all samples will be returned.
"The number of the samples to be selected is larger"
Undersampling NearMissV1 方法
F:\Program Files\Python\Python36\lib\site-packages\sklearn\svm\_base.py:977: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations.
"the number of iterations.", ConvergenceWarning)
Undersampling NearMissV2 方法
Undersampling NearMissV3 方法
Undersampling ClusterCentroids 方法
Undersampling TomekLinks 方法
Undersampling EditedNearestNeighbours 方法
資料清洗後大類樣本數量
Original: 227451
After Tomek Link: 227429
After ENN: 227326
Oversampling RandomOverSampler 方法
Oversampling SMOTE 方法
Oversampling ADASYN 方法