1. Home
  2. Explore
  3. Statistics
  4. Learning Bayesian Statistics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Learning Bayesian Statistics

Transcript

Okay Hello everyone my name is Ali and  in this video I would like to talk about   my journey in learning and  relearning Bayesian Statistics so the outline for this video is um i would first  talk about my first exposure to bayesian methods   or bayesian statistics then afterwards i will  talk about the relearning parts of the um journey   so how to update my priors and then afterwards  i will talk about the key takeaways from stock so previously i did my masters in artificial  intelligence at the university of edinburgh in   2015 and this will be the beginning of the  my journey in learning bayesian statistics

so i believe it was during my master's that i had  my first exposure to bayesian statistics so if you   see the number here is the average total mark of  the machine learning and the pattern recognition   course uh for 2014 -- 2015 so basically a  year before my enrollment at the university it is not a good sign for certain and it was said  that half of the students enrolled in this class   did not pass it in the previous year so maybe  I should have dropped the course and opted for   something easier but right now I have to say that  i'm grateful that I did take the course back then

so if you want a taste of the course you can  find it online um this is the latest version   of the machine learning and partitioning  recognition I believe Dr Ian Murray the   main lecturer for the course is uploading the  videos for this year's course and just google mlpr   informatics edinburgh and you will see this page  um but don't get me wrong even though the course

is notorious for the bad marks they are both a  great lecturer back then the course was taught by   ian murray and chris williams so ian's phd thesis  is in advances in markov chain monte carlo methods   he also got the second place in a kaggle  competition about dark matter with bayesian   methods and on the other hand chris is known  for gaussian processes for machine learning   which was written with his colleague carl  edward rasmussen and he is also well known for

machine learning research as well so i believe  he is one of the most respected researchers in   the field he is the director of research at  the school of informatics as well and he is   an alan is a touring fellow so i found out later  that both of them did their undergrad in physics   at the university of cambridge so  deriving formulas in the classroom   i don't walk in the path for them but on the  other hand there's me not understanding not

understanding what they were trying to say  uh during the class so i was really confused   i didn't know what they were talking  about so for a bit of background i did my   undergrad in computer science where mostly deal  with computer programs and some discrete maths   just a little bit of maths after several  years so after several years of not using   calculus and statistics bayesian statistics can  be hard to swallow especially during my masters so to give you an example this is an  example slide from the course back then

and i didn't have the slightest idea of what  these figures mean so what is the likelihood,   how is that different from probability, what are  priors were posteriors, how to read this figure   they were like ciphers to me so eventually i  just copied them to my notebook hoping that   I would learn something from this figure  but you'll see what happens later on so uh another example uh from the course is that  this slide uh the figure is also taken from the   famous kevin murphy's book on machine learning uh  you can find it online and it is one of the main   books for machine learning courses especially  when you are covering bayesian machine learning

and for sure i did not understand uh the  figure as well like the previous one but one   thing that i know for certain is that they are  beautiful yes uh with so many colors and curves   but still i have no idea what i'm doing that's  just about it i know that they are beautiful but i have no idea literally, literally have  no idea what i'm doing during the course so like this example uh so look at  this figure it's pretty isn't it

i just like the the many lines that you  have to draw when you are doing bayesian   linear regression so in fact i believe  that this is one of the main motivations   of why i study vision methods further later  on maybe not a very good motivation in the   first place but you still at least need one  right so yeah that is the motivation for me um and afterwards the course continued with  explanations of sampling methods the monte   carlo methods the rejection sampling, important  sampling and the mcmc markov chain monte carlo

and yeah this part still confuses me uh back then  so well i know this averaging over samples for   sure the the expected value uh over samples  but that's just about it the ergodicity,   markov chains, hamiltonian monte carlo and all  other technical terms seem alien to me back then then things get even more obscure for  me as we dive into variational inference   the energy-based model, the concept of free  energy and the other concepts bought from   statistical physics were quite confusing for me  it was hard to to understand this stuff back then and also this thing introduction  to Gaussian processes   uh to this day i don't think i fully  understand gaussian processes even now

but i believe that there's something  important in this field in this material   that i would find useful later on so for those of  you who have already mastered this then congrats   hopefully i'll be there someday um so kind of to  sum up uh the whole experience at the beginning   of the semester when i heard about bayesian  i would always associate it with naive Bayes   but as you may know, this is not the case at  all so for those of you who don't know it yet there's even a model called bayesian naive  bayes so naive bayes, in this case, it's not   the Bayesian framework we usually talk about  when we are talking about bayesian statistics.

