Giter VIP home page Giter VIP logo

distribution-is-all-you-need's Introduction

distribution-is-all-you-need

distribution-is-all-you-need is the basic distribution probability tutorial for most common distribution focused on Deep learning using python library.

Overview of distribution probability

distribution probabilities and features

  1. Uniform distribution(continuous), code
    • Uniform distribution has same probaility value on [a, b], easy probability.

  1. Bernoulli distribution(discrete), code
    • Bernoulli distribution is not considered about prior probability P(X). Therefore, if we optimize to the maximum likelihood, we will be vulnerable to overfitting.
    • We use binary cross entropy to classify binary classification. It has same form like taking a negative log of the bernoulli distribution.

  1. Binomial distribution(discrete), code
    • Binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments.
    • Binomial distribution is distribution considered prior probaility by specifying the number to be picked in advance.

  1. Multi-Bernoulli distribution, Categorical distribution(discrete), code
    • Multi-bernoulli called categorical distribution, is a probability expanded more than 2.
    • cross entopy has same form like taking a negative log of the Multi-Bernoulli distribution.

  1. Multinomial distribution(discrete), code
    • The multinomial distribution has the same relationship with the categorical distribution as the relationship between Bernoull and Binomial.

  1. Beta distribution(continuous), code
    • Beta distribution is conjugate to the binomial and Bernoulli distributions.
    • Using conjucation, we can get the posterior distribution more easily using the prior distribution we know.
    • Uniform distiribution is same when beta distribution met special case(alpha=1, beta=1).

  1. Dirichlet distribution(continuous), code
    • Dirichlet distribution is conjugate to the MultiNomial distributions.
    • If k=2, it will be Beta distribution.

  1. Gamma distribution(continuous), code
    • Gamma distribution will be beta distribution, if Gamma(a,1) / Gamma(a,1) + Gamma(b,1) is same with Beta(a,b).
    • The exponential distribution and chi-squared distribution are special cases of the gamma distribution.

  1. Exponential distribution(continuous), code
    • Exponential distribution is special cases of the gamma distribution when alpha is 1.

  1. Gaussian distribution(continuous), code
    • Gaussian distribution is a very common continuous probability distribution

  1. Normal distribution(continuous), code
    • Normal distribution is standarzed Gaussian distribution, it has 0 mean and 1 std.

  1. Chi-squared distribution(continuous), code
    • Chi-square distribution with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables.
    • Chi-square distribution is special case of Beta distribution

  1. Student-t distribution(continuous), code
    • The t-distribution is symmetric and bell-shaped, like the normal distribution, but has heavier tails, meaning that it is more prone to producing values that fall far from its mean.

Author

If you would like to see the details about relationship of distribution probability, please refer to this.

  • Tae Hwan Jung @graykode, Kyung Hee Univ CE(Undergraduate).
  • Author Email : [email protected]
  • If you leave the source, you can use it freely.

distribution-is-all-you-need's People

Contributors

graykode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

distribution-is-all-you-need's Issues

calculate expectation and variance

The output mu, and sigma is the mean and std of the y, not the expectation(mean) and variance of the distribution, which may be confusing.
I suggest return
mu = np.sum(x * y) * step
sigma = np.sum(x * x * y) * step - mu * mu
where step is the step option in np.arange
(eg: x = np.arange(0, 1, 0.001, dtype=np.float), then step is 0.001)

For example in beta ditribution, E(x) = a/(a+b) and Var(x) = ab/((a+b)^2(a+b+1)).
E(x)
Var(x)

I suppose mu should be E(x) and sigma should be Var(x). And I get result like this:
beta

I also get gamma distribution result like this:
gamma

formatting issue in exponential.py

plt.plot(x, y, label=r'$\mu=%.2f,\ \sigma=%.2f,'
r'\ \lambda=%d$' % (u, s, lamb))
lambda should be lambda=%.2f otherwise it will only display integers.

Added ppt Attachment

Added power point attachment to make modifications and deletions free :D
As long as you leave the source, you are free to cite and edit it.

License

poisson distribution

  • poisson distribution is the limit of binomial distribution

  • poisson distribution and gamma distribution are conjugate distributions

  • poisson distribution is also useful in machine learning such as Poisson Regression

  • It may be helpful if you could add it in the figure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.