Distribution samplers

Initial-guess distribution samplers used by DataFit for multi-start optimization. Mirrors ionworkspipeline.data_fits.distribution_samplers.

Schemas for distribution_samplers (match ionworkspipeline: iwp.data_fits.distribution_samplers).

class ionworks_schema.distribution_samplers.DistributionSampler

Bases: BaseSchema

Base class for initial-guess distribution samplers.

Not typically used directly — configure via one of the concrete subclasses below.

Extends: ionworks_schema.base.BaseSchema

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.distribution_samplers.HypercubeSampler

Bases: DistributionSampler

Base class for hypercube-style samplers over the parameter bounds.

Samples are drawn from the unit hypercube and then mapped through each parameter’s distribution to produce scaled initial guesses spanning the parameter bounds.

Extends: ionworks_schema.distribution_samplers.distribution_samplers.DistributionSampler

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.distribution_samplers.LatinHypercube

Bases: HypercubeSampler

Latin Hypercube sampler over the parameter bounds.

Each of the multistarts initial guesses is drawn from a different stratum of the hypercube formed by the parameter bounds, giving better space-filling than plain uniform sampling. Backed by scipy.stats.qmc.LatinHypercube.

Extends: ionworks_schema.distribution_samplers.distribution_samplers.HypercubeSampler

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.distribution_samplers.Uniform

Bases: HypercubeSampler

Uniform sampler over the parameter bounds.

Each initial guess is drawn i.i.d. uniformly from the box defined by the parameter bounds. Simpler but less space-filling than LatinHypercube.

Extends: ionworks_schema.distribution_samplers.distribution_samplers.HypercubeSampler

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.