Generating Any Probability Distribution - Transform of Random Variables and Random Number Generators

Поділитися
Вставка
  • Опубліковано 18 чер 2024
  • In this video, we aim to construct random number generators of any probability distribution. We introduce the theory of random variables and transform of random variables in order to construct random number generators of any distribution.
    In this video, the linear congruential generator is introduced.
    en.wikipedia.org/wiki/Linear_...
    However, the much more popular method used today is the Mersenne Twister, which is significantly harder to understand, and it is beyond the scope of this video.
    en.wikipedia.org/wiki/Mersenn...
    Two main techniques used in this video are the probability integral transform and the inverse transform sampling.
    en.wikipedia.org/wiki/Probabi...
    en.wikipedia.org/wiki/Inverse...
    My other video on a more rigorous definition of random variables:
    • Mathematics of Maximiz...
    Chapters:
    00:00 Intro
    02:38 Continuous Distributions
    05:19 General Theory of Random Variables
    07:47 Piecewise Linear Transformation of Random Variables
    10:10 Nonlinear Transformation of Random Variables
    13:06 Geometry of Transformation of Random Variables
    16:24 Linear Congruential Generator
    19:54 Probability Integral Transform and Inverse Transform Sampling
    23:30 Generalized Inverse
    25:06 Transform Between Any Two Distributions
    26:13 Outro
    Music🎵:
    Titanium - Mittsies • Mittsies - Titanium
    Pocket's Lookin' Light - Gareth Coker · Riot Forge • Pocket's Lookin' Light
    Runnin' From Lariette - Gareth Coker · Riot Forge • Runnin' From Lariette
    Machina del Diablo - Stephen Rippy
    Driftveil City Funk Cover - Sean R. Hanson • Pokemon BW - Driftveil...
    Corrections:
    22:56 CDF not PDF

