-
Notifications
You must be signed in to change notification settings - Fork 76
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
Pass custom kernel to SVC #103
Comments
What happens if you call |
The custom kernel I wanted to pass was just a dot product, so I used dot(X, Y) from the LinearAlgebra package (that's when I opened the issue). I tried it again just now to recreate the error, and using dot(X, Y) throws an error, but weirdly, using X * Y' works fine (I'm assuming these are equivalent, haven't found any way to confirm that except for a bit of testing on my own). Here's a minimal program showing the error
Using dot(X, Y') (or any other combination) didn't work either. The error I got was this:
|
Looks to me like you're getting Python objects passed to your function. I would look in the PyCall documentation, but maybe |
I tried I saw on another issue that ScikitLearn.jl is currently more of a gateway into the new ecosystem, but if it fits with the current vision for ScikitLearn.jl, I'd like to contribute a passage/page to the documentation about how to use a custom kernel for the SVC (as I would have appreciated it myself). Basically a short example along the lines of the example from the Python sk-learn I linked above and a mention that you probably have to figure out how it works with PyCall (might go more in-depth depending on if I figure it out myself). If you think it's unnecessay, we can also close the issue. |
Looking at the docs, there should probably be a short page like Beware that ScikitLearn hasn't been super-well maintained, so making any kind of PR is a journey! |
Sounds good. I'm not very familiar with PyCall so I'll have to get a bit more understanding first, but since this isn't urgent, I'll just do that soon-ish. I was thinking that maybe 2 pages would be good, one for custom kernels with the example above that shows how easy it is (like sklearn for Python just writing a function and adding it as a parameter for SVC). Then the other page that you mentioned, Relationship to PyCall, and linking to that, to show that, depending on your kernel function, you'll have to use PyCall to get it working. |
I'd see more a |
Not sure if I missed this in the docs or if this can be done with ScikitLearnBase, but in Scikit Learn, you can define a custom kernel function very easily and then pass it to the SVC during creation, like this:
(from here)
I haven't been able to figure out how to do this with the Julia package and haven't found anything about it in the docs either. If it isn't possible, this would be a convenient feature (if it is, sorry for opening the issue and would be very thankful if somebody could point me in the right direction).
The text was updated successfully, but these errors were encountered: