German
Sprachen
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.aqua.components.neural_networks.NumPyDiscriminator

class NumPyDiscriminator(n_features=1, n_out=1)[Quellcode]

Discriminator based on NumPy

Parameter
  • n_features (int) – Dimension of input data vector.

  • n_out (int) – Dimension of the discriminator’s output vector.

__init__(n_features=1, n_out=1)[Quellcode]
Parameter
  • n_features (int) – Dimension of input data vector.

  • n_out (int) – Dimension of the discriminator’s output vector.

Methods

__init__([n_features, n_out])

type n_features

int

get_label(x[, detach])

Get data sample labels, i.e. true or fake.

load_model(load_dir)

Load discriminator model

loss(x, y[, weights])

Loss function :param x: sample label (equivalent to discriminator output) :type x: numpy.ndarray :param y: target label :type y: numpy.ndarray :param weights: customized scaling for each sample (optional) :type weights: numpy.ndarray

save_model(snapshot_dir)

Save discriminator model

set_seed(seed)

Set seed.

train(data, weights[, penalty, …])

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

Attributes

discriminator_net

Get discriminator

property discriminator_net

Get discriminator

Rückgabe

discriminator object

Rückgabetyp

DiscriminatorNet

get_label(x, detach=False)[Quellcode]

Get data sample labels, i.e. true or fake.

Parameter
  • x (numpy.ndarray) – Discriminator input, i.e. data sample.

  • detach (bool) – depreciated for numpy network

Rückgabe

Discriminator output, i.e. data label

Rückgabetyp

numpy.ndarray

load_model(load_dir)[Quellcode]

Load discriminator model

Parameter

load_dir (str) – file with stored pytorch discriminator model to be loaded

loss(x, y, weights=None)[Quellcode]

Loss function :param x: sample label (equivalent to discriminator output) :type x: numpy.ndarray :param y: target label :type y: numpy.ndarray :param weights: customized scaling for each sample (optional) :type weights: numpy.ndarray

Rückgabe

loss function

Rückgabetyp

float

save_model(snapshot_dir)[Quellcode]

Save discriminator model

Parameter

snapshot_dir (str) – directory path for saving the model

set_seed(seed)[Quellcode]

Set seed. :param seed: seed :type seed: int

train(data, weights, penalty=False, quantum_instance=None, shots=None)[Quellcode]

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

Parameter
  • data (tuple(numpy.ndarray, numpy.ndarray)) – real_batch: array, Training data batch. generated_batch: array, Generated data batch.

  • weights (tuple) – real problem, generated problem

  • penalty (bool) – Depreciated for classical networks.

  • quantum_instance (QuantumInstance) – Depreciated for classical networks.

  • shots (int) – Number of shots for hardware or qasm execution. Ignored for classical networks.

Rückgabe

with Discriminator loss and updated parameters.

Rückgabetyp

dict