ML之LoRDTRF:基于LoRDT(CART)RF算法对mushrooms蘑菇数据集(22+1,6513+1611)训练来预测蘑菇是否毒性(二分类预测)
生活随笔
收集整理的這篇文章主要介紹了
ML之LoRDTRF:基于LoRDT(CART)RF算法对mushrooms蘑菇数据集(22+1,6513+1611)训练来预测蘑菇是否毒性(二分类预测)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ML之LoR&DT&RF:基于LoR&DT(CART)&RF算法對mushrooms蘑菇數據集(22+1,6513+1611)訓練來預測蘑菇是否毒性(二分類預測)
?
?
目錄
輸出結果
設計思路
核心代碼
?
?
?
輸出結果
0、數據集
after LabelEncoder
?
1、LoR算法
2、DT算法
?
?
3、RF算法
?
RFC_model_GSCV grid_scores_: [mean: 0.99938, std: 0.00075, params: {'max_features': 'auto', 'min_samples_leaf': 10, 'n_estimators': 10}, mean: 0.99954, std: 0.00070, params: {'max_features': 'auto', 'min_samples_leaf': 10, 'n_estimators': 20},…… mean: 0.97784, std: 0.01071, params: {'max_features': 'log2', 'min_samples_leaf': 80, 'n_estimators': 20}, mean: 0.98215, std: 0.00703, params: {'max_features': 'log2', 'min_samples_leaf': 80, 'n_estimators': 30}, mean: 0.98169, std: 0.00550, params: {'max_features': 'log2', 'min_samples_leaf': 90, 'n_estimators': 80}, mean: 0.98169, std: 0.00801, params: {'max_features': 'log2', 'min_samples_leaf': 90, 'n_estimators': 90}] RFC_model_GSCV best_score_: 0.9998461301738729 RFC_model_GSCV best_params_: {'max_features': 'auto', 'min_samples_leaf': 10, 'n_estimators': 50} RFC_model_GSCV_auc_roc: 1.0?
設計思路
后期更新……
?
?
核心代碼
后期更新……
RF tuned_parameters = {'min_samples_leaf': range(10,100,10), 'n_estimators' : range(10,100,10),'max_features': ['auto','sqrt','log2'] }RFC_model_GSCV = GridSearchCV(RFC_model, tuned_parameters,cv=10) RFC_model_GSCV.fit(X_train,y_train) endtime = time.clock() print ('RFC_model_GSCV Training time:',endtime - starttime) print('RFC_model_GSCV grid_scores_:', RFC_model_GSCV.grid_scores_) print('RFC_model_GSCV best_score_:', RFC_model_GSCV.best_score_) print('RFC_model_GSCV best_params_:', RFC_model_GSCV.best_params_)y_prob = RFC_model_GSCV.predict_proba(X_test)[:,1] y_pred = np.where(y_prob > 0.5, 1, 0) RFC_model_GSCV.score(X_test, y_pred)?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的ML之LoRDTRF:基于LoRDT(CART)RF算法对mushrooms蘑菇数据集(22+1,6513+1611)训练来预测蘑菇是否毒性(二分类预测)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: AI公开课:19.05.29 浣军-百度
- 下一篇: ML之xgboost:利用xgboost