GeneratorSampler.generate

GeneratorSampler.generate(datablock: DataBlock, y_req: List[int | float | bool | str | List], attributes_req: List[str] = [], n_samples: int = 50, request_orig_range: bool = True, dobj_req: List[DataObject] | None = None, flag_range: bool = False, epsilon_sampler: float = 0.05, over_generation: int = 10, model: CondAEModel | None = None, sample_z: bool = False) Tuple[torch.Tensor, List][source]

The Generator class uses the instance provided, and now call generate to obtain the samples required to be passed to the decoder. All the possible methods for generating this samples are implemented here.

Parameters:

selfobject

The instance of the class containing this method.

y_reqList[int, float, bool, str, List[int, float, bool, str]]

The values requested for each of the attributes specified. Depending on the type of attribute, we can have to provide an specific type. Besides, if we want to generate in an interval, we can alternatively provide a List.

attributes_reqList[str]

The list of attribute names used to run the generative process.

n_samplesint, optional (default=50)

The number of samples of design parameters to generate.

request_orig_rangebool, optional (default=False)

If True, the y_req is specified within the original range of the real data.

dobj_reqList[DataObject]

DataObject instances for the attributes requested, to be used in later steps

flag_rangebool, optional (default=False)

If True, indicates if the list of requests include intervals or not

epsilon_samplerfloat, optional (default=0.05)

When using “kde” method, for specific requests, in reality we create a range around it for the condition, as if not we will never get samples perfectly satisfying the value.

over_generationint, optional (default=10)

When using “bayesian” or “kde” method, the number of samples generated is n_samples * over_generation. This is because we will reject some of them, and this accelerates the process.

modelCondAEModel, optional

Required to obtain the z_train to fit the KDE

sample_zbool, optional (default=False)

Flag to indicate if we want to also sample z jointly with y

Returns:

y_samptorch.Tensor

The samples generated, in a torch.Tensor format.

y_reqList

The requested values, in the same format as the input.