Skip to content

Conversation

@alexshacked
Copy link
Contributor

@alexshacked alexshacked commented Jul 7, 2019

Fixes #9494. See also PR #9674.

Issue #9494 surfaced when training svm.SVC classifier with negative sample weights. There is a PR that attempted to fix this issue - PR #9674.
SVC algorithms is part of 5 svm algorithms that are implemented in svm.cpp: SVC, NuSVC, SVR, NuSVR and OneClassSVM. Function PREFIX(train) in svm.cpp implements all 5 algorithms. The way this function handles samples with negative/zero weights is by removing the corresponding samples from the training set.
This behavior can result in an invalid model after fit() for SVC, SVR, NuSVR and OneClassSVM if too many samples are removed, NuSVC is the only class that currently detects this and fails fit() with an exception.
This PR resolves this problem by detecting this situation in all classes and behaving like NuSVC- throwing an Exception during fit()
Please see a more detailed analysis at the bottom of issue #9494

@alexshacked alexshacked closed this Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Fail to train SVM when got "warning: class label 0 specified in weight is not found"

1 participant