Skip to content

Get the number of iterations in SVR #18928

Closed
@leonardtschora

Description

@leonardtschora

Describe the workflow you want to enable

Hi everyone,

I am manipulating SVR objects in GridSearcheCV. I am able to access the mean_fit_time in the cv_results_, but I can't access the number of iterations of the optimization problem.

I would like to have this information to properly set the max_iter parameter of the GridSearch.

Describe your proposed solution

I have tried the following:

from sklearn.svm import SVR
from sklearn.datasets import load_boston

# Load data
X, y = load_boston(return_X_y=True)

# Model test
model = SVR(verbose=4)
model.fit(X, y)

[LibSVM]*
optimization finished, #iter = 351
obj = -3012.975812, rho = -21.172739
nSV = 499, nBSV = 431
Out[1]: SVR(gamma=1.0, verbose=4)

I am interested in getting the #iter field here. It should be available as a property of the model once fitted, and all number of iterations should appear somewhere in the cv_results_.

Also, please not that this feature should be available for all libsvm-based SVM objects: SVC, SVR, etc...

Additional context

I am running this code on:
Python 3.7.3
scikit-learn 0.23.1

Thanks by advance for your support.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions