I am using the glmnet packageto perform logistic regression on a dataset.
The x.train and x.test data is a simple dataset of numbers.
y.train and y.test is data with categories "Coffee" and "Tea".
Basically the prediction needs to be either "Coffee" or "Tea"
My first question is that do I need to factor the y datasets? I haven't factored them yet.
Secondly, and mainly, this is the problem:
My code is as follows:
lr.fit<-cv.glmnet(x.train, y.train, type.measure="deviance", family = "binomial") lr.predicted<-predict(lr.fit, s=c("lambda.1se", "lambda.min"), newx=x.test)
However, when I see the output of the lr.predicted variable, I see a list of numbers. I am asking this question because, I was actually expecting predictions like "Coffee", "Tea", "Coffee", "Coffee", "Tea", ........... and so on.
Kindly guide in the right direction. I am a beginner with R and machine learning, so apologies for being an amateur.