成功解决ValueError: min_samples_split must be an integer greater than 1 or a float in (0.0, 1.0]; got th

成功解决ValueError: min_samples_split must be an integer greater than 1 or a float in (0.0, 1.0]; got th


解决问题

ValueError: min_samples_split must be an integer greater than 1 or a float in (0.0, 1.0]; got the integer 1

解决思路

值错误:Min_samples_split必须是大于1的整数或浮点(0.0,1.0);得到整数1

解决方法

min_samples_split 参数的赋值不符合规范,需要调整!修改如下!

clf=RandomForestClassifier(n_estimators=500, criterion='entropy', max_depth=5, min_samples_split=1,
  min_samples_leaf=1, max_features='auto',    bootstrap=False, oob_score=False, n_jobs=1, random_state=seed,
  verbose=0)

改为

clf=RandomForestClassifier(n_estimators=500, criterion='entropy', max_depth=5, min_samples_split=2,
  min_samples_leaf=1, max_features='auto',    bootstrap=False, oob_score=False, n_jobs=1, random_state=seed,
  verbose=0)

大功告成!哈哈!

(0)

相关推荐