MultiClassObjectiveFunction#

class MultiClassObjectiveFunction(X, y, neural_network, loss)[fuente]#

Bases: ObjectiveFunction

An objective function for multiclass representation of the output. For instance, classes of 0, 1, 2, etc.

Parámetros:
  • X (ndarray) – The input data.

  • y (ndarray) – The target values.

  • neural_network (NeuralNetwork) – An instance of an quantum neural network to be used by this objective function.

  • loss (Loss) – A target loss function to be used in training.

Methods

gradient(weights)[fuente]#

Computes gradients of this objective function given weights.

Parámetros:

weights (ndarray) – an array of weights to be used in the objective function.

Devuelve:

Gradients of the function.

Tipo del valor devuelto:

ndarray

objective(weights)[fuente]#

Computes the value of this objective function given weights.

Parámetros:

weights (ndarray) – an array of weights to be used in the objective function.

Devuelve:

Value of the function.

Tipo del valor devuelto:

float