【发布时间】:2019-11-30 11:50:33
【问题描述】:
我遇到了这个失败:
文件“C:\Users\ophirbh\AppData\Roaming\Python\Python38\site-packages\scipy\special_logsumexp.py”,第 112 行,在 logsumexp tmp = np.exp(a - a_max) MemoryError: Unable to allocate array with shape (950028, 45) and data type float64
对于该代码:
from sklearn import datasets
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
X, y = datasets.load_svmlight_file('converted_features')
clf = LogisticRegression(random_state = 0, solver = 'lbfgs', multi_class =
'multinomial',max_iter=2).fit(X,y)
print(cross_val_score(clf, X, y, scoring='recall_macro', cv = 5))
有什么办法吗?
【问题讨论】:
标签: python-3.x machine-learning nlp