Questions tagged [probability-distribution]

A probability distribution is a function that defines the probability of occurrences of the different possible values of a variable.

What is it?

A probability distribution is a function that defines the probability of occurrences of the different possible values of a variable.

Typical examples of distributions are the uniform distribution in which each value has the same probability, the normal distribution in which the values around the avergage have a higher probability and the extreme values the lowest probability.

See also

315 questions
28
votes
5 answers

What does log_prob do?

In some (e.g. machine learning) libraries, we can find log_prob function. What does it do and how is it different from taking just regular log? For example, what is the purpose of this code: dist = Normal(mean, std) sample = dist.sample() logprob =…
cerebrou
  • 5,353
  • 15
  • 48
  • 80
14
votes
2 answers

How to convert log probability into simple probability between 0 and 1 values using python

I am using Gaussian mixture model for speaker identification. I use this code to predict the speaker for each voice clip. for path in file_paths: path = path.strip() print (path) sr,audio = read(source + path) vector =…
Sandeep
  • 369
  • 1
  • 5
  • 16
13
votes
2 answers

How to generate random numbers with predefined probability distribution?

I would like to implement a function in python (using numpy) that takes a mathematical function (for ex. p(x) = e^(-x) like below) as input and generates random numbers, that are distributed according to that mathematical-function's probability…
10
votes
3 answers

Pass shape tuple to Numpy `random.rand`

I am using np.random.rand to create a matrix/tensor of the desired shape. However, this shape argument (generated in runtime) is a tuple such as: (2, 3, 4). How can we use this shape in np.random.rand? Doing np.random.rand(shape) doesn't work and…
Nipun Batra
  • 11,007
  • 11
  • 52
  • 77
9
votes
1 answer

How to get document_topics distribution of all of the document in gensim LDA?

I'm new to python and I need to construct a LDA project. After doing some preprocessing step, here is my code: dictionary = Dictionary(docs) corpus = [dictionary.doc2bow(doc) for doc in docs] from gensim.models import LdaModel num_topics =…
7
votes
1 answer

Understanding log_prob for Normal distribution in pytorch

I'm currently trying to solve Pendulum-v0 from the openAi gym environment which has a continuous action space. As a result, I need to use a Normal Distribution to sample my actions. What I don't understand is the dimension of the log_prob when using…
7
votes
1 answer

How dnorm works?

I am very new to Statistics and R. Maybe this is a very trivial question, but I don't really understand how this works. Suppose I use dnorm(5, 0, 2.5). What does that mean? I saw some resources where they told that this function computes the height…
lu5er
  • 3,229
  • 2
  • 29
  • 50
6
votes
3 answers

How to find a best fit distribution function for a list of data?

I am aware of many probabilistic functions builted-in Python, with the random module. I'd like to know if, given a list of floats, it would be possible to find the distribution equation that best fits the list? I don't know if numpy does it, but…
Gabriel L. Oliveira
  • 3,922
  • 6
  • 31
  • 40
6
votes
3 answers

How to draw distribution plot for discrete variables in seaborn

When I draw displot for discrete variables, the distribution might not be as what I think. For example. We can find that there are crevices in the barplot so that the curve in kdeplot is "lower" in y axis. In my work, it was even worse: I think it…
Zealseeker
  • 823
  • 1
  • 7
  • 23
5
votes
1 answer

How to generate random integer that are random "enough"?

I'm trying to solve the 280th problem in Project Euler, and for this I have written the following simulation; #include #include #include #include /* Directions 1 2 3 4 */ int grid[5][5] =…
5
votes
2 answers

Generate lognormal random numbers in MATLAB?

I'm trying to generate 10000 random numbers taken from a log normal distribution who's associated normal distribution has mean = 0.3 and std. dev. = 0.05 in MATLAB. I'm using the built in lognrnd function. My attempt is to do: R =…
Zack
  • 713
  • 2
  • 8
  • 21
4
votes
2 answers

How to find the probability from a normal probability density function in python?

Basically, I have plotted a normal curve by using the values of mean and standard deviation. The y-axis gives the probability density. How do I find the probability at a certain value "x" on the x-axis? Is there any Python function for it or how do…
4
votes
2 answers

Discrete probability distribution plot with given values

First of all, I could not draw the graphics myself. Because, unfortunately I have no computer and mathematical software.. I do not know how to use these softwares. I need to create a discrete probabilistic distribution plot of the following…
4
votes
1 answer

How to calibrate the thresholds of neural network output layer in multiclass classification task?

Assume we have a multi-class classification task with 3 classes: {Cheesecake, Ice Cream, Apple Pie} Given that we have a trained neural network that can classify which of the three desserts a random chef would prefer. Also, assume that the output…
3
votes
3 answers

rbinom; How to ensure at least one "success" is returned?

Is there a way to ensure rbinom() returns at least one success? I am running rbinom() with a really low probability: rbinom(5015, size=2, prob= 1/5000)) Since it is a probability distribution, there is a chance all 0s are returned. Is there a way…
1
2 3
20 21