Created
July 30, 2019 07:15
-
-
Save mfmakahiya/ed14cba5bf11a4ec6f43c1256d281786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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