I have been trying to learn logistic regression in python. I want a way to evaluate my model via a confusion matrix. Since I'm new to python, I don't know how to do it. A google search showed me how to create one but I am getting results to just create the matrix. I want more statistical inferences. In R, the "caret" package has a function called confusionMatrix which provides a lot of useful information. For Example: Code:
library(caret)
x <- c(1,0,1,1,0,1,1,0,0,1)
y <- c(0,1,1,1,0,1,0,0,0,0)
x <- as.factor(x)
y <- as.factor(y)
confusionMatrix(x,y)
Output:
Confusion Matrix and Statistics
Reference
Prediction 0 1
0 3 1
1 3 3
Accuracy : 0.6
95% CI : (0.2624, 0.8784)
No Information Rate : 0.6
P-Value [Acc > NIR] : 0.6331
Kappa : 0.2308
Mcnemar's Test P-Value : 0.6171
Sensitivity : 0.500
Specificity : 0.750
Pos Pred Value : 0.750
Neg Pred Value : 0.500
Prevalence : 0.600
Detection Rate : 0.300
Detection Prevalence : 0.400
Balanced Accuracy : 0.625
'Positive' Class : 0
Is there a way to create a similar output in python? Also, I need a way to plot the ROC curve. Please help me I'm new to python.