modules.applications.qml.generative_modeling.transformations.pit.PIT
- class PIT
Bases:
TransformationThe transformation of the original probability distribution to the distribution of its uniformly distributed cumulative marginals is known as the copula.
- __init__()
Constructor method.
Methods
__init__()Constructor method.
compute_discretization(n_qubits, n_registered)Compute discretization for the grid.
compute_discretization_efficient(n_qubits, ...)Compute grid discretization.
emp_integral_trans(data)Applies the empirical integral transformation to the given data.
fit_transform(data)Takes the data points and applies the PIT.
generate_samples(results, bin_data, n_registers)Generate samples based on measurement results and the grid bins.
generate_samples_efficient(results, ...[, noisy])Generate samples efficiently using numpy arrays based on measurement results and the grid bins.
Gets the list of available options.
get_available_submodules(option)If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.
get_default_submodule(option)Given an option string by the user, this returns a submodule.
get_depending_parameters(option, config)If the module has parameters depending on certain options, this method should return the parameters for the given option.
Returns empty dict as this transformation has no configurable settings.
Returns requirements of this module.
get_submodule(option)Submodule is instantiated according to the information given in self.sub_options.
inverse_transform(data)Applies the inverse transformation to the full data set.
postprocess(input_data, config, **kwargs)Does the reverse transformation.
preprocess(input_data, config, **kwargs)In this module, the preprocessing step is transforming the data to the correct target format.
reverse_transform(input_data)Transforms the solution back to the representation needed for validation/evaluation.
transform(input_data, config)Transforms the input dataset using PIT transformation and computes histograms of the training dataset in the transformed space.
- static compute_discretization(n_qubits: int, n_registered: int) ndarray
Compute discretization for the grid.
- Parameters:
n_qubits -- Total number of qubits
n_registered -- Number of qubits to be registered
- Returns:
Discretization data
- static compute_discretization_efficient(n_qubits: int, n_registers: int) ndarray
Compute grid discretization.
- Parameters:
n_qubits -- Total number of qubits
n_registers -- Number of qubits to be registered
- Returns:
Discretization data
- emp_integral_trans(data: ndarray) ndarray
Applies the empirical integral transformation to the given data.
- Parameters:
data -- Data points
- Returns:
Empirically transformed data points
- fit_transform(data: ndarray) ndarray
Takes the data points and applies the PIT.
- Parameters:
data -- Data samples
- Returns:
Transformed data points
- static generate_samples(results: ndarray, bin_data: ndarray, n_registers: int, noisy: bool = True) ndarray
Generate samples based on measurement results and the grid bins.
- Parameters:
results -- Results of measurements
bin_data -- Binned data
n_registers -- Number of registers
noisy -- Flag indicating whether to add noise
- Returns:
Generated samples
- static generate_samples_efficient(results, bin_data: ndarray, n_registers: int, noisy: bool = True) ndarray
Generate samples efficiently using numpy arrays based on measurement results and the grid bins.
- Parameters:
results -- Results of measurements
bin_data -- Binned data
n_registers -- Number of registers
noisy -- Flag indicating whether to add noise
- Returns:
Generated samples
- get_available_submodule_options() list
Gets the list of available options.
- Returns:
List of module options
- get_available_submodules(option: list) list
If the module has submodules depending on certain options, this method should adjust the submodule_options accordingly.
- Parameters:
option -- List of chosen options
- Returns:
List of available submodules
- get_default_submodule(option: str) CircuitCopula
Given an option string by the user, this returns a submodule.
- Parameters:
option -- String with the chosen submodule
- Returns:
Module of type Core
- get_depending_parameters(option: str, config: dict) dict
If the module has parameters depending on certain options, this method should return the parameters for the given option.
- Parameters:
option -- The chosen option
config -- Current config dictionary
- Returns:
The parameters for the given option
- get_parameter_options() dict
Returns empty dict as this transformation has no configurable settings.
- Returns:
Empty dict
- static get_requirements() list[dict]
Returns requirements of this module.
- Returns:
List of dict with requirements of this module
- get_submodule(option: str) Core
Submodule is instantiated according to the information given in self.sub_options. If self.sub_options is None, get_default_submodule is called as a fallback.
- Parameters:
option -- String with the options
- Returns:
Instance of a module
- inverse_transform(data: ndarray) ndarray
Applies the inverse transformation to the full data set.
- Parameters:
data -- Data set
- Returns:
Data set after applying the inverse transformation
- postprocess(input_data: dict, config: dict, **kwargs) tuple[dict, float]
Does the reverse transformation.
- Parameters:
input_data -- Dictionary containing information of previously executed modules
config -- Dictionary containing additional information
kwargs -- Dictionary containing additional information
- Returns:
Tuple with the dictionary and the time the postprocessing took
- preprocess(input_data: dict, config: dict, **kwargs: dict) tuple[dict, float]
In this module, the preprocessing step is transforming the data to the correct target format.
- Parameters:
input_data -- Collected information of the benchmarking process
config -- Config specifying the parameters of the transformation
kwargs -- Additional optional arguments
- Returns:
Tuple with transformed problem and the time it took to map it
- reverse_transform(input_data: dict) dict
Transforms the solution back to the representation needed for validation/evaluation.
- Parameters:
input_data -- Dictionary containing the solution
- Returns:
Dictionary with solution transformed accordingly
- transform(input_data: dict, config: dict) dict
Transforms the input dataset using PIT transformation and computes histograms of the training dataset in the transformed space.
- Parameters:
input_data -- Dataset
config -- Config with the parameters specified in Config class
- Returns:
Dict with PIT transformation, time it took to map it