LIBSVM API usage?

I quite like the simplicity of the basic LIBSVM API. I know that many call it from ScikitLearn, but I am exploring the possibility of just using the Native API.
For instance, I discovered (after a good deal of trial and error) that I could use

svmtrain(x,y,kernel=LIBSVM.Kernel.Linear)

There is no documentation on the LIBSVM.jl package page for any of the options.
For kernels, I noticed a package KernelLibrary.jl (don’t know if it is in the registry), but this also has no documentation or examples at all. I wondered if I might be able to use these kernels (if I knew their names).
I could spend a few days guessing or trying to read source code to find how to use options in LIBSVM.jl or kernel names/choices in KernelLibrary and a list of possibilities, but if there were an easier way, that would be wonderful.

This seems to happen to me (and my students) quite often with Julia packages - there are many packages with absolutely no documentation or examples. I am of course grateful for all the work people have done to create packages and make them available. But I always wonder why most don’t seem to want to go the next step and take 20 mins or so to write very basic documentation and one or two examples of basic usage?

Or perhaps I am missing something obvious?

Thanks

First, I have to say that I don’t know much about those packages that you mentioned above.

However, I also want to say that the virtue of open source is that people are spending their valuable personal time to create software that are hopefully useful for someone else. Often, documentation may be lagging due to a variety of reasons:

  • author wants to focus on code than docs
  • author does not have time to maintain docs
  • author has other priorities
  • etc.

On the flip side,developers in the Julia community are usually quite happy to help each other out. So posting a message here or other Julia venues would be pretty effective.

Also, many package developers are quite open to discuss how to use their packages on their GitHub repos and welcome contributions. If you have figured out how to do something that’s undocumented then I would encourage you to submit a PR and make it better for everyone else.

Just my 2 cents.

Tom

What might help you a bit with LIBSVM is that some methods have docstrings defined - you can look at them by pressing ‘?’ in the REPL and then entering a name, for example:

julia>?svmpredict

svmpredict{T,U<:Real}(model::SVM{T}, X::AbstractMatrix{U})

Predict values using model based on data X. The shape of X needs to be (nfeatures,
nsamples). The method returns tuple (predictions, decisionvalues).

although not everything seems to have a docstring in that package.

What is also helpful is the names function which shows you what symbols are exported in a module - usually these are the ones that one is interested in:

julia> names(LIBSVM)
14-element Vector{Symbol}:
 :EpsilonSVR
 :Kernel
 :LIBSVM
 :LinearSVC
 :Linearsolver
 :NuSVC
 :NuSVR
 :OneClassSVM
 :SVC
 :fit!
 :predict
 :svmpredict
 :svmtrain
 :transform

Thank you. That is the kind of (constructive) comment I was hoping for. That helps alot. I think the combination of this and the result of ? can get me some distance.

I think last time I worked with this library I also had to look at the readme from the libsvm c library that this package wraps: libsvm/README at master · cjlin1/libsvm · GitHub.

I also have to admit that my Julia workflow quite often revolves around looking at the actually source code of the libraries that I am using.

Thanks for that. I was trying to use that as a guide, but hoping for some other way.