КОМЕНТАРІ • 54

  • @cartatowegs5080
    @cartatowegs5080 2 місяці тому +84

    Guess my sleep is delayed by 26 minutes

    • @yaretziyanez4247
      @yaretziyanez4247 2 місяці тому +2

      1144 me too 😭

    • @tostamista8852
      @tostamista8852 2 місяці тому

      Are you in my room bc its 4 am and im still gona watch this mf

    • @yudoball
      @yudoball 2 місяці тому

      Same

    • @karelnarselo
      @karelnarselo 2 місяці тому

      same here lmao

    • @sanjaux
      @sanjaux 2 місяці тому

      “Adds to watch later”

  • @emanuellandeholm5657
    @emanuellandeholm5657 2 місяці тому +10

    There is a method in image processing called histogram equalization, which is basically taking an image and processing it such that its histogram becomes more uniform. This can be useful for discarding things like shadows from projections when doing feature detection, as well as a way to salvage overexposed images where the histogram is digitally clipped.

  • @neoMushroom
    @neoMushroom 2 місяці тому +5

    wow i finally understand what transformation of rv geometrically means because of this video

  • @jedediahjehoshaphat
    @jedediahjehoshaphat 2 місяці тому +21

    Very insightful, just finished my Advanced Measure Theory paper in university. Wasn't expecting to find applications here, but it surely supplemented my knowledge.

  • @lees4416
    @lees4416 2 місяці тому +6

    Little prince distribution. Sounds good, actually

  • @Jacob.Cornejo
    @Jacob.Cornejo 2 місяці тому +4

    wow this makes integration by substitution so clear

  • @rugbybeef
    @rugbybeef 2 місяці тому +9

  • @MsSlash89
    @MsSlash89 2 місяці тому +5

    The thumbnail tricked me! As an algebraist, the word “Rng” made me believe there was some Algebraic structure underneath; I cam out disappointed, but also happy to have learned something new!

  • @blacklistnr1
    @blacklistnr1 2 місяці тому +5

    2:38 Really solid into! As a side note: one probability approach I'd like to see more often is setting bounds for classes of the input space.
    e.g. the ball reaching a point 500m away from the goal? put some bounds on the initial kick energy + wind resistance + time of flight and you get 0%
    or another class: the ball reaching the top left corner: it needs one of -> which if you diff backwards -> you get of input ranges -> which covers of the input space, so it's now a question of how common/easily do those initial conditions happen
    This way you get to progressively shape the actual distribution, even if you don't know it (as opposed to usual simplify and "it's just a model")
    P.S. I just like visual math videos, I don't do math professionally

  • @intrepiddt
    @intrepiddt 2 місяці тому +3

    Great explanations - thank you!

  • @artmowo2779
    @artmowo2779 2 місяці тому +8

    good illustration, thanks!

  • @blacklistnr1
    @blacklistnr1 2 місяці тому +5

    4:42 "times the indicator function from a to b" So this is how mathematicians do ifs :))

  • @Kapomafioso
    @Kapomafioso Місяць тому

    My favorite formula of random variable transformation is (from any dimension to any dimension)
    f_Y (y1, ..., yn) = integral dx1 ... dxm f_X (x1,...xm) delta(f1(x1,...,xm)) delta(f2(x1,...xm)) ... delta(fn(x1,...xm))
    where f1, ...fn encode the functional relationship between x1, ..., xm and y1, ...yn.
    This can go from 1->1 random variable. Or 2->1. Usually n

  • @fardinahsan2069
    @fardinahsan2069 2 місяці тому +3

    N(100,15), the IQ curve, we meet again

  • @pegrat
    @pegrat 2 місяці тому +4

    Nice hat in the thumbnail

  • @thenationalist8845
    @thenationalist8845 2 місяці тому +4

    Very interesting 🤓

  • @minecrafting_il
    @minecrafting_il 2 місяці тому +3

    That is just what I wanted!

  • @Ivan_1791
    @Ivan_1791 2 місяці тому +2

    How are all your videos so great?

  • @kasiphia
    @kasiphia 2 місяці тому +4

    Interesting.

  • @Vincent-kl9jy
    @Vincent-kl9jy 2 місяці тому +2

    I would love you to talk about Fokker-Planck Equations in a future video

    • @grayjphys
      @grayjphys 2 місяці тому

      my thoughts too, especially if things like this could be useful in solving them

  • @mehdimabed4125
    @mehdimabed4125 2 місяці тому +1

    Very cool video ! Actually, I'm struggling trying to derive a formula for the CDF (or PDF) of the product of two random variables, and explore some sort of algebra of random variable (I know there is a book with this name but I nothing really satisfying for the product of two random variables....) ; by taking the log maybe ?

  • @peeepeeepooopooo
    @peeepeeepooopooo 2 місяці тому +3

    BASED

  • @grayjphys
    @grayjphys 2 місяці тому +1

    I'm wondering if transformations like this could be useful in solving nonlinear odes

  • @frba9053
    @frba9053 2 місяці тому +1

    Good to know

  • @lih3391
    @lih3391 2 місяці тому +2

    ❤ awesome

  • @gmdFrame
    @gmdFrame 2 місяці тому +1

    You're so cool!!!

  • @APaleDot
    @APaleDot 2 місяці тому +2

    9:00
    It should technically be called a "affine" transformation, not "linear"

    • @HaramGuys
      @HaramGuys 2 місяці тому

      All about context.
      Not everything is in linear algebra language, and in the context of probability theory, linear is more common.
      Piecewise linear manifolds, linearization of differential equations, all of these concepts technically are affine maps, but no one calls it affine.

  • @bluekim9771
    @bluekim9771 2 місяці тому

    1. if we know the function Y =g(X) then we can calculate f_Y(y) from f_X(x)
    2. we can generate numbers with algorithm (linear congruential generator) or by natural phenomenon
    so if the x is generated by phenomeon ->
    The distribution of x, which is f_X(x) will be made ->
    but we want the disrtibution be f_Y(y)
    then we have to find function g where Y=g(X)?
    is that how we can make a generator for any probability distribution?
    And why this is realted with inverse integrals?

  • @friggy1899
    @friggy1899 2 місяці тому +1

    Fangraphs sighting!!!!

  • @boium.
    @boium. 2 місяці тому +2

    4:10 it's not an integral from -∞ to the dummy variable, but to x. In this case, t is the dummy variable.

    • @98danielray
      @98danielray 2 місяці тому

      dummy variable as in the argument of the function. that was pretty understandable.

  • @abdulrhmanaun
    @abdulrhmanaun Місяць тому

    ❤❤

  • @johncorn7905
    @johncorn7905 2 місяці тому +9

    Ok but what is the probability i can get a gf

    • @speye
      @speye 2 місяці тому +4

      non-zero 😊

    • @montadermajed9456
      @montadermajed9456 2 місяці тому

      Mathematically: 50%

    • @johncorn7905
      @johncorn7905 2 місяці тому

      @@montadermajed9456 what makes you say that

    • @johncorn7905
      @johncorn7905 2 місяці тому

      @@speye i appreciate the confidence

    • @montadermajed9456
      @montadermajed9456 2 місяці тому

      @@johncorn7905 i have absolutely no idea

  • @user-dl8fl3hv9d
    @user-dl8fl3hv9d 2 місяці тому +1

    why did you make the thumbnail a hat

    • @HaramGuys
      @HaramGuys 2 місяці тому +3

      "I showed the grown ups my masterpiece, and I asked them if my drawing scared them. They answered:'why be scared of a hat?' My drawing was not a picture of a hat. It was a picture of a boa constrictor digesting an elephant." - Antoine de Saint-Exupéry, The Little Prince

    • @MouhibBayounes
      @MouhibBayounes 2 місяці тому +1

      Great story especially if you know french. ​@@HaramGuys

  • @zhonyss
    @zhonyss 2 місяці тому +1

    I think i'am stupid

  • @MatthisDayer
    @MatthisDayer 2 місяці тому +1

    mersenne twister kinda sucks

    • @MatthisDayer
      @MatthisDayer 2 місяці тому +1

      it's needlessly overcomplicated
      is not random at all on the lower bits
      can get stuck producing only zeroes for millions of iterations
      is hard to seed properly
      it needs so much memory that it doesn't fit on registers
      it's kinda slow
      adds unnecessary binary size in an application using it
      you really don't need equal distribution in 623 dimensions, 4 is enough for any computation that lasts less than a human lifetime
      look for xoroshiro128 or xoshiro256 for much better alternatives.