sQUlearn / squlearn

scikit-learn interface for quantum algorithms
https://squlearn.github.io
Apache License 2.0
57 stars 18 forks source link

PQK's outer_kernel parameter causes ValueError in sklearn routines #186

Closed FredericRapp closed 11 months ago

FredericRapp commented 11 months ago

E.g. when performing GridSearchCV, the outerkernel parameter is not accessed by the get / set_params of the high-level methods:

projected_kernel = ProjectedQuantumKernel(
    encoding_circuit=encoding_circuit, executor=executor, parameter_seed=0
)
qkrr = QKRR(quantum_kernel=projected_kernel)
param_grid = {
        "outer_kernel": ["Gaussian", "DotProduct"],
        "num_qubits": [2, 3, 4],
        "num_layers": [1, 2, 3],
        "alpha": [0.01, 0.1, 1.0]
}
grid_search = GridSearchCV(qkrr, param_grid, cv=5, n_jobs=-1, verbose=1)

grid_search.fit(X, y)

This example leads to:


ValueError: Invalid parameter 'outer_kernel'. Valid parameters are ['alpha', ...
David-Kreplin commented 11 months ago

Is fixed, PR will come soon.

David-Kreplin commented 11 months ago

Fixed by PR #192