Skip to content

Instantly share code, notes, and snippets.

@rvndbalaji
Created July 24, 2018 14:41
Show Gist options
  • Save rvndbalaji/58e306cb329b8295b8d0952c4c0cbb9c to your computer and use it in GitHub Desktop.
Save rvndbalaji/58e306cb329b8295b8d0952c4c0cbb9c to your computer and use it in GitHub Desktop.
model = glm(Occupancy~.,train,family= binomial(link = "logit")
pred = predict(model,test[,-6])
#All values with probability less than 0.7 are considered occupied.
pred[pred>=0.7] = 1
pred[pred<0.7] = 0
pred = factor(pred)
plot(pred)
#Calculate R-sqaured value
perf(pred,test$Occupancy)
#Output
#[1] 0.9386446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment