LocalEffectiveDimension¶
- class LocalEffectiveDimension(qnn, weight_samples=1, input_samples=1)[source]¶
Bases:
EffectiveDimension
This class computes the local effective dimension for a Qiskit
NeuralNetwork
following the definition used in [1].In the local version of the algorithm the number of weight samples is limited to 1. Thus,
weight_samples
must be of the shape(1, qnn.num_weights)
.References [1]: Abbas et al., The power of quantum neural networks. The power of QNNs.
- Parameters:
qnn (
NeuralNetwork
) -- A QiskitNeuralNetwork
, with a specific dimension(num_weights)
that will determine the shape of the Fisher Information Matrix(num_input_samples * num_weight_samples, num_weights, num_weights)
used to compute the global effective dimension for a set ofinput_samples
, of shape(num_input_samples, qnn_input_size)
, andweight_samples
, of shape(num_weight_samples, num_weights)
.weight_samples (
Union
[ndarray
,int
]) -- An array of neural network parameters (weights), of shape(num_weight_samples, num_weights)
, or anint
to indicate the number of parameter sets to sample randomly from a uniform distribution. By default,weight_samples = 1
.input_samples (
Union
[ndarray
,int
]) -- An array of samples to the neural network, of shape(num_input_samples, qnn_input_size)
, or anint
to indicate the number of input sets to sample randomly from a normal distribution. By default,input_samples = 1
.
Attributes
Returns network parameters.
Methods