contains errors in its code.
All of the confusionMatrix functions are given their arguments in the wrong order:
confusionMatrix(testSet$Loan_Status,testSet$pred_lr) should actually be:
confusionMatrix(testSet$pred_lr, testSet$Loan_Status) with predictions first, and reference data second. In the order presented, the model’s prediction is treated as the ‘reference’ and the reference data is treated as the prediction. This results in invalid output, which you can verify by observing that the No-Information Rate changes between different outputs. The NIR should remain constant as it is the proportion of the largest outcome group in the reference data.
The code in this blog post, though old, should be corrected.