Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python scikit学习MNIST的线性回归内存溢出_Python_Tensorflow_Machine Learning_Scikit Learn_Mnist - Fatal编程技术网

Python scikit学习MNIST的线性回归内存溢出

Python scikit学习MNIST的线性回归内存溢出,python,tensorflow,machine-learning,scikit-learn,mnist,Python,Tensorflow,Machine Learning,Scikit Learn,Mnist,我正在尝试使用scikit学习模块对MNIST数据进行基本线性回归。它似乎和MemoryError一起崩溃了。我做错了什么?训练数据集的形状是(60000728) 问题在于sklearn旧版本的sklearn的实现存在此问题,旧版本在资源管理方面存在问题。尝试升级sklearn 另一个可行的选择是在或中运行此代码。您发布的代码在Google Colab中运行正常。您(实际上不是)报告的错误无法复制。@谢谢您的签出!可能我的笔记本电脑变旧了。。。 import numpy as np from t

我正在尝试使用scikit学习模块对MNIST数据进行基本线性回归。它似乎和MemoryError一起崩溃了。我做错了什么?训练数据集的形状是(60000728)


问题在于
sklearn
旧版本的sklearn的实现存在此问题,旧版本在资源管理方面存在问题。尝试升级
sklearn


另一个可行的选择是在或中运行此代码。

您发布的代码在Google Colab中运行正常。您(实际上不是)报告的错误无法复制。@谢谢您的签出!可能我的笔记本电脑变旧了。。。
import numpy as np
from tensorflow.keras.datasets import mnist
from sklearn import linear_model

(xTrain, yTrain), (xTest, yTest) = mnist.load_data()

xTrain2D = xTrain.reshape((len(xTrain), -1))
xTest2D = xTest.reshape((len(xTest), -1))

reg = linear_model.LinearRegression()
reg.fit(xTrain2D, yTrain)