(I have a very similar setup to this post here.)
ytrain
and Xtrain
are my training data where ytrain
is a column of 1's and 0's and Xtrain
is a matrix of explanatory variables. ytrain
and Xtrain
have the same number of rows and Xtrain
does not include a column of 1's.
After doing:
b = glmfit(Xtrain,ytrain,'binomial')
I do
ytestfit = glmval(b,Xtest,'logit')
Here Xtest
has the same number of columns as Xtrain
. I was expecting a column of 1's and 0's for ytestfit
(as both ytrain
and ytest
are columns of 1's and 0's), but instead I got a column of real numbers between 0 and 1. It seems they are probabilities so, my guess is that if I want to, I can add an extra step:
ytestfit = double(ytestfit >= 0.5)
Are things above behaving as normal? Is there a way to get the binary predictions directly without the additional step above?
I use MATLAB 2019b.