romtools.workflows.space_filling.run_space_filling#

romtools.workflows.space_filling.run_space_filling(fom_model, rom_model_builder, parameter_space, absolute_work_dir, tolerance, initial_sample_size=10, batch_size=5, candidate_pool_size=1000, distance_metric=None, max_concurrent_fom_runs=5, random_seed=1, *, error_functor=None, validation_strategy=None, max_iterations=20, max_fom_samples=None)[source]#

Train a ROM by alternating complete maximin FOM batches and validation.

batch_size controls new training points independently of the active process limit max_concurrent_fom_runs. Concurrent FOM objects must be serializable with multiprocessing’s spawn context. All three model methods execute in one worker task and may use that task’s independent directory. Builders and validation run sequentially in the parent process.

The builder receives directories, parameter rows, and QoI rows in matching order, using QoiModelBuilderWithTrainingData’s four-argument method. It must build independent models from only the supplied data. Default validation rebuilds five fold-specific ROMs and returns maximum held-out relative L2 QoI error. error_functor(qoi_rom, qoi_fom) replaces that per-sample error completely; no normalization is applied to a custom functor’s result. A custom validation_strategy(context) owns validation and aggregation.

max_iterations includes the initial batch; max_fom_samples bounds training FOM runs scheduled here, excluding any references prepared by a custom validation strategy. Short candidate pools and final budget-limited batches are allowed. No restart, automatic retry, or overwrite is performed. Output must be an absent or empty absolute directory. Failed batches retain all run files and never trigger a rebuild or enter accepted training data.

Parameters:
  • fom_model (QoiModel)

  • rom_model_builder (QoiModelBuilderWithTrainingData)

  • parameter_space (ParameterSpace)

  • absolute_work_dir (str)

  • tolerance (float)

  • initial_sample_size (int)

  • batch_size (int)

  • candidate_pool_size (int)

  • distance_metric (Callable | None)

  • max_concurrent_fom_runs (int)

  • random_seed (int)

  • error_functor (Callable | None)

  • validation_strategy (Callable | None)

  • max_iterations (int)

  • max_fom_samples (int | None)

Return type:

SpaceFillingResult