I am using LIBSVM.jl to train a SVM classification model. Apparently the model in my code below trains successfully. However, after running it a few times it crashes (after about 10 repetitions). It shows a segmentation fault message. Please, how could I fix it?
using Random;using LIBSVM
Random.seed!(1)
nSamples = 200;nFeatures = 150
x = rand(nFeatures,nSamples)
y = ceil.(Int,10*x[end,:])
for repeat = 1:500
C = repeat + 0.0
model = svmtrain(x, y; kernel=LIBSVM.Kernel.Linear, cost=C);
y_hat, decision_values = svmpredict(model, x);
@info(" $repeat: C = $C correclty classified $(sum(y_hat.==y))")
end
I am using LIBSVM v0.4.0, Atom v0.12.15, and macos. Many thanks!
signal (11): Segmentation fault: 11
in expression starting at untitled-272beec863a1ee69770658e2a832c62a:9
_ZN6Kernel3dotEPK8svm_nodeS2_ at /Users/rio/.julia/packages/LIBSVM/5Z99T/deps/libsvm.so.2 (unknown line)
_ZN6Kernel10k_functionEPK8svm_nodeS2_RK13svm_parameter at /Users/rio/.julia/packages/LIBSVM/5Z99T/deps/libsvm.so.2 (unknown line)
svm_predict_values at /Users/rio/.julia/packages/LIBSVM/5Z99T/deps/libsvm.so.2 (unknown line)
#svmpredict#4 at /Users/rio/.julia/packages/LIBSVM/5Z99T/src/LIBSVM.jl:435
svmpredict at /Users/rio/.julia/packages/LIBSVM/5Z99T/src/LIBSVM.jl:402
top-level scope at ./untitled-272beec863a1ee69770658e2a832c62a:12
jl_toplevel_eval_flex at /Users/julia/buildbot/worker/package_macos64/build/src/toplevel.c:808
jl_parse_eval_all at /Users/julia/buildbot/worker/package_macos64/build/src/ast.c:872
include_string at ./loading.jl:1080
#220 at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:174
withpath at /Users/rio/.julia/packages/CodeTools/kosGY/src/utils.jl:30
withpath at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:9
#219 at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:171 [inlined]
with_logstate at ./logging.jl:398
with_logger at ./logging.jl:505 [inlined]
#218 at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:170 [inlined]
hideprompt at /Users/rio/.julia/packages/Atom/8MnXm/src/repl.jl:127
macro expansion at /Users/rio/.julia/packages/Media/ItEPc/src/dynamic.jl:24 [inlined]
evalall at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:160
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1700 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:643
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:657 [inlined]
jl_f__apply_latest at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:693
#invokelatest#1 at ./essentials.jl:712
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1700 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:643
invokelatest at ./essentials.jl:711
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1700 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:643
macro expansion at /Users/rio/.julia/packages/Atom/8MnXm/src/eval.jl:41 [inlined]
#188 at ./task.jl:358
unknown function (ip: 0x11cd85dcc)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1700 [inlined]
start_task at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:687
Allocations: 39608856 (Pool: 39597378; Big: 11478); GC: 42