Learning Machine Learning (SVM) with Julia

Hi !
I would like to learn machine learning, SVM in particular. I am a complete newbie and I search few advices from experimented user before starting.
1- Is it a good idea to learn SVM with Julia or it will be much more complicated than Python or R ?
2- Do you know a good tutorial for beginner to learn SVM with Julia ?
3- What SVM package should I choose ? Since I have a level=0 and I am not mathematician I do not have criteria to choose.
Many thanks for any advice !
Take care !

What do you mean by learn? Use an implementation or fully implement an SVM? If you only want to use an implementation python or R might be easier. If you want to implement it Julia will provide you better tools.

Hi @davidbp I want to use an implementation ready to use. I am unable to implement anything myself at this stage…

Probably MLJ can be useful to you. It’s a package that allows you to use a lot of ML models, in particular you have SVM.

1 Like

Thank you @davidbp, I will have a look at the tutorials :wink:

did you check https://juliaacademy.com/courses/ ?

Hi @pbayer, not yet because I did not know what is the best Julia package for a beginner :wink:

Most implementations of SVM are a wrapper around LIBSVM (for example, MLJ mentioned above uses LIBSVM.jl). If you have experience with any of the languages you mentioned (Julia, Python, R) I would suggest going with that, so that your focus is on learning how to use SVM instead of learning how to use the language to use SVM.

Most importantly, LIBSVM has a few nice indications on how to start (normalizing your data, setting the parameters and so forth), so I think anyways that will be the place to begin.

1 Like

Thank you very much for your advices @kmundnic !

I use Julia since 0.4 and it is the language I prefer by far :wink: But Julia is also the youngest language compared to R/Python, that is why I asked if Julia is suited for beginner since it will be much more difficult to find tutorials.

I watched the course of Chris Rackauckas in Julia Academy, it is very good for newbies. I will have a look at LIBSVM and see if I understand something.

This is a feeback of my first attempt to learn SVM
I read the nice guide published in LIBSVM page. Then I tried the example published in LIBSVM.jl webpage and I obtained this result with julia 1.3.1 and LIBSVM v0.4.0 :confused:

julia> labels = convert(Vector, iris[:Species])
┌ Warning: `getindex(df::DataFrame, col_ind::ColumnIndex)` is deprecated, use `df[!, col_ind]` instead.
│   caller = top-level scope at REPL[9]:1
└ @ Core REPL[9]:1
150-element Array{CategoricalString{UInt8},1}:

julia> instances = convert(Array, iris[:, 1:4])'
4×150 LinearAlgebra.Adjoint{Float64,Array{Float64,2}}:
 5.1  4.9  4.7  4.6  5.0  5.4  4.6  5.0  4.4  4.9  …  6.9  5.8  6.8  6.7  6.7  6.3  6.5  6.2  5.9
 3.5  3.0  3.2  3.1  3.6  3.9  3.4  3.4  2.9  3.1     3.1  2.7  3.2  3.3  3.0  2.5  3.0  3.4  3.0
 1.4  1.4  1.3  1.5  1.4  1.7  1.4  1.5  1.4  1.5     5.1  5.1  5.9  5.7  5.2  5.0  5.2  5.4  5.1
 0.2  0.2  0.2  0.2  0.2  0.4  0.3  0.2  0.2  0.1     2.3  1.9  2.3  2.5  2.3  1.9  2.0  2.3  1.8

julia> model = svmtrain(instances[:, 1:2:end], labels[1:2:end]);
ERROR: MethodError: no method matching LIBSVM.SupportVectors(::Int32, ::Array{Int32,1}, ::CategoricalArray{String,1,UInt8,String,CategoricalString{UInt8},Union{}}, ::Array{Float64,2}, ::Array{Int32,1}, ::Array{LIBSVM.SVMNode,1})
Closest candidates are:
  LIBSVM.SupportVectors(::Int32, ::Array{Int32,1}, ::Array{T,1}, ::AbstractArray{U,2}, ::Array{Int32,1}, ::Array{LIBSVM.SVMNode,1}) where {T, U} at /home/fred/.julia/packages/LIBSVM/5Z99T/src/LIBSVM.jl:18
  LIBSVM.SupportVectors(::LIBSVM.SVMModel, ::Any, ::Any) at /home/fred/.julia/packages/LIBSVM/5Z99T/src/LIBSVM.jl:27

Neither of the examples work. I would recommend submitting an issue on GitHub to let them know.