Korean
언어
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

qiskit.aqua.components.neural_networks.NumPyDiscriminator

class NumPyDiscriminator(n_features=1, n_out=1)[소스]

Discriminator based on NumPy

매개변수
  • 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)[소스]
매개변수
  • 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

반환값

discriminator object

반환 형식

DiscriminatorNet

get_label(x, detach=False)[소스]

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

매개변수
  • x (numpy.ndarray) – Discriminator input, i.e. data sample.

  • detach (bool) – depreciated for numpy network

반환값

Discriminator output, i.e. data label

반환 형식

numpy.ndarray

load_model(load_dir)[소스]

Load discriminator model

매개변수

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

loss(x, y, weights=None)[소스]

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

반환값

loss function

반환 형식

float

save_model(snapshot_dir)[소스]

Save discriminator model

매개변수

snapshot_dir (str) – directory path for saving the model

set_seed(seed)[소스]

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

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

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

매개변수
  • 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.

반환값

with Discriminator loss and updated parameters.

반환 형식

dict