I am trying to use LIBSVM.jl with an imbalanced dataset.

Providing weights for each class doesn’t seem to affect the result:

using CSV
using DataFrames
using LIBSVM
df = CSV.read("svm.csv", DataFrame)
X = [df.x1 df.x2 df.x3]'
y = df.y
w = Dict(l => 1 / count(==(l), y) for l in unique(y))
svm = svmtrain(X, y, weights=w)
x1 = range(-0.5,0.5, length=100)
x2 = range(-0.5,0.5, length=100)
x3 = range(-0.5,0.5, length=100)
xs = [collect(x) for x in Iterators.product(x1,x2,x3)]
X̂ = reduce(hcat, xs)
ŷ, _ = svmpredict(svm, X̂)

Can you reproduce the issue? I’ve uploaded the dataset in this gist: