plugins

Plugins for Quantum Machine Learning using myqlm

class QQuantLib.qml4var.plugins.DataLoadingJunction(*args: Any, **kwargs: Any)

Pluging for loading Data into the circuits of the batch

Parameters:

X (numpy array) – Numpy array with the Features

run(batch, meta_data=None)

Loop over all the jobs of the input Batch and overwrite the different weights of the PQC

class QQuantLib.qml4var.plugins.GradientPlugin(*args: Any, **kwargs: Any)

Pluging for creating gradient Jobs.

The input Batch for the compile method SHOULD HAVE only 1 job. The circuit of the job should be a parametric QLM circuit. The Batch MUST have a meta_data with at least the keys: fetures and weights

compile(batch, hardware_specs)

Compile method of the plugin.

Parameters:

batch (QLM Batch) – QLM batch with the Jobs to execute

Returns:

batch_ – QLM Batch with the jobs for computing graidents

Return type:

QLM Batch

class QQuantLib.qml4var.plugins.MyQPU(*args: Any, **kwargs: Any)

New QPU. Update the result with the corresponding metadata of the input job

Parameters:

input_qpu (QLM qpu) – A qpu that will be the base for the new QPU

submit_job(job)

Given a job submit to the input_qpu and update the meta_data of the QLM Result object with the meta_data of the job

class QQuantLib.qml4var.plugins.ProccesOnInputJunction(*args: Any, **kwargs: Any)
run(batch, meta_data=None)

Loop over all the jobs of the input Batch and overwrite the different weights of the PQC

class QQuantLib.qml4var.plugins.ProccesResultPluging(*args: Any, **kwargs: Any)

Procces the results of a input sample batch. The batch correspond to all the circuits mandatory for proccessing on sample of the dataset.

compile(batch, hardware_specs)

The Batch pass throug the Pluging without modification

post_process(batch_result)

Given a QLM BatchResult object procces it :param batch_result: QLM BatchResult object with the results to procces :type batch_result: QLM BatchResult

class QQuantLib.qml4var.plugins.SetFeaturesPlugin(*args: Any, **kwargs: Any)

Pluging for setting the features of the different PQCs in an input batch. The Batch MUST have a meta_data with at least the keys: fetures

Parameters:

features (numpy array) – Array with the features of the model

compile(batch, hardware_specs)

Loop over all the jobs of the input Batch and overwrite the features parameter of the PQC for each element of the input features.

Parameters:

batch (QLM Batch) – QLM Batch object with the jobs to execute

Returns:

batch_ – QLM Batch with the jobs

Return type:

QLM Batch

class QQuantLib.qml4var.plugins.SetParametersPlugin(*args: Any, **kwargs: Any)

Pluging for setting the weights and features of the different PQCs. The Batch MUST have a meta_data with at least the keys: fetures and weights

Parameters:
  • weights (numpy array) – Array with the weights of the model

  • features (numpy array) – Array with the features for the model. Expected shape: (1, number of features)

compile(batch, hardware_specs)

Loop over all the jobs of the input Batch and overwrite the different weights of the PQC

Parameters:

batch (QLM Batch) – QLM Batch object with the jobs to execute

Returns:

batch_ – QLM Batch with the jobs

Return type:

QLM Batch

class QQuantLib.qml4var.plugins.SetWeightsPlugin(*args: Any, **kwargs: Any)

Pluging for setting the weights of the different PQCs. The Batch MUST have a meta_data with at least the keys: weights

Parameters:

weights (numpy array) – Array with the weights of the model

compile(batch, hardware_specs)

Loop over all the jobs of the input Batch and overwrite the different weights of the PQC

Parameters:

batch (QLM Batch) – QLM Batch object with the jobs to execute

Returns:

batch_ – QLM Batch with the jobs

Return type:

QLM Batch

class QQuantLib.qml4var.plugins.ViewPlugin(*args: Any, **kwargs: Any)

Pluging for depicting the circuits of an input batch

Parameters:

plugin (str) – Name of the Before Plugin

compile(batch, hardware_specs)

compile method

class QQuantLib.qml4var.plugins.new_DataLoadingJunction(*args: Any, **kwargs: Any)
run(batch, meta_data=None)

Loop over all the jobs of the input Batch and overwrite the different weights of the PQC

class QQuantLib.qml4var.plugins.pdfPluging(*args: Any, **kwargs: Any)

Given a batch with a PQC for computing a CDF this plugin computes the Batch for computing the corresponding PDF

Parameters:

parameters (list) – Name of all the features of the PQC. Mandatory for computing the Batch that allows the PDF

compile(batch, hardware_specs)

compile method