Skip to content

fit.sampling

Sampling of parameter values.

SamplingType

Bases: Enum

Type of sampling used.

The LHS options are latin hypercube sampling types.

is_log property

is_log

Check if the samples are drawn in logarithmic space.

is_lhs property

is_lhs

Check if latin hypercube sampling is used.

create_samples

create_samples(
    parameters,
    size,
    sampling=LOGUNIFORM,
    seed=None,
    min_bound=1e-10,
    max_bound=10000000000.0,
)

Create samples of start values from the bounds of the parameters.

Infinite bounds are replaced by the hard bounds min_bound and max_bound. Logarithmic sampling requires positive bounds, non-positive lower bounds are replaced by min_bound.

Parameters:

Name Type Description Default
parameters list[FitParameter]

parameters to sample, the bounds define the sampled interval.

required
size int

number of samples.

required
sampling SamplingType

type of sampling.

LOGUNIFORM
seed int | None

seed of the random number generator, for reproducible samples.

None
min_bound float

hard lower bound, replaces an infinite or non-positive bound.

1e-10
max_bound float

hard upper bound, replaces an infinite bound.

10000000000.0

Returns:

Type Description
DataFrame

DataFrame with one row per sample and one column per parameter.

Raises:

Type Description
ValueError

if the sampling type is unsupported or the bounds are invalid.