Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] Improve stopping condition for SVM training #947

Closed
tfeher opened this issue Aug 9, 2019 · 1 comment · Fixed by #3562
Closed

[FEA] Improve stopping condition for SVM training #947

tfeher opened this issue Aug 9, 2019 · 1 comment · Fixed by #3562
Labels
? - Needs Triage Need team to review and classify feature request New feature or request

Comments

@tfeher
Copy link
Contributor

tfeher commented Aug 9, 2019

Is your feature request related to a problem? Please describe.
In certain cases the SVM training fails to converge to the target tolerance in a reasonable time.
One such case is the following:

iris = load_iris()
X = iris.data
y = iris.target
# we only keep the first two  features in X and sub-sample the dataset to keep 
# only 2 classes and make it a binary classification problem.
X_2d = X[:, :2]
X_2d = X_2d[y > 0]
y_2d = y[y > 0]
y_2d -= 1
scaler = StandardScaler()
X = scaler.fit_transform(X)
X_2d = scaler.fit_transform(X_2d)
params = {'kernel':'poly', 'C': 10, 'gamma': 1e1, 'verbose':1}
sklSVC = sklearn.svm.SVC(**params)
sklSVC.fit(X_2d, y_2d)
cuSVC = cuml.svm.SVC(**params)
cuSVC.fit(X_2d, y_2d)

Likely cause is an oscillation in the diff parameter. Such oscillation could happen if the same set of vectors are getting in and out of the working set,

Describe the solution you'd like

  • Detect if there is an oscillation in the diff parameter
  • Stop training in such case

Describe alternatives you've considered
Currently the training would stop if the number of maximum iterations are reached.

Additional context
This is slightly related to #946, because the working set selection method influences what kind of problems can occur with the convergence.

@tfeher tfeher added ? - Needs Triage Need team to review and classify feature request New feature or request labels Aug 9, 2019
@tfeher
Copy link
Contributor Author

tfeher commented Feb 26, 2021

The training can still converge if the diff parameter oscillates. This will be addressed with a debug message which gives advice how to improve the convergence.

@rapids-bot rapids-bot bot closed this as completed in #3562 Mar 2, 2021
rapids-bot bot pushed a commit that referenced this issue Mar 2, 2021
closes #947 

If the input data for SVM is not normalized correctly, then convergence can be very slow. The solver can even fail to converge. This PR detects such cases and prints a debug message with suggestions how to fix this problem. 

Such problems were reported in #947, #1664, #2857, #3233. The threshold for reporting is set so that the message is printed in those cases. I have tested several properly normalized cases to confirm that the message is not shown. Still, the threshold for printing the message does not have a proper theoretical justification, and false positives might occur. Therefore only a debug message is shown instead of a warning.

Authors:
  - Tamas Bela Feher (@tfeher)

Approvers:
  - Dante Gama Dessavre (@dantegd)

URL: #3562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant