Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Predict the test set using the model
pred_lasso = predict(glmmod, test_sparse, type="response", s=best.lambda)
pred_lasso
# Apply a threshold
new_pred_lasso = ifelse(pred_lasso >= 0.5, 1, 0)
new_pred_lasso = data.frame(new_pred_lasso)
data_lasso = cbind(test[,2], new_pred_lasso)
names(data_lasso) = c("actual", "pred")
xtab_lasso = table(data_lasso$actual, data_lasso$pred)
cm_lasso = confusionMatrix(xtab_lasso)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment