modules.applications.qml.generative_modeling.transformations.transformation.Transformation

class Transformation(name)

Bases: Core, ABC

The task of the transformation module is to translate data and problem specification of the application into preprocessed format.

__init__(name)

Constructor method.

Methods

__init__(name)

Constructor method.

compute_discretization(n_qubits, n_registered)

Compute discretization for the grid.

compute_discretization_efficient(n_qubits, ...)

Compute grid discretization.

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.

get_available_submodule_options()

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.

get_parameter_options()

Returns the parameters for a given module.

get_requirements()

Returns requirements of this module.

get_submodule(option)

Submodule is instantiated according to the information given in self.sub_options.

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 original problem.

transform(input_data, config)

Helps to ensure that the model can effectively learn the underlying patterns and structure of the data, and produce high-quality outputs.

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

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

abstract get_default_submodule(option: str) Core

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

abstract get_parameter_options() dict

Returns the parameters for a given module.

Should always be in this format:

{
   "parameter_name":{
      "values":[1, 2, 3],
      "description":"How many nodes do you need?"
   },
    "parameter_name_2":{
      "values":["x", "y"],
      "description":"Which type of problem do you want?"
   }
}
Returns:

Available settings for this application

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

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 original problem. This might not be necessary in all cases, so the default is to return the original solution. This might be needed to convert the solution to a representation needed for validation and evaluation.

Parameters:

input_data -- The input data to be transformed

Returns:

Transformed data

abstract transform(input_data: dict, config: dict) dict

Helps to ensure that the model can effectively learn the underlying patterns and structure of the data, and produce high-quality outputs.

Parameters:
  • input_data -- Input data for transformation

  • config -- Configuration parameters for the transformation

Returns:

Transformed data.