TrainingOptions user defined type

Namespace: Microsoft.Quantum.MachineLearning

Package: Microsoft.Quantum.MachineLearning

A collection of options to be used in training quantum classifiers.

newtype TrainingOptions = (LearningRate : Double, Tolerance : Double, MinibatchSize : Int, NMeasurements : Int, MaxEpochs : Int, MaxStalls : Int, StochasticRescaleFactor : Double, ScoringPeriod : Int, VerboseMessage : (String -> Unit));

Named Items

LearningRate : Double

The learning rate by which gradients should be rescaled when updating model parameters during training steps.

Tolerance : Double

The approximation tolerance to use when preparing samples as quantum states.

MinibatchSize : Int

The number of samples to use in each training minibatch.

NMeasurements : Int

The number of times to measure each classification result in order to estimate the classification probability.

MaxEpochs : Int

The maximum number of epochs to train each model for.

MaxStalls : Int

The maximum number of times a training epoch is allowed to stall (approximately zero gradient) before failing.

StochasticRescaleFactor : Double

The amount to rescale stalled models by before retrying an update.

ScoringPeriod : Int

The number of gradient steps to be taken between scoring points. For best accuracy, set to 1.

VerboseMessage : String -> Unit

A function that can be used to provide verbose feedback.


This UDT should not be created directly, but rather should be specified by calling DefaultTrainingOptions function and then using the w/ operator to override different defaults.

For example, to use 100,000 measurements and at most 8 training epochs:

let options = DefaultTrainingOptions()
              w/ NMeasurements <- 100000
              w/ MaxEpochs <- 8;