Getting this memory error. But the book/link I am following doesn't get this error.
A part of Code:
from sklearn.linear_model import SGDClassifier
sgd_clf = SGDClassifier()
sgd_clf.fit(x_train, y_train)
Error:
MemoryError: Unable to allocate 359. MiB for an array with shape (60000, 784) and data type float64
I also get this error when I try to scale the data using StandardScaler's fit_transfrom
But works fine in both if I decrease the size of training set (something like : x_train[:1000]
,y_train[:1000]
)
Link for the code in the book here. The error I get is in Line 60 and 63 (In [60]
and In [63]
)
The book : Aurélien Géron - Hands-On Machine Learning with Scikit-Learn Keras and Tensorflow 2nd Ed (Page : 149 / 1130)
So here's my question :
Does this has anything to do with my ram? and what does "Unable to allocate 359" mean? is it the memory size ?
Just in case my specs : CPU - ryzen 2400g , ram - 8gb (3.1gb is free when using jupyter notebook)