I have two lists. One is target and another is predicted values in a binary classification. The target is always zero. And I have to plot the results of the prediction against target in such a way, that when I get a value of 1 in prediction, then i need to plot it with a black dot on a square plane. The plane should contain white area (which means it has both target and prediction as zero) and black dots (in case of target zero but prediction as one). How can I achieve this? Thanks for the help in advance. Something like this :
Well since the points would be shown when the target is zero and the predicted value is $1$, then all the plots would be located in the same place and would overlap. So I think you can give a random value for these points and then plot them.
If the white space is the density of $(0,0)$ values and depicts the ratio of $(0,0)$ points, then you should change the size of the figure or the points. Do you want to do so?
import numpy as np import matplotlib.pyplot as plt predicted = list([random.choice([0,1]) for i in range(100)]) target = np.zeros(100) #adding a random value to the predicted and random values randomed_predicted = [random.random() for i in range(predicted.count(1))] randomed_target = [random.random() for i in range(len(randomed_predicted))] plt.figure(figsize=(5,5)) plt.gca().axes.get_yaxis().set_visible(False) #hiding the yaxis labels plt.gca().axes.get_xaxis().set_visible(False) #hiding the xaxis labels plt.scatter(randomed_target, randomed_predicted, c="black")