ObjectiveFunction#

class ObjectiveFunction(X, y, neural_network, loss)[исходный код]#

Базовые классы: object

An abstract objective function. Provides methods for computing objective value and gradients for forward and backward passes.

Параметры:
  • 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

abstract gradient(weights)[исходный код]#

Computes gradients of this objective function given weights.

Параметры:

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

Результат:

Gradients of the function.

Тип результата:

ndarray

abstract objective(weights)[исходный код]#

Computes the value of this objective function given weights.

Параметры:

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

Результат:

Value of the function.

Тип результата:

float