So after countless hours of studying  and isolating myself in my flat   and learning from these books and  what trying to derive equations finally, the exam became and I was really hoping  that I have prepared myself well for the exam   for sure but I still did not do well in  mlpr i certainly believe that this gif   was me during mlpr exam I kept flipping the exam  papers trying to find questions that I can answer   but to no avail, my final mark was below the  average but thankfully I still passed the course,   unfortunately, i still graduated from the  university of Edinburgh a few months later

not long after my graduation i got a position as  a young lecturer at Universitas Al Azhar Indonesia and this job turns out to be  helpful in my learning process   uh i would talk about more about  this later on but uh yeah to sum up this is a good opportunity for tea for me  to review some of the previous materials and   learn even more about machine learning  statistics and business statistics in particular so at Universitas Al Azhar Indonesia  I teach artificial intelligence,   data mining and pattern recognition  courses. I also covered some of the basic   probability theories as well so I got to thing,  things like neural networks and deep learning,

linear classifiers, support vector machines etc  etc and though i did not do well in my mlpr class   there's another course named introductory  applied machine learning during my master's   so the math was not regress as rigorous as  mlpr and the explanation was really clear so   it was quite easy for me to understand  the things the lecturer taught back then   so for those who are keen you can see the videos  on victor la france ghost channel on youtube just

use the keyword introductory applied machine  learning Edinburgh, you will find the   lecture series there but still having the  understanding of machine learning without properly   knowing the underlying principles of probability  and statistics I and and how to move further to   Bayesian machine learning I feel that something  is missing I don't really feel satisfied myself   so thus my journey in relearning bayesian methods  has begun. One year after working as a lecturer,

I joined AB rooms as a data scientist this now  defunct startup work in the hospitality industry   with a similar business model to oyo rooms, you  might have heard of oily rooms where you let   some of the rooms from hotel to customers and  using your own e-commerce and you standardize   the rooms basically so mainly I aided the company  in making strategic decisions among other things   I worked mostly with marketing  data and pricing data as well

so during this time i tried to learn bayesian  statistics and watch this video by j founder plus   on a frequentist versus baysian and trying  to understand what all the fuss is about   so you might have heard before about frequentist  versus bayesian and this talk covers that nicely so this shed some light to me but there were  things that i still could not wrap my head around   as this talk uh mostly deals with high level  discussion about frequentist and bayesian analysis   so yeah that's that but then i found this  magnificent book by cameron davidson billion

so who and i believe he's also giving  a talk in this conference so i really   recommend you to watch this video as well it uh it  will be worth your time and the book itself it's   it's very good uh i really love this book  and i will always recommend this book to   other people who want uh to learn bayesian  methods as well so in the book i found some   really nice examples so this is one of the figures  in his book and this is about the change in the

expected number of text messages receives after a  while so let's let us think for a second does this   resemble a problem you know of i mean previously  have you ever thought about something like this   the when did the change happen so a change in the  number of text messages, changing the number of   tweets, change in the number of um i don't know  uh electrical electricity usage or something   like that so i believe that you have asked a  similar question like this in your lifetime and this book gives a really nice example that  you can later toy on with your own data set

so these are some of the plus points from the  book uh from my point of view the first one the   book gives simple and relatable examples and it is  written in a hacker first mindset so you can see   snippets of code that you can play around with and  also this book is written with a top down approach   as it avoids giving too much details  about these sampling methods in the   first couple of chapters so you could understand  the basic idea of bayesian methods without really

talking about the markov chain monte carlo  at first so and uh the biggest plus point   for me for sure is the use of PyMC3 as the main  framework now i have tried to double in tensorflow   probability and pyro as well but to this day i  really like the api design of PyMC3 but i might   be biased though since this is also the first  probabilistic programming library that i use so   now i have finally found my motivation so the book  the bayesian methods for hacker's book is really good that i can see things around me through  different pair of glasses i can see a bayesian cases around me yeah or or cases or problems  that i can see with the bayesian perspective

from now on so for for example this example from  the book about how to order reddit submissions where you update your prior based on the  upvote ratios on different submissions   i also show a similar problem at AB  rooms in the form of search ranking so   how to rank properties from review scores  with bayesian statistics basically every   property will have their own number of reviews  with different review scores and you want to

rank them all within a c or within a province so  how would you rank them the best and that example   of ordering the reddit submission certainly helped  me to work on this as well uh and i also wrote   an article uh later on on the company's technical  blog about bayesian inference using PyMC3 you can   still find it now on medium so go to medium.com  slash 80 death science uh but as i've mentioned   before the company has now shut down due to  covid-19 so there will be no more costs there

