FieldSampler

class FieldSampler(initial_models=10, batch_size=1, num_grid_per_dim=1024, grid_sampler=LatinHypercube())[source]

Bases: AbstractAdaptiveSampler

Samples new points at the maxima of a learned scalar field.

Parameters:
num_grid_per_dim: int = 1024
grid_sampler: AbstractOneShotSampler = LatinHypercube()
abstractmethod train_field(params, features, key)[source]
Parameters:
  • params (Array)

  • features (Array)

  • key (Array)

Return type:

Any

abstractmethod evaluate_field(field, theta, key)[source]
Parameters:
  • field (Any)

  • theta (Array)

  • key (Array)

Return type:

float

step(eval_fn, d, state, key, options)[source]

Perform one iteration of the sampling algorithm.

Return type:

SamplerState

batch_size: int = 1
init(eval_fn, d, key, options)

Initialize the sampler state and perform the first evaluations.

Return type:

SamplerState

initial_models: int = 10
terminate(state, target_N)

Determine whether the sampling loop should stop.

Parameters:
  • state (SamplerState)

  • target_N (int)

Return type:

bool