qml.labs.phox.train

train(optimizer, loss, stepsize, n_iters, loss_kwargs, options=None)[source]

Main training function. Manages the loop, accumulation of history, and convergence checks.

Parameters:
  • optimizer (str) – Name of the optimizer to use. Options are “GradientDescent”, “Adam”, or “BFGS”.

  • loss (Callable) – The loss function.

  • stepsize (float) – The learning rate.

  • n_iters (int) – Total number of training iterations.

  • loss_kwargs (dict[str, Any]) – Arguments to pass to the loss function.

  • options (TrainingOptions | None) – Configuration options for training. See TrainingOptions for further details.

Returns:

The results of the training process, including final parameters and loss history.

See TrainingResult for further details.

Return type:

TrainingResult