Submitted by ikashifkhan t3_xuz7rm in MachineLearning

Hello folks,

I am an absolute novice in data science. I came up with this first example "distplot" in the seaborn module. The list [0, 1, 2, 3, 4, 5] which I provided to distplot, I just don't understand the output it gets me on both X-Axis and Y-Axis.

The X-Axis gets me the values like -4 -2 0 2 4 6 8 which I have no idea what it demonstrates.

The example with the output link below shows you both the X and Y-Axis graphical demonstration.

Example

import matplotlib.pyplot as plt 
import seaborn as sns 

sns.distplot([0, 1, 2, 3, 4, 5])  
plt.show()  

Output: W3Schools Tryit Editor

0

Comments

You must log in or register to comment.

asdfwaevc t1_iqyb3gi wrote

This subreddit is mostly for sharing/discussing ML research. For questions like that, try posting on stackoverflow, or possibly r/learnmachinelearning (though it's not really an ML question either).

I'd encourage you to try and figure these things out through trial and error (changing the arguments and seeing what happens). And before that, reading the documentation (which says that's a deprecated function).

2

ikashifkhan OP t1_iqybkl1 wrote

So sorry about it. Thank you for your suggestion!!

1

asdfwaevc t1_iqydtns wrote

Best of luck! PS, matplotlib/seaborn can be pretty confusing, you're not crazy for getting tripped up with them.

2

ikashifkhan OP t1_iqyfmso wrote

I was just focused on Python until now. Just recently, I decided to learn data science and my ultimate goal is ML/AI. I do agree it's a hard nut to crack as most people say but I am having a burning passion for these emerging technologies 🙂.

0

sonny_plankton3141 t1_ir2bra8 wrote

Hi! dist plot shows you a probability density function of the values you’ve provided.

The highest point of the curve is the mean of 2.5. The blue box signals the standard deviation of -2.5 and 2.5.

It basically tells you the probability of getting a certain value as long as the population is normally distributed. Getting -4 has a very very low chance for example.

You better use sns.displot( … …, kind=‘kde’) tho.

Hope this helps. Happy learning

1

ikashifkhan OP t1_ir7hl8k wrote

You're so helpful, you made me understand the whole topic so beautifully.

Thanks a bunch!!

1

ikashifkhan OP t1_ir7tz5q wrote

I have one more question, I provided the values from 0 to 5 but it's providing me negative values as well, why is it so?

1

sonny_plankton3141 t1_iujrxl1 wrote

Sorry for replying so late. Been on vacation.

Displot assumes a Normal Distribution, which can be negative as well. If you provide more data to displot e. g. Data = [0 1 2 2 3 3 3 3 4 4 5 5] it should shift to the right.

You may also find this introduction on Normal Distribution helpful

https://www.mathsisfun.com/data/standard-normal-distribution.html

Feel free to reach out, I’m happy to help

Best regards from Germany. :)

1

ikashifkhan OP t1_iujtcf8 wrote

Greetings! I hope you have enjoyed your vacation to the fullest🤠. I just needed to learn and then strengthen my statistical concepts, and yes I did 😊🙂. Thanks for taking out time to guide me.

1