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

support for bias different from 1 #8

Closed
daslu opened this issue Apr 16, 2014 · 5 comments
Closed

support for bias different from 1 #8

daslu opened this issue Apr 16, 2014 · 5 comments

Comments

@daslu
Copy link

daslu commented Apr 16, 2014

The liblinear bias parameter is defined as follows (README.md at commit 7b6c6a56c1 of liblinear java):
https://github.com/bwaldvogel/liblinear-java/blob/master/README.md
"if bias >= 0, instance x becomes [x; bias]; if < 0, no bias term added (default -1)".

clj-liblinear does support the use of bias (thanks to #4 by @akhudek).

Currently in clj-liblinear, the only supported bias values are 0 and 1:
https://github.com/lynaghk/clj-liblinear/blob/master/src/clj_liblinear/core.clj#L54
Also, the bias=0 case results in not adding the extra featue:
https://github.com/lynaghk/clj-liblinear/blob/master/src/clj_liblinear/core.clj#L64

I suggest to the following changes:
(1) Support all bias values.
(2) Let the bias=0 case behave like documented in liblinear-java: adding an extra feature of value 0.

Reasons for the change:

  • It seems reasonable for the behaviour of training to match the documented behaviour of liblinear-java.
  • At least (1) is actually useful: tuning the value of the constant feature makes it possible to control the importance of regularizing the intercept vs. regularizing the other coefficients.
  • Maybe (2) is useful too?

If desired, I can suggest a pull request with these changes.
What do you think?

@lynaghk
Copy link
Owner

lynaghk commented Apr 16, 2014

Agreed, this seems like a very reasonable addition.
A pull request would be awesome.
My only request is that you handle the case of true/false inputs by converting to 1 or 0, respectively to maintain backwards compatibility for existing callers.

@daslu
Copy link
Author

daslu commented Apr 27, 2014

Hi,

I have seen the deprecation notice, so I guess the pull request is not relevant here anymore.
I am fixing this at my fork.

Let us keep in touch in case you are interested in it again, one day.

Again, many thanks for this very nice project.

@lynaghk
Copy link
Owner

lynaghk commented Apr 27, 2014

Will do, I'll contact you about a redesign if that is ever in the cards.

@lynaghk lynaghk closed this as completed Apr 27, 2014
@akhudek
Copy link
Contributor

akhudek commented Apr 27, 2014

Hey daslu, (2) would be the same thing as simply leaving the bias feature out since w*0=0.

@daslu
Copy link
Author

daslu commented Apr 29, 2014

Thanks,
yes, this seems to be true for all the various objective functions supported by liblinear-java.
I have no idea why liblinear-java supports adding a zero column.

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

No branches or pull requests

3 participants