# How to manually make prediction after training using LIBSVM

**URL:** <https://discourse.julialang.org/t/how-to-manually-make-prediction-after-training-using-libsvm/70669>\
**Category:** Machine Learning\
**Tags:** optimization\
**Created:** [October 30, 2021, 7:28pm UTC](https://discourse.julialang.org/t/how-to-manually-make-prediction-after-training-using-libsvm/70669 "2021-10-30T19:28:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaidy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaidy/32/20310_2.png) [@Jaidy](https://discourse.julialang.org/u/Jaidy)\
**Post date:** [October 30, 2021, 7:28pm UTC](https://discourse.julialang.org/t/how-to-manually-make-prediction-after-training-using-libsvm/70669/1 "2021-10-30T19:28:16Z")

</div>

Hi all,  
I have a dataset X\_train, y\_train that I feed to LIBSVM and get a model using the following code:

model = svmtrain(X\_train’, y\_train, kernel = LIBSVM.Kernel.Linear)

My question is how to make predictions manually, i.e. something like  
sgn(w’ \* x + b) for a test point x?

Going through the documents, I see that b = model.rho (or the negative of that), and w = model.SVs.X \* model.coefs (or the negative of it). However when I use

svmpredict(model, x)

it gives me a different value than when I use

sgn(w’ \* x + b)

I have tried all combinations of +/- w, and +/- b without luck. Can some one help please?
