我正在尝试拟合随机森林模型。如果我不使用 criterion 参数,则会编译代码。但是,使用它会返回以下错误。
条件= 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)
有人可以帮忙吗?
答案 0 :(得分:0)
您正在使用RandomForestRegressor
,这就是为什么它仅接受 mae 和 mse 的原因。
而是使用RandomForestClassifier
:
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier(n_estimators=100,criterion="entropy",max_features='log2',bootstrap=False,random_state=1)