决策函数中特征的系数。随机森林
Coefficient of the features in the decision function. random forest
我怎样才能得到 RandomForest()
中的特征系数,例如逻辑回归中的 model.coef_。?
model = GridSearchCV(estimator=classifier, param_grid=grid_param,
scoring='roc_auc',
cv=5,
n_jobs=-1)
best_model= model.fit(X_train, y_train)
best_model.feature_importances_
不清楚您使用的是哪个框架,或者即使您使用的是框架...
但是,如果您使用的是 sklearn,则可以使用 model.feature_importances_
访问特征重要性。
Random forest
是decision trees
的集合,不是线性模型。 Sklearn 提供了用于训练随机森林分类器或回归器的各个特征的重要性。它可以按如下方式访问,returns 一个总和为 1 的小数数组。
model.feature_importances_
如果你想在特征名称的组合中看到这个,那么你可以使用 zip(<feature names>, model.feature_importances_)
,并将其转换为 list
。
我怎样才能得到 RandomForest()
中的特征系数,例如逻辑回归中的 model.coef_。?
model = GridSearchCV(estimator=classifier, param_grid=grid_param,
scoring='roc_auc',
cv=5,
n_jobs=-1)
best_model= model.fit(X_train, y_train)
best_model.feature_importances_
不清楚您使用的是哪个框架,或者即使您使用的是框架...
但是,如果您使用的是 sklearn,则可以使用 model.feature_importances_
访问特征重要性。
Random forest
是decision trees
的集合,不是线性模型。 Sklearn 提供了用于训练随机森林分类器或回归器的各个特征的重要性。它可以按如下方式访问,returns 一个总和为 1 的小数数组。
model.feature_importances_
如果你想在特征名称的组合中看到这个,那么你可以使用 zip(<feature names>, model.feature_importances_)
,并将其转换为 list
。