Skip to content

Instantly share code, notes, and snippets.

@mfmakahiya
Created July 30, 2019 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfmakahiya/d176a80a9e618bfe329043d91a2cfb6a to your computer and use it in GitHub Desktop.
Save mfmakahiya/d176a80a9e618bfe329043d91a2cfb6a to your computer and use it in GitHub Desktop.
# Predict the test set using the model
pred_ols = predict(lmmod, test[,3:32], type="response")
pred_ols
# Apply a threshold
new_pred_ols = ifelse(pred_ols >= 0.5, 1, 0)
new_pred_ols = data.frame(new_pred_ols)
data_ols = cbind(test[,2], new_pred_ols)
names(data_ols) = c("actual", "pred")
xtab_ols = table(data_ols$actual, data_ols$pred)
cm_ols = confusionMatrix(xtab_ols)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment