squlearn.qrc.base_qrc.BaseQRC

class squlearn.qrc.base_qrc.BaseQRC(encoding_circuit: EncodingCircuitBase, executor: Executor, ml_model: str = 'linear', ml_model_options: dict | None = None, operators: ObservableBase | list[ObservableBase] | str = 'random_paulis', num_operators: int = 100, operator_seed: int = 0, param_ini: ndarray | None = None, param_op_ini: ndarray | None = None, parameter_seed: int | None = 0, caching: bool = True)

Base class for Quantum Reservoir Computing (QRC) models.

Parameters:
  • encoding_circuit (EncodingCircuitBase) – The encoding circuit to use for encoding the data into the reservoir.

  • executor (Executor) – Executor instance

  • ml_model (str) – The classical machine learning model to use (default: linear), possible values are "mlp", "linear", and "kernel". Implementation depends on the child.

  • ml_model_options (dict) – The options for the machine learning model. Default options of the sklearn model are used if None.

  • operators (Union[ObservableBase, list[ObservableBase], str]) –

    Strategy for generating the operators used to measure the quantum reservoir. Possible values are:

    • "random_paulis" generates random Pauli operators (default).

    • "single_paulis" generates single qubit Pauli operators.

    Alternatively, a list of ObservableBase objects can be provided.

  • num_operators (int) – The number of random Pauli operators to generate for "operators = random_paulis" (default: 100).

  • operator_seed (int) – The seed for the random operator generation for "operators = random_paulis" (default: 0).

  • param_ini (Union[np.ndarray, None]) – The parameters for the encoding circuit.

  • param_op_ini (Union[np.ndarray, None]) – The initial parameters for the operators.

  • parameter_seed (Union[int, None]) – The seed for the initial parameter generation if no parameters are given.

  • caching (bool) – Whether to cache the results of the evaluated expectation values.

fit(X, y) None

Fit a new Quantum Reservoir Computing model to data.

Parameters:
  • X – Input data

  • y – Labels

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:

routing – A MetadataRequest encapsulating routing information.

Return type:

MetadataRequest

get_params(deep: bool = True) dict

Returns a dictionary of parameters for the current object.

Parameters:

deep – If True, includes the parameters from the base class.

Returns:

A dictionary of parameters for the current object.

Return type:

dict

predict(X) ndarray

Predict using the Quantum Reservoir Computing.

Parameters:

X – The input data.

Returns:

The predicted values.

Return type:

np.ndarray

set_params(**params) BaseQRC

Sets the hyper-parameters of the QLEM model.

Parameters:

params (dict) – A dictionary of hyper-parameters to set.

Returns:

The modified QLEM model.

Return type:

BaseQRC