Visualization of Hypocrite Classifiers

Learn how to visualize the hypocrite classifiers.

If you run the hypocrite classifier a few times, you may get a feeling for its performance. But let’s create a visualization of it.

The following code runs the hypocrite classifier for different values of weight. The range of allowed weights is between −1 and 1. We divide this range into 40 (cnt_steps) steps in line 5. We create lists of the indices (steps=[0, 1, ..., 38, 39]) in line 8, and of the weights at every step (weights=[−1, −0.95, ... 0.9, 0.95, 1.0]) in lines 11-14.

We run the hypocrite classifier for every step from lines 17-23 and put the results into l_predictions in line 17. Based on the predictions and the actual results, we calculate the confusion matrix for every step in line 27, and store them in l_cm in line 26.

Get hands-on with 1400+ tech skills courses.