modules.applications.qml.generative_modeling.transformations.min_max.MinMax
- class MinMax
Bases:
TransformationIn min-max normalization each data point is shifted such that it lies between 0 and 1.
- __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.
fit_transform(data)Method that performs the min max normalization.
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)Method that performs the inverse min max normalization.
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 MinMax 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
- fit_transform(data: ndarray) ndarray
Method that performs the min max normalization.
- Parameters:
data -- Data to be fitted
- Returns:
Fitted data
- 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) CircuitStandard | CircuitCardinality
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
Method that performs the inverse min max normalization.
- Parameters:
data -- Data to be fitted
- Returns:
Data in original space
- 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:
Solution transformed accordingly
- transform(input_data: dict, config: dict) dict
Transforms the input dataset using MinMax transformation and computes histograms of the training dataset in the transformed space.
- Parameters:
input_data -- A dictionary containing information about the dataset and application configuration.
config -- A dictionary with parameters specified in the Config class.
- Returns:
A tuple containing a dictionary with MinMax-transformed data.