QSVR¶
- class QSVR(*, quantum_kernel=None, **kwargs)[source]¶
Bases:
SVR
,SerializableModelMixin
Quantum Support Vector Regressor that extends the scikit-learn sklearn.svm.SVR regressor and introduces an additional quantum_kernel parameter.
This class shows how to use a quantum kernel for regression. The class inherits its methods like
fit
andpredict
from scikit-learn, see the example below. Read more in the scikit-learn user guide.Example
qsvr = QSVR(quantum_kernel=qkernel) qsvr.fit(sample_train,label_train) qsvr.predict(sample_test)
- Parameters:
quantum_kernel (BaseKernel | None) -- Quantum kernel to be used for regression.
*args -- Variable length argument list to pass to SVR constructor.
**kwargs -- Arbitrary keyword arguments to pass to SVR constructor.
Attributes
Weights assigned to the features when kernel="linear".
Number of support vectors for each class.
Returns quantum kernel
Methods
fit
(X, y[, sample_weight])Fit the SVM model according to the given training data.
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
load
(file_name)Loads a model from the file.
predict
(X)Perform regression on samples in X.
save
(file_name)Saves this model to the specified file.
score
(X, y[, sample_weight])Return the coefficient of determination of the prediction.
set_fit_request
(*[, sample_weight])Request metadata passed to the
fit
method.set_params
(**params)Set the parameters of this estimator.
set_score_request
(*[, sample_weight])Request metadata passed to the
score
method.