I am building SVM model for MNIST Digit recognition in Amazon Sagemaker and I am getting below error.
MemoryError: Unable to allocate 201. MiB for an array with shape (33600, 784) and data type float64
Below is my code:-
# creating a KFold object with 5 splits
folds = KFold(n_splits = 5, shuffle = True, random_state = 101)
# specify range of hyperparameters
# Set the parameters by cross-validation
hyper_params = [ {'gamma': [1e-1, 1e-2, 1e-3, 1e-4],
'C': [1e-3, 1e-2, 1e-1, 1, 10, 100]}]
# specify modelb
model = SVC(kernel="rbf")
# set up GridSearchCV()
model_cv = GridSearchCV(estimator = model,
param_grid = hyper_params,
scoring= 'accuracy',
cv = folds,
verbose = 1,
return_train_score=True)
# fit the model
model_cv.fit(normalized_X_train, y_train)
print("The best parameters are %s with a score of %0.2f"
% (model_cv.best_params_, model_cv.best_score_))