libfgs may fail to converge. So, we are here using the liblinear solver.
We are fitting the model with the training set. And then, we calculate the predicted values of y for the test set.
report = classification_report(y_test, y_pred) print(report)
After that, we are using the classification_report() function to generate the classification report. This function takes the expected and true values of y as arguments.
The output of the above program will be: precision recall f1-score support 0.0 0.79 0.89 0.84 123 1.0 0.75 0.58 0.66 69 accuracy 0.78 192 macro avg 0.77 0.74 0.75 192 weighted avg 0.78 0.78 0.77 192
As per this classification report, the target variable is 0.0 for 123 occurrences. And it is 1.0 for 69 occurrences. The precision, recall, f1-score, and accuracy are given as we discussed.
Please note that here macro avg. specifies the metrics for each label and finds the unweighted mean. And weighted avg., on the other hand, finds the average weighted by support or the number of occurrences of each label.






0 Comments