我有一个具有 spotify 数据功能的数据框 df 。当我使用 RandomForestClassifier 运行模型时,我得到了重要的特征图,但是当我运行 RandomForestRegressor 时,我只得到一个反对流行度的栏。有人可以帮忙吗?
from yellowbrick.model_selection import FeatureImportances
# Load the classification data set
X = df[features]
y = df.popularity
train_X, test_X, train_y, test_y = train_test_split(X,y, test_size= 0.1, random_state=38)
model = RandomForestClassifier(n_estimators=10)
# model = RandomForestRegressor(n_estimators=10)
viz = FeatureImportances(model)
viz.fit(X, y)
viz.show()