如何解决随机森林的准确率非常低
我有一些包含测试难度分数和一些功能的数据。示例(数字是随机的,我的真实数据大约有 800 行和 8 列):
question time_needed media_existent frequency_changed_answers score
abc 3545 0 1.25 0.79
dff 3574 0 2.80 0.03
xyz 1123 0 4.50 0.60
mno 7000 1 3.77 1.00
pqr 4656 0 1.00 0.99
stv 4367 0 2.73 0.33
分数在 0 到 1 之间。越接近 1,问题越简单。更改答案的频率是提交前更改答案的次数(学生未定)除以回答问题的次数(有些问题更受欢迎)。
就像在 this 示例中一样,我应用了 3 种方法(随机森林、排列、SHAP)来确定哪些特征是最重要的。他们三个都认为这个频率最重要,然后是时间,然后是测试是否包含媒体。
对于随机森林:
list_of_columns = ['time_needed','media_existent','frequency_changed_answers']
X = df_random_forest[list_of_columns]
target_column = 'score'
y = df_random_forest[target_column]
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.25,random_state=12)
rf = RandomForestRegressor(n_estimators=100)
rf.fit(X_train,y_train)
rf.feature_importances_
但是下面的分数只是0.2932189613132453
rf.score(X_test,y_test)
还有:
scores = cross_val_score(rf,X,cv=5)
print("%0.2f accuracy with a standard deviation of %0.2f" % (scores.mean(),scores.std()))
>>0.25 accuracy with a standard deviation of 0.05.
会有什么问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。