Hello,
I created a thin OCaml wrapper to drive two famous SVM packages for R:
e1071 and svmpath.
The code is here:
This package provides two modules:
- Svm: this one provides access to a Support Vector Machine
with a Radial Basis Function (RBF) or a linear kernel.
This is a binary classifier.
type kernel = RBF of gamma
| Linear
type filename = string
val train: ?debug:bool ->
cost:float -> kernel -> filename -> filename -> Result.t
val predict: ?debug:bool -> Result.t -> filename -> Result.t
val read_predictions: Result.t -> float list
- Svmpath: this one provides only access to a SVM with a linear
kernel, but it allows to quickly find all values
that need to be tested to obtain the best classifier.
This is also a binary classifier.
val train: ?debug:bool -> filename -> filename -> Result.t
val read_lambdas: ?debug:bool -> Result.t -> float list
val predict: ?debug:bool ->
lambda:float -> Result.t -> filename -> Result.t
val read_predictions: Result.t -> float list
The file src/test.ml is a working example of all functionalities.
There are example data and label files under data/.
I don’t claim the package is super efficient.
For example, data are exchanged via text files.
However, it is a proof of concept on how to quickly access
some functionality provided by an R package.
If you want the package to be more efficient or provide access to more
functionalities of the underlying R packages, your help is welcome.
Thanks to Ronan Lehy for help with understanding how to use the svmpath
package.
The corresponding package should appear soon in opam.
Regards,
F.