How do I specify a precomputed kernel in SVM using LIBSVM or MLJ?

Question arising in an MLJ slack post:

maybe this is a naive question, but how do you actually train an SVM using a precomputed kernel using LIBSVM or MLJ? I can’t seem to find a way to “give” the kernel matrix to any sort of fit function or model as a parameter

1 Like

This is not clear, even in the LIBSVM (C-code) docs, as far as I can tell. However, I found this document which explains the kernel should be provided in a file, which is specified as a command-line argument in the C-case.

Looking at the LIBSVM.jl code, I can’t find an interface point, which means there won’t be one in the MLJ wrapper either, as this is based on the former.

I’ve opened an issue at LIBSVM.jl querying this.

Happy to add the interface point to the MLJ wrapper when this is clarified.