Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.aqua.components.neural_networks.DiscriminativeNetwork

class DiscriminativeNetwork

GitHub

Base class for discriminative Quantum or Classical Neural Networks.

This method should initialize the module but raise an exception if a required component of the module is not available.

__init__

abstract __init__()

Initialize self. See help(type(self)) for accurate signature.


Methods

__init__()Initialize self.
get_label(x)Apply quantum/classical neural network to the given input sample and compute the respective data label
loss(x, y[, weights])Loss function used for optimization
set_seed(seed)Set seed.
train(data, weights[, penalty, …])Perform one training step w.r.t to the discriminator’s parameters

get_label

abstract get_label(x)

Apply quantum/classical neural network to the given input sample and compute the respective data label

Parameters

x (Discriminator) – input, i.e. data sample.

Raises

NotImplementedError – not implemented

loss

abstract loss(x, y, weights=None)

Loss function used for optimization

Parameters

  • x (Discriminator) – output.
  • y (Label) – the data point
  • weights (numpy.ndarray) – Data weights.

Returns

Loss w.r.t to the generated data points.

Raises

NotImplementedError – not implemented

set_seed

abstract set_seed(seed)

Set seed.

Parameters

seed (int) – seed

Raises

NotImplementedError – not implemented

train

abstract train(data, weights, penalty=False, quantum_instance=None, shots=None)

Perform one training step w.r.t to the discriminator’s parameters

Parameters

  • data (numpy.ndarray) – Data batch.
  • weights (numpy.ndarray) – Data sample weights.
  • penalty (bool) – Indicate whether or not penalty function is applied to the loss function. Ignored if no penalty function defined.
  • quantum_instance (QuantumInstance) – used to run Quantum network. Ignored for a classical network.
  • shots (int) – Number of shots for hardware or qasm execution. Ignored for classical network

Returns

with Discriminator loss and updated parameters.

Return type

dict

Raises

NotImplementedError – not implemented

Was this page helpful?
Report a bug or request content on GitHub.