# Sampling strategy#

Several methods have been developed to reduce the execution time by
reducing the number of samples of Pauli operators and to speed up the
convergence by reducing the variance of the measurements. When measuring
by sampling (`type`

of `QuantumDevice`

is not *EXACT_SIMULATOR*),
you can specify them as `sampling_strategy`

. They are used to
determine allocation of the number of samples for each group of Pauli
operators (see Observable grouping).

## Type#

The following `type`

s of `SamplingStrategy`

are available (if no
input is given, *CONSTANT* is set as the default value):

*CONSTANT*[Arr20]: Each group will be allocated a number of samples equal to`num_shots_per_term`

.*UNIFORM*[Arr20]: The total number of samples`num_total_shots`

is distributed among all groups equally.*WEIGHTED*[Arr20]: The total number of samples`num_total_shots`

is distributed among all groups in proportion to the absolute value of the coefficient of the relevant Pauli operators.*WEIGHTED_RANDOM*[Arr20]: The total number of samples`num_total_shots`

is distributed among all groups according to a multinomial distribution whose statistical weights are the coefficients of the Pauli operators.

## Options#

`num_total_shots`

: Specifies the total number of measurements for Pauli strings in the cost function. If there is no input, the default value is set to`1E6`

.`num_shots_per_term`

: If*CONSTANT*is specified, set the number of measurements for each group. If there is no input, the default value is set to`1000`

.`shot_unit`

: Unit of the number of measurements if*UNIFORM*or*WEIGHTED*is specified. For example, if the unit is set to`100`

, each group is measured in multiples of 100. If there is no input,`100`

is set as the default value.`num_overlap_shots`

: The number of measurements for the overlaps in*VQD*cost function. If there is no input,`10000`

is set as the default value.`seed`

: The random seed used to generate the multinomial distribution under the`WEIGHTED_RANDOM`

sampling strategy.

## References#

[Arr20] “Operator Sampling for Shot-frugal Optimization in Variational Algorithms”, A. Arrasmith, L. Cincio, R. D. Somma, and P. J. Coles, arXiv:2004.06252

## Input example#

```
"sampling_strategy": {
"type": "WEIGHTED",
"num_total_shots": 1000000,
"shot_unit": 1
}
```