

You can simply pass it in, I illustrate below with an example dataset: dataset = pd.DataFrame(np.random.choice(,(50,13)),Ĭolumns=)ĭataset = np.random.uniform(0,1,50)įrom pose import ColumnTransformerįrom sklearn.preprocessing import OneHotEncoderĬt = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), You can either convert it to dense using: ct.fit_transform(X).todense()īut this can be really costly on the memory and unnecessary since the regressor can take a sparse matrix. You have this error because your data is not formatted correctly when you call the fit method. The shape of my input x is (7165 x 529) and due to reshaping errors, I added an extra column with zeroes to make it (7165 x 530) and shape of y is (7165. I am trying to implement Quantum Kernel Ridge Regression (replacing the classical kernel with quantum kernel) in qiskit. sklearn model.fit 'setting an array element with a sequence.' score:1. From one hot you get a sparse matrix (type csr) and you don't need to put it inside a numpy array again. ValueError: setting an array element with a sequence for scikit learn.

Set arr equal to np.array applied to the specified list.

Your error comes from this np.array(ct.fit_transform(X)). nan as the first element, and the integers from 2 to 5, inclusive, as the next four elements.
