compiler-errors - 将参数传递给RandomForest时出错

标签 compiler-errors random-forest

我正在尝试拟合随机森林模型。如果我不使用条件参数,则代码会编译。但是,使用它会返回以下错误。

条件= CRITERIA_REG [self.criterion](self.n_outputs_,
KeyError:“熵”

我的尝试是这样的:

from sklearn.ensemble import RandomForestRegressor
clf = RandomForestRegressor(n_estimators=100,criterion="entropy",max_features='log2',bootstrap=False,random_state=1)

有人可以帮忙吗?

最佳答案

您正在使用RandomForestRegressor,这就是为什么它仅接受mae和mse的原因。
相反,请使用RandomForestClassifier:

from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier(n_estimators=100,criterion="entropy",max_features='log2',bootstrap=False,random_state=1)

关于compiler-errors - 将参数传递给RandomForest时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60696849/

相关文章:

java - .read ERROR : cannot find symbol symbol: method read(bufferedreader, <null>) 位置: jbutton 类型的变量 jtext1

android - android-ndk-r6-crystax-2错误: 'string' in namespace 'std' does not name a type

asp.net - 调试中的.net 4 Web表单页面在本地中断

machine-learning - 随机森林和预测建模的数据准备

machine-learning - python中如何提取随机森林的决策规则

compiler-errors - 使用MinGW使Allegro5在Win7上构建(无法编译TTF)

objective-c - 在 NSArray 上使用下标时编译器错误 "expected method not found"

python - 如何计算 K 折交叉验证的不平衡数据集的精度、召回率和 f1 分数?

r - 直接从 R 实现自定义停止指标以在 H2O 模型训练期间进行优化

python - 为什么 Weka RandomForest 给我的结果与 Scikit RandomForestClassifier 不同?