Skip to content

Instantly share code, notes, and snippets.

@karan19100
Created July 18, 2020 21:04
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 karan19100/fdfca971076fdc465de3b7007b731487 to your computer and use it in GitHub Desktop.
Save karan19100/fdfca971076fdc465de3b7007b731487 to your computer and use it in GitHub Desktop.
step3_predicting_linear_model_by_karanshah
act_pred <- data.frame(cbind(actuals=testData$HEMATOCRIT, predicteds=predict)) # actuals_predicteds
cor(act_pred) # correlation_accuracy
head(act_pred, n=10)
# Actual values and predicted ones seem very close to each other. A good metric to see how much they are close is the min-max accuracy, that considers the average between the minimum and the maximum prediction.
min_max <- mean(apply(act_pred, 1, min) / apply(act_pred, 1, max))
print(min_max) # show the result
mape <- mean(abs((act_pred$predicteds - act_pred$actuals))/act_pred$actuals)
print(mape) # show the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment