normal-distribution

how to compute norm.ppf() in tensorflow/Keras?

how to compute norm.ppf() in tensorflow/Keras? Question: I want to use inverse of cumulative distribution function (cdf) which can be done using norm.ppf() from scipy https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html#scipy.stats.norm inside a layer of a tf/keras model architecture. Asked By: Tanzin Farhat || Source Answers: As per documentation, tfp.distribution.Normal does have a method for calculating ppf (percent point function). It’s …

Total answers: 1

How to make a normal distribution graph from data frame in Python?

How to make a normal distribution graph from data frame in Python? Question: my question is how to make a normal distribution graph from data frame in Python. I can find many information to make such a graph from random numbers, but I don’t know how to make it from data frame. First, I generated …

Total answers: 2

Why does numpy.random.normal gives some negative value in the ndarray?

Why does numpy.random.normal gives some negative value in the ndarray? Question: I know that the normal distribution is always greater than 0 for any chosen value of the mean and the standard deviation. >> np.random.normal(scale=0.3, size=x.shape) [ 0.15038925 -0.34161875 -0.07159422 0.41803414 0.39900799 0.10714512 0.5770597 -0.16351734 0.00962916 0.03901677] Here the mean is 0.0 and the standard …

Total answers: 3

How to normalize a non-normal distribution?

How to normalize a non-normal distribution? Question: I have the above distribution with a mean of -0.02, standard deviation of 0.09 and with a sample size of 13905. I am just not sure why the distribution is is left-skewed given the large sample size. From bin [-2.0 to -0.5], there are only 10 sample count/outliers …

Total answers: 2

Why does scipy.norm.pdf sometimes give PDF > 1? How to correct it?

Why does scipy.norm.pdf sometimes give PDF > 1? How to correct it? Question: Given mean and variance of a Gaussian (normal) random variable, I would like to compute its probability density function (PDF). I referred this post: Calculate probability in normal distribution given mean, std in Python, Also the scipy docs: scipy.stats.norm But when I …

Total answers: 3

Vectorizing code to calculate (squared) Mahalanobis Distiance

Vectorizing code to calculate (squared) Mahalanobis Distiance Question: EDIT 2: this post seems to have been moved from CrossValidated to StackOverflow due to it being mostly about programming, but that means by fancy MathJax doesn’t work anymore. Hopefully this is still readable. Say I want to to calculate the squared Mahalanobis distance between two vectors …

Total answers: 3

What is the difference between random.normalvariate() and random.gauss() in python?

What is the difference between random.normalvariate() and random.gauss() in python? Question: What is the difference between random.normalvariate() and random.gauss()? They take the same parameters and return the same value, performing essentially the same function. I understand from a previous answer that random.gauss() is not thread safe, but what does this mean in this context? Why …

Total answers: 4

How to calculate the inverse of the normal cumulative distribution function in python?

How to calculate the inverse of the normal cumulative distribution function in python? Question: How do I calculate the inverse of the cumulative distribution function (CDF) of the normal distribution in Python? Which library should I use? Possibly scipy? Asked By: Yueyoum || Source Answers: NORMSINV (mentioned in a comment) is the inverse of the …

Total answers: 3