Regularizers

Module name: qmlt.numerical.regularizers

Code author: Maria Schuld <maria@xanadu.ai>

A collection of regularizers to facilitate experiments with the numerical circuit learner.

Summary

l2(circuit_params) L2 regulariser \(0.5 \sum_{i=1}^N w_i^2\) for a vector \(w = (w_1,...,w_N)\) of circuit parameters.
l1(circuit_params) L1 regulariser \(\sum_{i=1}^N |w_i|\) for a vector \(w = (w_1,...,w_N)\) of circuit parameters.

Code details

qmlt.numerical.regularizers.l2(circuit_params)[source]

L2 regulariser \(0.5 \sum_{i=1}^N w_i^2\) for a vector \(w = (w_1,...,w_N)\) of circuit parameters.

Parameters:circuit_params (ndarray) – 1-d array containing the values of the circuit parameters to regularize.
Returns:Scalar l2 loss.
Return type:float
qmlt.numerical.regularizers.l1(circuit_params)[source]

L1 regulariser \(\sum_{i=1}^N |w_i|\) for a vector \(w = (w_1,...,w_N)\) of circuit parameters.

Parameters:circuit_params (ndarray) – 1-d array containing the values of the circuit parameters to regularize.
Returns:Scalar l1 loss.
Return type:float