How to manually make prediction after training using LIBSVM

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?