If I run this code, I get a memory error. Does anyone know what I can improve?
Code:
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.gaussian_process import GaussianProcessClassifier from sklearn.gaussian_process.kernels import RBF import cv2 input = "testProbe.jpg" # load the image, convert it to grayscale image = cv2.imread(input) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # threshold the image to reveal light regions in the gray image thresh = cv2.threshold(gray, 145, 200, cv2.THRESH_BINARY)[1] # import data X = np.where(thresh>0) xx = np.array(X) xx = np.ravel(xx,order='F') zz = xx.reshape((int(len(xx)/2),2)) y = np.asarray(np.zeros((widthX, 1), dtype=int)) Here I edit y to play with the data and get a second dataset.
y[1:5] = 1 And when I run this code, the error appears:
gpc_rbf_isotropic = GaussianProcessClassifier().fit(zz, y)