Portuguese, Brazilian
Idiomas
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.aqua.components.neural_networks.NumPyDiscriminator

class NumPyDiscriminator(n_features=1, n_out=1)[código fonte]

Discriminator based on NumPy

Parâmetros
  • 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)[código fonte]
Parâmetros
  • 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

Retorna

discriminator object

Tipo de retorno

DiscriminatorNet

get_label(x, detach=False)[código fonte]

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

Parâmetros
  • x (numpy.ndarray) – Discriminator input, i.e. data sample.

  • detach (bool) – depreciated for numpy network

Retorna

Discriminator output, i.e. data label

Tipo de retorno

numpy.ndarray

load_model(load_dir)[código fonte]

Load discriminator model

Parâmetros

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

loss(x, y, weights=None)[código fonte]

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

Retorna

loss function

Tipo de retorno

float

save_model(snapshot_dir)[código fonte]

Save discriminator model

Parâmetros

snapshot_dir (str) – directory path for saving the model

set_seed(seed)[código fonte]

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

train(data, weights, penalty=False, quantum_instance=None, shots=None)[código fonte]

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

Parâmetros
  • 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.

Retorna

with Discriminator loss and updated parameters.

Tipo de retorno

dict