Skip to content

Conversation

@bwhite
Copy link

@bwhite bwhite commented Apr 20, 2012

Fix for #786

@amueller
Copy link
Member

The problem is that kernel is set to precomputed in the init, instead of the kernel function.

@agramfort
Copy link
Member

I agree with @GaelVaroquaux. kernel_function should be defined in init to make object clonable. The problem should be fixed there. Do you have a snippet that shows the problem?

@amueller
Copy link
Member

@agramfort the sniplet is here #786.

I see two possiblities. The user has to specify kernel='precomputed', kernel_function=func (which I think is ugly)
or the kernel_function attribute is removed and kernel stores the function.

@amueller
Copy link
Member

Lines 83-87 in svm/base.py are the problem. We could just remove them and replace the checks on whether the svm has a kernel_function by the check if the kernel is callable.

@agramfort
Copy link
Member

indeed and replace the hasattr(self, 'kernel_function') with callable('kernel')
try the fix and see if all tests pass.

@bwhite
Copy link
Author

bwhite commented Apr 20, 2012

I agree it is a hack, but the entire user defined kernel behavior is a hack (it breaks the input/output behavior of basically everything) and this just makes it work. I agree with the solution from @amueller to fix the underlying problem. My original fix wasn't as ambitious because it is harder to predict what behavior that will have.

@agramfort
Copy link
Member

give a try to: #789

@bwhite
Copy link
Author

bwhite commented Apr 20, 2012

@agramfort is working on a cleaner solution see
#789
for more info. Closing this.

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.

3 participants