GeneratorSampler.generate_z

GeneratorSampler.generate_z(datablock: DataBlock, y_req: List | ndarray, n_samples: int = 1, epsilon_sampler: float = 0.1, over_generation: int = 10000, model: CondAEModel | None = None) 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_reqUnion[List, np.ndarray]

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.

n_samplesint, optional (default=50)

The number of samples of design parameters to generate.

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

Required to obtain the z_train to fit the KDE

Returns:

y_samptorch.Tensor

The samples generated, in a torch.Tensor format.

y_reqList

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