Continuous Quantum Born Circuit Machine (QCBM)

class qugen.main.generator.continuous_qcbm_model_handler.ContinuousQCBMModelHandler

Parameters:

build(model_name: str, data_set: str, n_qubits: int, circuit_depth: int, random_seed: int = 42, transformation: str = 'pit', initial_sigma: float = 0.01, save_artifacts=True, slower_progress_update=False) BaseModelHandler

Build the discrete qcbm model.

Args:

model_name (str): The name which will be used to save the data to disk. data_set (str): The name of the data set which gets as part of the model name n_qubits (int, optional): Number of qubits. Defaults to 2. circuit_depth (int, optional): Number of repetitions of qml.StronglyEntanglingLayers. Defaults to 1. random_seed (int, optional): Random seed for reproducibility. Defaults to 42. transformation (str, optional): Type of normalization, either “minmax” or “pit”. Defaults to “pit”. initial_sigma (float): Initial value of the CMA optimization parameter save_artifacts (bool, optional): Whether to save the model artifacts to disk. Defaults to True. slower_progress_update (bool, optional): Whether to update the progress bar less frequently. Defaults to False.

Returns:

BaseModelHandler: The built model.

predict(n_samples: int = 32) array

Generate samples from the trained model in the original space.

Args:

n_samples (int, optional): Number of samples to generate. Defaults to 32.

Returns:

np.array: Array of samples of shape (n_samples, sample_dimension).

predict_transform(n_samples: int = 32) array

Generate samples from the trained model in the transformed space.

Args:

n_samples (int, optional): Number of samples to generate. Defaults to 32.

Returns:

np.array: Array of samples of shape (n_samples, sample_dimension).

reload(model_name: str, epoch: int) BaseModelHandler

Reload the parameters for the generator and the discriminator from the file weights_file.

Args:

weights_file (str): The path to the pickled tuple containing the generator and discriminator weights.

Returns:

BaseModelHandler: The model, but changes have been made in place as well.

sample(n_samples: int = 32)

Generate samples from the trained model.

Args:

n_samples (int, optional): Number of samples to generate. Defaults to 32.

Returns:

np.array: Array of samples of shape (n_samples, sample_dimension).

save(file_path: Path, overwrite: bool = True) BaseModelHandler

Save the generator weights to disk.

Args:

file_path (Path): The paths where the pickled tuple of generator and discriminator weights will be placed. overwrite (bool, optional): Whether to overwrite the file if it already exists. Defaults to True.

Returns:

BaseModelHandler: The model, unchanged.

train(train_dataset: array, n_epochs: int = 500, batch_size: int = 200, hist_samples: int = 10000) BaseModelHandler

Perform training of the model.