so anyway I also learned something about bayesian  optimal pricing during my trainer at the company   and this book blog post by chad shard  introduced me to bottle feeding and diagnostics, you should really check it out and also finally I got the chance to draw  something beautiful like this as well yeah and I also gave a talk on behalf of the  company about probabilistic programming uh,   later on, uh during my tenure, tenure  and the company and basically I advocate   the use of bayesian methods in our  work at the company to my colleagues

so in retrospect if i compare the two main  resources i use when learning bayesain methods   early on these are the main things that i would  point out the first one is the mlpr course is   built uh with the theory first mindset whereas  the bayesian methods for hackers as the name goes is written in a hacker first mindset so uh with  the theory first mindset you need the foundations   first and give proofs and things like that so  you basically need mathematical rigor there   but on the flip side bayesian methods for hackers  includes executable codes so you can play around   with some examples and maybe use an example  of your own and then the the last one is that   mlpr course was built with a bottom-up approach  so like i said before it mainly deals with the

foundations first the nitty-gritty of bayesian  inference, sampling methods etc etc and on the other side the bayesian methods for  hacker's book uses a top-down approach where you   are given use cases and examples and how things  would work will unreveal later on in the book so it doesn't end here uh the bayesian methods  for hacker's book is just the beginning of   the relearning part of my journey I learned  that I have to review and brush up my   probability and statistics understanding  even more so for that particular purpose   I reviewed some probability course courses and  found this course exceptionally easy to understand   uh yeah this uh standford cs109 probability  for computer scientists uh as the name goes

and the cs109 course is tailored to  suit a computer scientist's needs the slides are beautifully designed especially  in this particular term the summer 2017 term   and examples are relatable to computer scientists  I think uh DR will monroe did a great job here   uh you should really check out the slides  they are beautiful and uh playful uh and I found quite interesting that you can put so  much effort into making uh slides for the lectures

and also i recommend this course the heart uh stat  110 course by professor joe blitzstein where he   covers probably the theories um there's also a  book he wrote with his whole with his colleague   for the course as well so you should check that  out as well uh it is free and available online you should also do some of the um exercise in the  book as well i also followed this lecture series   entitled uh statistically thinking by richard  mcelroth where he explains how to apply vision   statistics to evolutionary anthropology cases  some interesting cases uh in the book and in   the lecture series as well overall i recommend  his book and the lecture series as it nicely   covers bayesian statistics from the very  beginning he uses r though and he use

his own package free thinking for the lecture but  people have ported the code to PyMC3 as well so you can find it online but i try to port the  code myself as an exercise and you can do   that as well to learn even more uh the example  notebooks from PyMC3 documentation can also be   a very good learning resource as well  you can also see the discourse page to   ask questions and discuss ideas  about bayesian methods and PyMC3 and after all of this i finally  learned to love bayes' even more   as an alumni of the same university as Reverend  Thomas Bayes I hopefully i did not let him down

and i can happily say that i can understand  this slide now so yes there's a success for me   so we finally came to the final part of  this talk um the key takeaways from the talk   uh are find your motivation uh and there are two  main maths program masters of program first and   try that so in the final motivation i would say  that you might need a different one from mine   it is subject to your experience  so far after all so i must say

you have to find it yourself but some  exposure to real cases first before deep dive   into the theory would be beneficial from my point  of view and if you don't have any problems with   understanding formulas or deriving equations  you should benefit more from reading books like   kevin murphy's machine learning or david mckay's  information theory otherwise you should really   consider reading basic methods for hackers or  statistically thinking as i believe it is easier

with some example codes in the book and finally  try it out as they say experience is the best   teacher so hopefully you'll fully grasp the  idea after toying around with some examples and   particularly for my case learning by teaching is  extremely effective uh during my tenure year as   a and a young lecturer at Universitas Al Azhar  Indonesia i learned some of the basic stuff as   well so the probability theories and the machine  learning stuffs and how to combine them and how to present them clearly to my students actually  helped me to understand them even better   so you should try it out as well give thoughts  like this or uh just um discuss with your friends   and advocate the use of bayesian statistics  then you might learn something from that

so to conclude if things are hard for you right  now please remember that this too shall pass probably so uh thank you very much for listening  to my story for listening to my journey so far   hope you enjoyed this talk and i'm looking  forward to the Q&A session thank you bye bye

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent