【发布时间】:2017-12-10 15:11:25
【问题描述】:
我正在尝试做一些机器学习。我正在尝试预测一篇文章的参与时间。我的X 数据集如下:
_text_word_length _title_char_length _title_word_length _text_char_length
0 1306 53 7 8056
1 1075 62 11 6127
而我的目标 Y 值只是代表参与时间的浮点数。
我使用 SciKit-Learn 如下:
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import cross_val_score, KFold
import numpy as np
clf = RandomForestRegressor(n_jobs=-1, n_estimators=250, max_features = 0.8, verbose = 2)
score = cross_val_score(estimator = clf, X = X1, y = Y1, cv = KFold(n_splits = 5, random_state = 100), n_jobs = -1, \
scoring = "neg_mean_squared_error")
np.mean([np.sqrt(-x) for x in score])
因为我使用的是详细模式,所以它会输出随机森林的所有树。它几乎穿过了所有的树,然后我得到了这个:
JoblibException: JoblibException
___________________________________________________________________________
Multiprocessing exception:
然后有大量的文字(不会在这里复制,但可以根据要求)。最后,我看到了:
ValueError: I/O operation on closed file
我完全迷失了,因为昨天运行的代码非常相似,所以我不确定我做错了什么。
有什么想法吗?
谢谢!
【问题讨论】:
标签: python machine-learning scikit-learn