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

Fix linear SVM binding bugs #2419

Merged
merged 2 commits into from
May 21, 2020
Merged

Fix linear SVM binding bugs #2419

merged 2 commits into from
May 21, 2020

Conversation

rcurtin
Copy link
Member

@rcurtin rcurtin commented May 20, 2020

While trying to integrate linear_svm() into my company's software, I found two bugs; one simple, one rather subtle:

  1. no_intercept is backwards---you have to specify no_intercept to get an intercept. This PR corrects the behavior. :)
  2. The intercept was not properly being added in the call to Classify(). Specifically, we were using data.n_rows - 1 to get the index of the intercept in parameters---but if there is an intercept, then data has one fewer row than parameters! So we should use parameters.n_rows - 1 instead.

Copy link
Member

@KimSangYeon-DGU KimSangYeon-DGU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@zoq zoq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well.

@zoq zoq merged commit c890afb into mlpack:master May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants