I have 2 models implemented with the same algorithm but with different number of features thus 2 different confusion matrix. I would like to see which predicted items are similar between those 2 and plot the similarity predicted in a Venn diagram.
Answer
data = {"Mod1":[1,0,1,1,0,0,0,1,1,1],"Mod2":[1,0,1,0,1,0,0,1,0,1]}
df = pd.DataFrame(data)
df["Similar"] = np.where(df["Mod1"]==df["Mod2"],1,0)
df.head()
#output
Mod1Mod2Similar
0 1 1 1
1 0 0 1
2 1 1 1
3 1 0 0
4 0 1 0
This should do the job Visualization
# !pip install matplotlib-venn
import matplotlib.pyplot as plt
from matplotlib_venn import venn2
venn2(subsets = (3, 3, 7), set_labels = ('Mod1', 'Mod2'))
plt.show()