I am using the mgcv package in R. I trained a GAM, for a binary classification task, so I used binomial as a family. But when I run the predict method on the Test Set, I don't get 0 or 1 output, but numeric values. Why does mgcv provide these outputs? How do I get binary outputs?
The predictions are on the scale of the link function, in the form of log odds. Even if you changes the predictions to be on the response scale, the response scale is in terms of probability, bounded between 0 and 1. This is what the actual model you fitted, the expected probability of the event. This is unlike other class prediction tools like trees, which typically give back a predicted class (although in the case of trees, this class is often majority vote, so it includes some form of decision rule to output the 0 and 1 class).
You will need to come up with a decision rule to convert the probability of the event/feature into a binary prediction of either 0 or 1.