C3_W1_Anomaly_Detection probability calculation

Hello,

I was trying to plot the first feature against it’s probability just an exercise to see if I will get a smooth Gaussian bell curve. However, the picture shows what i got. I am not sure why there are extra lines. It seems to be something related to the Python plot function i used.

Thanks

Hey @Mo_Okasha,

You might want to use a scatter plot instead, that should give you a better visualization:

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html

You can already see that most of the points do form a bell curve with only a few points on both tails.

Hope this helps,

Mohamed

Exactly as Mohamed suggested, @Mo_Okasha you are seeing the lines crossing each other because plt.plot plots the data in whatever order presented to it, so you might either do a scatter plot (which won’t connect the data so you won’t see the lines at all), or you might sort your data before giving it to plt.plot.

Raymond

1 Like

@rmwkwok @mrafat thanks for reply. I had already tried the Scatter function. I was just wondering why the lines appearing that way with the plot function. Raymond answered clarified it for me. Thanks again.