Generator

class aixd.mlmodel.generation.generator.Generator(model: CondAEModel, datamodule: DataModule, sampling_type: str = 'sampling', over_sample: int = 10, callbacks_class: CustomCallback | None = None, fast_generation: bool = True)[source]

Bases: object

Initialize a Generator instance. This instance is used to request the trained model the generation of sets of design parameters for a given set of attributes.

Parameters:
  • model (CondAEModel, optional, default=None) – The LightningModule that defines the generation process. If not provided, generation will be performed without a specific model.

  • datamodule (DataModule optional, default=None) – The LightningDataModule that handles data loading and preprocessing. If not provided, data handling should be managed externally.

  • sampling_type (str, optional, default=”sampling”) – The type of sampling to be used for generation. The options are: “bayesian”, and “sampling”. See notes for more details.

  • over_sample (int, optional, default=10) – If we request to generate n_samples, we will generate n_samples * over_sample, and then select the best n_samples.

  • callbacks_class (class, optional, default=None) – A custom callback class to be used during the data generation process. This class should be derived from LightningCallbacks.

  • fast_generation (bool, optional, default=False) – If True, the generation process will be faster, but the values of z will not be generated conditioned on the y requested. Only applicable to the Conditional AE model.

Notes

  • All the instances of datamodule and model (with the checkpoint) loaded

    are required

  • The default sampling_type type is “sampling”, and also the most recommended. “bayesian” is too

    slow.

  • If you want to use custom callbacks, provide a user-defined class via the

callbacks_class parameter.

Methods

generate

Wrapper method to call the generation process.

info_attributes_req

It just prints the attributes that could be requested for generation

print_results_gen

Print the results stored in a dictionary of dictionaries.