Skip to content

Commit

Permalink
Remove deprecated code (#690)
Browse files Browse the repository at this point in the history
* remove old qnns

* remove old kernel

* remove warning filtration

* fix tests

* fix style

* replace migration notebook with rst

* update reno

* skip statevector test on macos

* remove sampling neural network

* remove deprecations

* new tests

* new tests

* fix stestr

* replace bind_parameters with assign_parameters

* remove stestr fix
  • Loading branch information
adekusar-drl authored Sep 18, 2023
1 parent e19781e commit de3fa6c
Show file tree
Hide file tree
Showing 53 changed files with 953 additions and 7,968 deletions.
1 change: 1 addition & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
numpy>=1.20.0
ipython<8.13;python_version<'3.9'

885 changes: 0 additions & 885 deletions docs/migration/01_migration_guide_0.5.ipynb

This file was deleted.

704 changes: 704 additions & 0 deletions docs/migration/01_migration_guide_0.5.rst

Large diffs are not rendered by default.

Binary file added docs/migration/aux_files/quantum_kernel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions qiskit_machine_learning/algorithms/classifiers/vqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from qiskit.algorithms.optimizers import Optimizer, OptimizerResult, Minimizer
from qiskit.primitives import BaseSampler

from ...neural_networks import CircuitQNN, SamplerQNN
from ...neural_networks import SamplerQNN
from ...utils import derive_num_qubits_feature_map_ansatz
from ...utils.loss_functions import Loss

Expand Down Expand Up @@ -158,7 +158,7 @@ def _fit_internal(self, X: np.ndarray, y: np.ndarray) -> OptimizerResult:
num_classes = self._num_classes

# instance check required by mypy (alternative to cast)
if isinstance(self._neural_network, (CircuitQNN, SamplerQNN)):
if isinstance(self._neural_network, SamplerQNN):
self._neural_network.set_interpret(self._get_interpret(num_classes), num_classes)

function = self._create_objective(X, y)
Expand Down
7 changes: 3 additions & 4 deletions qiskit_machine_learning/algorithms/regressors/vqr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import numpy as np
from qiskit import QuantumCircuit
from qiskit.algorithms.optimizers import Optimizer, Minimizer
from qiskit.opflow import PauliSumOp
from qiskit.primitives import BaseEstimator
from qiskit.quantum_info.operators.base_operator import BaseOperator

Expand All @@ -35,7 +34,7 @@ def __init__(
num_qubits: int | None = None,
feature_map: QuantumCircuit | None = None,
ansatz: QuantumCircuit | None = None,
observable: BaseOperator | PauliSumOp | None = None,
observable: BaseOperator | None = None,
loss: str | Loss = "squared_error",
optimizer: Optimizer | Minimizer | None = None,
warm_start: bool = False,
Expand Down Expand Up @@ -81,10 +80,10 @@ def __init__(
can't be adjusted to ``num_qubits``.
ValueError: if the type of the observable is not compatible with ``estimator``.
"""
if observable is not None and not isinstance(observable, (BaseOperator, PauliSumOp)):
if observable is not None and not isinstance(observable, BaseOperator):
raise ValueError(
f"Unsupported type of the observable, expected "
f"'BaseOperator | PauliSumOp', got {type(observable)}"
f"'BaseOperator', got {type(observable)}"
)

self._estimator = estimator
Expand Down
Loading

0 comments on commit de3fa6c

Please sign in to comment.