modules.applications.qml.generative_modeling.generative_modeling.GenerativeModeling
- class GenerativeModeling
Bases:
QMLGenerative models enable the creation of new data by learning the underlying probability distribution of the training data set of interest. More specifically, a generative model attempts to learn an unknown probability distribution Q by modeling an approximated probability distribution P(θ) which is parameterized by a set of variables θ. Data sampled from Q is used to train a model by tuning θ such that P(θ) more closely approximates Q.
- __init__()
Constructor method.
Methods
__init__()Constructor method.
generate_problem(config)The number of qubits is chosen for this problem.
Gets the application.
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)Returns the default submodule based on the given option.
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 the configurable settings for this application.
Returns requirements of this module.
get_solution_quality_unit()get_submodule(option)Submodule is instantiated according to the information given in self.sub_options.
postprocess(input_data, config, **kwargs)Process the solution here, then validate and evaluate it.
preprocess(input_data, config, **kwargs)Generate the actual problem instance in the preprocess function.
save(path, iter_count)Placeholder method for saving output to a file.
- generate_problem(config: dict) dict
The number of qubits is chosen for this problem.
- Parameters:
config -- Dictionary including the number of qubits
- Returns:
Dictionary with the number of qubits
- get_application() any
Gets the application.
- Returns:
self.application
- 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) ContinuousData | DiscreteData
Returns the default submodule based on the given option.
- Parameters:
option -- The submodule option to select
- Returns:
Instance of the selected submodule
- Raises:
NotImplemented -- If the provided option is not implemented
- 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 the configurable settings for this application.
- Returns:
Dictionary of configurable parameters
return { "n_qubits": { "values": [4, 6, 8, 10, 12], "description": "How many qubits do you want to use?" } }
- static get_requirements() list[dict]
Returns requirements of this module.
- Returns:
List of dicts 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: dict) tuple[dict, float]
Process the solution here, then validate and evaluate it.
- Parameters:
input_data -- A representation of the quantum machine learning model that will be trained
config -- Config specifying the parameters of the training
kwargs -- Optional keyword arguments
- Returns:
Tuple with input_data and the function's computation time
- preprocess(input_data: dict, config: dict, **kwargs: dict) tuple[dict, float]
Generate the actual problem instance in the preprocess function.
- Parameters:
input_data -- Usually not used for this method
config -- Config for the problem creation
kwargs -- Optional additional arguments
- Returns:
Tuple containing qubit number and the function's computation time
- save(path: str, iter_count: int) None
Placeholder method for saving output to a file.
- Parameters:
path -- Path to save the file
iter_count -- Iteration count