Refinement Interface#

Module for the Refinement Interface.

class RefinementInterface[source]#

Bases: object

Abstract interface for all refinement strategies.

abstract on_train_start(trainer, solver)[source]#

This method is called once before training begins and is typically used to initialize datasets, sampling conditions, or internal state.

Parameters:
  • trainer (Trainer) – The trainer managing the training loop.

  • solver (BaseSolver) – The solver associated with the trainer.

abstract on_train_epoch_end(trainer, solver)[source]#

Apply refinement at the end of a training epoch.

This method is invoked after each epoch and can update the dataset based on the current state of the model.

Parameters:
  • trainer (Trainer) – The trainer managing the training loop.

  • solver (BaseSolver) – The solver associated with the trainer.

abstract sample(current_points, condition_name, solver)[source]#

Generate new sample points for a given condition.

Parameters:
  • current_points (LabelTensor) – The existing points in the domain.

  • condition_name (str) – The identifier of the condition to refine.

  • solver (BaseSolver) – The solver used for sampling decisions.

Returns:

Newly sampled points.

Return type:

LabelTensor

abstract property dataset#

The training datasets managed by the refinement strategy.

The dataset is stored as a dictionary whose keys are condition names and whose values are the corresponding dataset subsets. The content of this dictionary can be updated dynamically during refinement.

Returns:

The mapping between condition names and dataset subsets.

Return type:

dict

abstract property initial_population_size#

Initial size of the sampled dataset for each condition before any refinement is applied.

Returns:

A mapping between each condition name and its initial number of sampled points.

Return type:

dict[str, int]