JuliaML / LIBLINEAR.jl

LIBLINEAR bindings for Julia
Other
12 stars 10 forks source link

prediction crashes with illegal index #37

Open pevnak opened 6 months ago

pevnak commented 6 months ago

Hi All,

I am having an issue with regression using liblinear. It crashes with illegal index

MWE is as follows:

using LIBLINEAR
x = randn(200,10000);
y = randn(10000);
model = linear_train(y,x; solver_type = LIBLINEAR.L2R_L2LOSS_SVR);
linear_predict(model, x)

which outputs error

ERROR: BoundsError: attempt to access 10000-element Vector{Float64} at index [-791]
Stacktrace:
 [1] getindex
   @ ./essentials.jl:13 [inlined]
 [2] linear_predict(model::LinearModel{Float64}, instances::Matrix{Float64}; probability_estimates::Bool, verbose::Bool)
   @ LIBLINEAR ~/.julia/packages/LIBLINEAR/Gc5Us/src/LIBLINEAR.jl:313
 [3] linear_predict(model::LinearModel{Float64}, instances::Matrix{Float64})
   @ LIBLINEAR ~/.julia/packages/LIBLINEAR/Gc5Us/src/LIBLINEAR.jl:261
 [4] top-level scope
   @ REPL[6]:1

I am using AMD processor. the version of julia is

julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 64 × AMD EPYC 73F3 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
  Threads: 1 on 64 virtual cores
Environment:
  LD_LIBRARY_PATH = /mnt/appl/software/Julia/1.10.0-linux-x86_64/lib

and the version of LIBLINEAR is 0.7.0

Thanks for help

barucden commented 6 months ago

Thanks for the report. I can reproduce it: regression models have not been supported. I proposed an implementation in #38 but there's a problem. See the PR's message.