Skip to content

Commit

Permalink
remove old qnns
Browse files Browse the repository at this point in the history
  • Loading branch information
adekusar-drl committed Sep 14, 2023
1 parent b332d36 commit aa497c8
Show file tree
Hide file tree
Showing 23 changed files with 158 additions and 3,874 deletions.
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
9 changes: 0 additions & 9 deletions qiskit_machine_learning/neural_networks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
:toctree: ../stubs/
:nosignatures:
OpflowQNN
TwoLayerQNN
CircuitQNN
EstimatorQNN
SamplerQNN
Expand All @@ -61,21 +58,15 @@
LocalEffectiveDimension
"""

from .circuit_qnn import CircuitQNN
from .effective_dimension import EffectiveDimension, LocalEffectiveDimension
from .estimator_qnn import EstimatorQNN
from .neural_network import NeuralNetwork
from .opflow_qnn import OpflowQNN
from .sampling_neural_network import SamplingNeuralNetwork
from .two_layer_qnn import TwoLayerQNN
from .sampler_qnn import SamplerQNN

__all__ = [
"NeuralNetwork",
"OpflowQNN",
"TwoLayerQNN",
"SamplingNeuralNetwork",
"CircuitQNN",
"EffectiveDimension",
"LocalEffectiveDimension",
"EstimatorQNN",
Expand Down
Loading

0 comments on commit aa497c8

Please sign in to comment.