Closed rupof closed 4 months ago
Composing (+) two encoding circuits and using them in GridSearchCV, returns an error.
See minimal example below:
from sklearn.datasets import make_moons from sklearn.model_selection import train_test_split from squlearn.kernel import ProjectedQuantumKernel, QSVC from squlearn.util import Executor from sklearn.model_selection import GridSearchCV from squlearn.encoding_circuit import ( HighDimEncodingCircuit) X, y = make_moons( n_samples=100, random_state=0) X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=0) X_train = X_train[:,0] X_test = X_test[:,0] layered_ec = HighDimEncodingCircuit(num_qubits=1,num_features=1) + HighDimEncodingCircuit(num_qubits=1,num_features=1) pqk = ProjectedQuantumKernel( encoding_circuit=layered_ec, executor=Executor("pennylane", shots=5000)) qsvc = QSVC(quantum_kernel=pqk) param_grid = {"num_qubits": [1,2],} grid_search = GridSearchCV(qsvc, param_grid, cv=5) grid_search.fit(X_train, y_train)
Composing (+) two encoding circuits and using them in GridSearchCV, returns an error.
See minimal example below: