qsvr
eigenkit.qml.qsvr
eigenkit.qml.qsvr.QSVR
Bases: BaseQuantumRegressor
Quantum support vector regressor (QSVR).
It is the regression counterpart of QSVC. It uses
SVR(kernel="precomputed") from scikit-learn on the quantum kernel matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_map
|
str
|
The feature map. It is |
'Angle'
|
reps
|
int
|
The number of repetitions of the feature map. Default: |
1
|
C
|
float
|
The regularisation parameter of the support vector regressor. Default:
|
1.0
|
epsilon
|
float
|
The width of the epsilon-insensitive tube. Default: |
0.1
|
provider
|
ProviderSpec
|
The backend. It takes the same options as
|
'numpy'
|
random_state
|
int | None
|
The seed. |
42
|
kernel
|
QuantumKernel | None
|
A |
None
|
scale
|
float
|
The bandwidth. The inputs are multiplied by it before they reach
the kernel. Default: |
1.0
|
Example
fit(X, y)
Fit the regressor on training data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
The samples, of shape |
required |
y
|
ndarray
|
The float targets, of shape |
required |
Returns:
| Type | Description |
|---|---|
QSVR
|
This estimator, so that calls can be chained. |
load(path, *, provider=None)
classmethod
Load a fitted model from a .eigenkit bundle.
Load only bundles that you trust. A bundle can contain joblib pickles, and
unpickling runs code, as with torch.load or joblib.load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
The path of the bundle. |
required |
provider
|
ProviderSpec | None
|
A provider that replaces the saved one. |
None
|
Returns:
| Type | Description |
|---|---|
'BaseQuantumEstimator'
|
The loaded estimator. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the method is called on a subclass and the bundle holds
a different class. |
predict(X)
Predict continuous targets for X.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
The samples, of shape |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
One prediction for each sample. |
save(path)
Save a fitted model to a .eigenkit bundle.
The bundles of models that hold scikit-learn objects (QSVC, QSVR, the
reservoir estimators and the time-series estimators) contain joblib
pickles, so loading one can run code. Share them only with people who
trust you.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
The path of the bundle. The suffix |
required |