SlideShare une entreprise Scribd logo
1  sur  41
Bayesian statistics
2 Probability A random variable isthe basic element of probability  Refers to an event and there is some degree of uncertainty as to the outcome of the event For example, the random variable A could be the event of getting a heads on a coin flip
Classical vs. Bayesian Classical: Experiments are infinitely repeatable under the same conditions (hence: ’frequentist’) The parameter of interest (θ) is fixed and unknown Bayesian: Each experiment is unique (i.e., not repeatable) The parameter of interest has an unknown distribution
Classical Probability Property of environment ‘Physical’ probability Imagine all data sets of size N that could be generated by sampling from the distribution determined by parameters. Each data set occurs with some probability and produces an estimate “The probability of getting heads on this particular coin is 50%”
Bayesian Probability ‘Personal’ probability Degree of belief Property of person who assigns it Observations are fixed, imagine all possible values of parameters from which they could have come “I think the coin will land on heads 50% of the time”
The Bayes’ Formula
Conditional Probability P(A = true | B = true) = Out of all the outcomes in which B is true, how many also have A equal to true Read this as: “Probability of A conditioned on B” or “Probability of A given B” H = “Have a headache” F = “Coming down with Flu” P(H = true) = 1/10 P(F = true) = 1/40 P(H  = true | F = true) = 1/2 “Headaches are rare and flu is rarer, but if you’re coming down with flu there’s a 50-50 chance you’ll have a headache.” P(F = true) P(H = true)
The Joint Probability Distribution We will write P(A = true, B = true) to mean “the probability of A = trueandB = true” Notice that: P(H=true|F=true) P(F = true) P(H = true) In general, P(X|Y)=P(X,Y)/P(Y)
The Joint Probability Distribution Joint probabilities can be between any number of variables 	eg. P(A = true, B = true, C = true) For each combination of variables, we need to say how probable that combination is The probabilities of these combinations need to sum to 1 Sums to 1
The Joint Probability Distribution Once you have the joint probability distribution, you can calculate any probability involving A, B, and C Note: May need to use marginalization and Bayes rule, (both of which are not discussed in these slides) Examples of things you can compute: ,[object Object]
P(A=true, B = true | C=true) = P(A = true, B = true, C = true) / P(C = true)
The Problem with the Joint Distribution Lots of entries in the table to fill up! For k Boolean random variables, you need a table of size 2k How do we use fewer numbers?  Need the concept of independence
Independence Variables A and B are independent if any of the following hold: P(A,B) = P(A)P(B) P(A | B) = P(A) P(B | A) = P(B) This says that knowing the outcome of A does not tell me anything new about the outcome of B.
Independence How is independence useful? Suppose you have n coin flips and you want to calculate the joint distribution P(C1, …, Cn) If the coin flips are not independent, you need 2n values in the table If the coin flips are independent, then Each P(Ci) table has 2 entries and there are n of them for a total of 2n values
Conditional Independence Variables A and B are conditionally independent given C if any of the following hold: P(A, B | C) = P(A | C)P(B | C) P(A | B, C) = P(A | C) P(B | A, C) = P(B | C) Knowing C tells me everything about B. I don’t gain anything by knowing A (either because A doesn’t influence B or because knowing C provides all the information knowing A would give)
Example: A Clinical Test Let’s move to a simple example, a clinical test. Consider a rare disease such that at any given point of time, on average 1 in 1000 people in the population has the disease. There exists also a clinical test for the disease (a blood test, for example), but it is not perfect. The sensitivity of the test, i.e. the probability of giving a correct positive, is .99. The specificity of the test, i.e. the probability of giving a correct negative is .98. To better visualise it, let’s draw a tree
Example: A Clinical Test P(Disease) = p(θ=1)=.0001 P(Test Positive|Disease) = p(x=1| θ =1)=.99 P(Test Negative|No Disease) = p(x=0| θ=0)=.98 .99 + .0001   Disease .01 - .02 + .9999 No Disease .98 -
Example: A Clinical Test Now let us consider a person, who gets worried, takes a test, and get’s a positive result. Remembering, that the test is not perfect, what can we say about the actual chances of his being ill?
Example: A Clinical Test .99 + .0001   Disease .01 - .02 + .9999 No Disease .98 - Applying the Bayes’ formula we get the result: the probability of our patient being ill, given what we know about the prevalence of the disease in the population and about the test performance, is .0049. Naturally, higher than in the background population, but still very small. Suppose it is customary to repeat the test, and the result is positive again
.99 + .0001   Disease .01 - .02 + .9999 No Disease .98 - Example: A Clinical Test .99 + .0049   Disease .01 - .02 + .9951 No Disease .98 - We can still use the same formula, of course, and the same tree for the visualisation, but now the probabilities of having the disease and being disease free before the test are not .0001 and .9999 respectively, but. Instead, are .0049 and .9951 based on the result of the test so far. After applying the formula this time, we get the result of .20. Still not too high, implying that the test is probably not very efficient, because evidently you have to repeat it many times before you become reasonably sure.
Bayesian Inference: Combine prior with model to produce posterior probability distribution Step-wise modeling:
Example Thumbtack problem: will it land on the point (heads) or the flat bit (tails)? Flip it N times What will it do on the N+1th time? How to compute p(xN+1|D, ξ) from p(θ|ξ)?
Inference as Learning Suppose you have a coin with an unknown bias, θ ≡ P(head). You flip the coin multiple times and observe the outcome. From observations, you can infer the bias of the coin This is learning.  This is inference.
independent events -> Sufficient statistics
Given that I have flipped a coin 100 times and it has landed heads-up 100 times, what is the likelihood that the coin is fair?
Bayesian Solution N=10 throws. 2 ’heads’ recorded. MODEL: x|θ ~ BIN(N=10,θ) PRIOR -? Beta(θ|α=1,β=1) Beta(θ|α=5,β=5) Beta(θ|α=5,β=20)
Posterior Distribution => θ|x,N,α,β ~ Beta(α+x,β+N-x) Beta(θ|1+2,1+10-2) i.e., Beta(θ|3,9)
Posterior Distribution When the data is ’strong enough’ the posterior will not depend on prior Unless some extraneous information is available, a non-informative or vague prior can be used, in which case the inference will mostly be based on data. If, however, some prior knowledge is available regarding the parameters of interest, then it should be included in the reasoning. Furthermore, it is a common practive to conduct a sensitivity analysis – in other words, to examine the effect the prior might have on the posterior distribution. In any case, the prior assumptions should always be made explicit, and if the result is found to be dependent on them, such sensitivity should be investigated in detail.
Posterior Inference Posterior distribution: Beta(θ|3,9) Posterior mean: .25 Posterior variance: .014 Posterior 95% HDR: (.041,.484) P(θ<.7)=.9994 Frequentist: Mean:      .2 Variance: .016 Exact 95% CI: (.03,.56)
Bayesian networks
A Bayesian Network A Bayesian network is made up of: 1. A Directed Acyclic Graph A B C D 2. A set of tables for each node in the graph
A Directed Acyclic Graph A node X is a parent of another node Y if there is an arrow from node X to node Yeg. A is a parent of B Each node in the graph is a random variable A B C D Informally, an arrow from node X to node Y means X has a direct influence on Y
A Set of Tables for Each Node Each node Xi has a conditional probability distribution P(Xi | Parents(Xi)) that quantifies the effect of the parents on the node The parameters are the probabilities in these conditional probability tables (CPTs) A B C D
A Set of Tables for Each Node Conditional Probability Distribution for C given B For a given combination of values of the parents (B in this example), the entries for P(C=true | B) and P(C=false | B) must add up to 1  eg. P(C=true | B=false) + P(C=false |B=false )=1 If you have a Boolean variable with k Boolean parents, this table has 2k+1 probabilities (but only 2k need to be stored)
Bayesian Networks Two important properties: Encodes the conditional independence relationships between the variables in the graph structure Is a compact representation of the joint probability distribution over the variables
Conditional Independence The Markov condition: given its parents (P1, P2), a node (X) is conditionally independent of its non-descendants (ND1, ND2) P1 P2 X ND2 ND1 C1 C2
The Joint Probability Distribution Due to the Markov condition, we can compute the joint probability distribution over all the variables X1, …, Xn in the Bayesian net using the formula: Where Parents(Xi) means the values of the Parents of the node Xi with respect to the graph
Using a Bayesian Network Example Using the network in the example, suppose you want to calculate: P(A = true, B = true, C = true, D = true) = P(A = true) * P(B = true | A = true) *     P(C = true | B = true) P( D = true | B = true)  = (0.4)*(0.3)*(0.1)*(0.95) A B C D
Using a Bayesian Network Example Using the network in the example, suppose you want to calculate: P(A = true, B = true, C = true, D = true) = P(A = true) * P(B = true | A = true) *     P(C = true | B = true) P( D = true | B = true)  = (0.4)*(0.3)*(0.1)*(0.95) This is from the graph structure A B These numbers are from the conditional probability tables C D
Inference Using a Bayesian network to compute probabilities is called inference In general, inference involves queries of the form: 	P( X | E ) E = The evidence variable(s) X = The query variable(s)

Contenu connexe

Tendances

Statistical distributions
Statistical distributionsStatistical distributions
Statistical distributionsTanveerRehman4
 
Bayes rule (Bayes Law)
Bayes rule (Bayes Law)Bayes rule (Bayes Law)
Bayes rule (Bayes Law)Tish997
 
Maximum likelihood estimation
Maximum likelihood estimationMaximum likelihood estimation
Maximum likelihood estimationzihad164
 
An introduction to Bayesian Statistics using Python
An introduction to Bayesian Statistics using PythonAn introduction to Bayesian Statistics using Python
An introduction to Bayesian Statistics using Pythonfreshdatabos
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributionsRajaKrishnan M
 
Introduction to Bayesian Statistics
Introduction to Bayesian StatisticsIntroduction to Bayesian Statistics
Introduction to Bayesian StatisticsPhilipp Singer
 
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliRegression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliAkanksha Bali
 
2.2 laws of probability (1)
2.2 laws of probability (1)2.2 laws of probability (1)
2.2 laws of probability (1)gracie
 
Poisson distribution
Poisson distributionPoisson distribution
Poisson distributionStudent
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regressionJames Neill
 
4 1 probability and discrete probability distributions
4 1 probability and discrete    probability distributions4 1 probability and discrete    probability distributions
4 1 probability and discrete probability distributionsLama K Banna
 
Probability basics and bayes' theorem
Probability basics and bayes' theoremProbability basics and bayes' theorem
Probability basics and bayes' theoremBalaji P
 
Binomial distribution
Binomial distributionBinomial distribution
Binomial distributionnumanmunir01
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regressionKen Plummer
 
Discrete probability distribution (complete)
Discrete probability distribution (complete)Discrete probability distribution (complete)
Discrete probability distribution (complete)ISYousafzai
 

Tendances (20)

Statistical distributions
Statistical distributionsStatistical distributions
Statistical distributions
 
Bayes rule (Bayes Law)
Bayes rule (Bayes Law)Bayes rule (Bayes Law)
Bayes rule (Bayes Law)
 
Maximum likelihood estimation
Maximum likelihood estimationMaximum likelihood estimation
Maximum likelihood estimation
 
Linear regression
Linear regression Linear regression
Linear regression
 
An introduction to Bayesian Statistics using Python
An introduction to Bayesian Statistics using PythonAn introduction to Bayesian Statistics using Python
An introduction to Bayesian Statistics using Python
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributions
 
Introduction to Bayesian Statistics
Introduction to Bayesian StatisticsIntroduction to Bayesian Statistics
Introduction to Bayesian Statistics
 
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliRegression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
 
2.2 laws of probability (1)
2.2 laws of probability (1)2.2 laws of probability (1)
2.2 laws of probability (1)
 
Poisson distribution
Poisson distributionPoisson distribution
Poisson distribution
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regression
 
4 1 probability and discrete probability distributions
4 1 probability and discrete    probability distributions4 1 probability and discrete    probability distributions
4 1 probability and discrete probability distributions
 
Probability basics and bayes' theorem
Probability basics and bayes' theoremProbability basics and bayes' theorem
Probability basics and bayes' theorem
 
Probability and Distribution
Probability and DistributionProbability and Distribution
Probability and Distribution
 
Binomial distribution
Binomial distributionBinomial distribution
Binomial distribution
 
Binomial probability distributions
Binomial probability distributions  Binomial probability distributions
Binomial probability distributions
 
Multiple linear regression
Multiple linear regressionMultiple linear regression
Multiple linear regression
 
Regression
RegressionRegression
Regression
 
Bayesian inference
Bayesian inferenceBayesian inference
Bayesian inference
 
Discrete probability distribution (complete)
Discrete probability distribution (complete)Discrete probability distribution (complete)
Discrete probability distribution (complete)
 

En vedette

Wikis in the Classroom
Wikis in the ClassroomWikis in the Classroom
Wikis in the ClassroomMitzi Lewis
 
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...Mitzi Lewis
 
Storytelling with Audio Slideshows
Storytelling with Audio SlideshowsStorytelling with Audio Slideshows
Storytelling with Audio SlideshowsMitzi Lewis
 
Teaching storytelling with audio slideshows – some basics
Teaching storytelling with  audio slideshows – some basics Teaching storytelling with  audio slideshows – some basics
Teaching storytelling with audio slideshows – some basics Mitzi Lewis
 
SocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativaSocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativaAlberto Labarga
 

En vedette (8)

Seafarers
SeafarersSeafarers
Seafarers
 
Wikis in the Classroom
Wikis in the ClassroomWikis in the Classroom
Wikis in the Classroom
 
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...
Enhancing Portfolios Through Creative Research Projects: Scholarship of Appli...
 
Storytelling with Audio Slideshows
Storytelling with Audio SlideshowsStorytelling with Audio Slideshows
Storytelling with Audio Slideshows
 
AEJMC 2008
AEJMC 2008AEJMC 2008
AEJMC 2008
 
Code Igniter 2
Code Igniter 2Code Igniter 2
Code Igniter 2
 
Teaching storytelling with audio slideshows – some basics
Teaching storytelling with  audio slideshows – some basics Teaching storytelling with  audio slideshows – some basics
Teaching storytelling with audio slideshows – some basics
 
SocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativaSocialLearning: descubriendo contenidos educativos de manera colaborativa
SocialLearning: descubriendo contenidos educativos de manera colaborativa
 

Similaire à Bayesian statistics

Basic Concept Of Probability
Basic Concept Of ProbabilityBasic Concept Of Probability
Basic Concept Of Probabilityguest45a926
 
Bayes Classification
Bayes ClassificationBayes Classification
Bayes Classificationsathish sak
 
Data mining assignment 2
Data mining assignment 2Data mining assignment 2
Data mining assignment 2BarryK88
 
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docx
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docxHW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docx
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docxwilcockiris
 
Introduction to Evidential Neural Networks
Introduction to Evidential Neural NetworksIntroduction to Evidential Neural Networks
Introduction to Evidential Neural NetworksFederico Cerutti
 
Introduction to Bayesian Statistics.ppt
Introduction to Bayesian Statistics.pptIntroduction to Bayesian Statistics.ppt
Introduction to Bayesian Statistics.pptLong Dang
 
Descriptive Statistics Formula Sheet Sample Populatio.docx
Descriptive Statistics Formula Sheet    Sample Populatio.docxDescriptive Statistics Formula Sheet    Sample Populatio.docx
Descriptive Statistics Formula Sheet Sample Populatio.docxsimonithomas47935
 
ISM_Session_5 _ 23rd and 24th December.pptx
ISM_Session_5 _ 23rd and 24th December.pptxISM_Session_5 _ 23rd and 24th December.pptx
ISM_Session_5 _ 23rd and 24th December.pptxssuser1eba67
 
2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptxImpanaR2
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheetJoachim Gwoke
 
1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilitiesDr Fereidoun Dejahang
 
2013.03.26 Bayesian Methods for Modern Statistical Analysis
2013.03.26 Bayesian Methods for Modern Statistical Analysis2013.03.26 Bayesian Methods for Modern Statistical Analysis
2013.03.26 Bayesian Methods for Modern Statistical AnalysisNUI Galway
 
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian MethodsNUI Galway
 
On the vexing dilemma of hypothesis testing and the predicted demise of the B...
On the vexing dilemma of hypothesis testing and the predicted demise of the B...On the vexing dilemma of hypothesis testing and the predicted demise of the B...
On the vexing dilemma of hypothesis testing and the predicted demise of the B...Christian Robert
 
Probability and basic statistics with R
Probability and basic statistics with RProbability and basic statistics with R
Probability and basic statistics with RAlberto Labarga
 
TTests.ppt
TTests.pptTTests.ppt
TTests.pptMUzair21
 

Similaire à Bayesian statistics (20)

Basic Concept Of Probability
Basic Concept Of ProbabilityBasic Concept Of Probability
Basic Concept Of Probability
 
Bayes Classification
Bayes ClassificationBayes Classification
Bayes Classification
 
Chapter1
Chapter1Chapter1
Chapter1
 
probability assignment help (2)
probability assignment help (2)probability assignment help (2)
probability assignment help (2)
 
Data mining assignment 2
Data mining assignment 2Data mining assignment 2
Data mining assignment 2
 
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docx
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docxHW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docx
HW1_STAT206.pdfStatistical Inference II J. Lee Assignment.docx
 
Introduction to Evidential Neural Networks
Introduction to Evidential Neural NetworksIntroduction to Evidential Neural Networks
Introduction to Evidential Neural Networks
 
Introduction to Bayesian Statistics.ppt
Introduction to Bayesian Statistics.pptIntroduction to Bayesian Statistics.ppt
Introduction to Bayesian Statistics.ppt
 
Descriptive Statistics Formula Sheet Sample Populatio.docx
Descriptive Statistics Formula Sheet    Sample Populatio.docxDescriptive Statistics Formula Sheet    Sample Populatio.docx
Descriptive Statistics Formula Sheet Sample Populatio.docx
 
ISM_Session_5 _ 23rd and 24th December.pptx
ISM_Session_5 _ 23rd and 24th December.pptxISM_Session_5 _ 23rd and 24th December.pptx
ISM_Session_5 _ 23rd and 24th December.pptx
 
2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx2.statistical DEcision makig.pptx
2.statistical DEcision makig.pptx
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheet
 
bayesjaw.ppt
bayesjaw.pptbayesjaw.ppt
bayesjaw.ppt
 
1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities1615 probability-notation for joint probabilities
1615 probability-notation for joint probabilities
 
2013.03.26 Bayesian Methods for Modern Statistical Analysis
2013.03.26 Bayesian Methods for Modern Statistical Analysis2013.03.26 Bayesian Methods for Modern Statistical Analysis
2013.03.26 Bayesian Methods for Modern Statistical Analysis
 
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods
2013.03.26 An Introduction to Modern Statistical Analysis using Bayesian Methods
 
On the vexing dilemma of hypothesis testing and the predicted demise of the B...
On the vexing dilemma of hypothesis testing and the predicted demise of the B...On the vexing dilemma of hypothesis testing and the predicted demise of the B...
On the vexing dilemma of hypothesis testing and the predicted demise of the B...
 
Probability and basic statistics with R
Probability and basic statistics with RProbability and basic statistics with R
Probability and basic statistics with R
 
Statistics Homework Help
Statistics Homework HelpStatistics Homework Help
Statistics Homework Help
 
TTests.ppt
TTests.pptTTests.ppt
TTests.ppt
 

Plus de Alberto Labarga

El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017Alberto Labarga
 
Shokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob DylanShokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob DylanAlberto Labarga
 
Genome visualization challenges
Genome visualization challengesGenome visualization challenges
Genome visualization challengesAlberto Labarga
 
Hacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin StreetHacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin StreetAlberto Labarga
 
hacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligentehacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligenteAlberto Labarga
 
Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015Alberto Labarga
 
Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9Alberto Labarga
 
Arduino: Control de motores
Arduino: Control de motoresArduino: Control de motores
Arduino: Control de motoresAlberto Labarga
 
Entrada/salida analógica con Arduino
Entrada/salida analógica con ArduinoEntrada/salida analógica con Arduino
Entrada/salida analógica con ArduinoAlberto Labarga
 
Práctica con Arduino: Simon Dice
Práctica con Arduino: Simon DicePráctica con Arduino: Simon Dice
Práctica con Arduino: Simon DiceAlberto Labarga
 
Entrada/Salida digital con Arduino
Entrada/Salida digital con ArduinoEntrada/Salida digital con Arduino
Entrada/Salida digital con ArduinoAlberto Labarga
 
Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014Alberto Labarga
 
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014Alberto Labarga
 
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...Alberto Labarga
 
Introducción a la impresión 3D
Introducción a la impresión 3DIntroducción a la impresión 3D
Introducción a la impresión 3DAlberto Labarga
 
La vida y trabajo de Shinichi Suzuki
La vida y trabajo de Shinichi SuzukiLa vida y trabajo de Shinichi Suzuki
La vida y trabajo de Shinichi SuzukiAlberto Labarga
 

Plus de Alberto Labarga (20)

El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017El Salto Communities - EditorsLab 2017
El Salto Communities - EditorsLab 2017
 
Shokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob DylanShokesu - Premio Nobel de Literatura a Bob Dylan
Shokesu - Premio Nobel de Literatura a Bob Dylan
 
Genome visualization challenges
Genome visualization challengesGenome visualization challenges
Genome visualization challenges
 
Hacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin StreetHacksanfermin 2015 :: Dropcoin Street
Hacksanfermin 2015 :: Dropcoin Street
 
hacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligentehacksanfermin 2015 :: Parking inteligente
hacksanfermin 2015 :: Parking inteligente
 
jpd5 big data
jpd5 big datajpd5 big data
jpd5 big data
 
Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015Vidas Contadas :: Visualizar 2015
Vidas Contadas :: Visualizar 2015
 
Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9Periodismo de datos y visualización de datos abiertos #siglibre9
Periodismo de datos y visualización de datos abiertos #siglibre9
 
myHealthHackmedicine
myHealthHackmedicinemyHealthHackmedicine
myHealthHackmedicine
 
Big Data y Salud
Big Data y SaludBig Data y Salud
Big Data y Salud
 
Arduino: Control de motores
Arduino: Control de motoresArduino: Control de motores
Arduino: Control de motores
 
Entrada/salida analógica con Arduino
Entrada/salida analógica con ArduinoEntrada/salida analógica con Arduino
Entrada/salida analógica con Arduino
 
Práctica con Arduino: Simon Dice
Práctica con Arduino: Simon DicePráctica con Arduino: Simon Dice
Práctica con Arduino: Simon Dice
 
Entrada/Salida digital con Arduino
Entrada/Salida digital con ArduinoEntrada/Salida digital con Arduino
Entrada/Salida digital con Arduino
 
Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014Presentación Laboratorio de Fabricación Digital UPNA 2014
Presentación Laboratorio de Fabricación Digital UPNA 2014
 
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
Conceptos de electrónica - Laboratorio de Fabricación Digital UPNA 2014
 
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
Introducción a la plataforma Arduino - Laboratorio de Fabricación Digital UPN...
 
Introducción a la impresión 3D
Introducción a la impresión 3DIntroducción a la impresión 3D
Introducción a la impresión 3D
 
Vidas Contadas
Vidas ContadasVidas Contadas
Vidas Contadas
 
La vida y trabajo de Shinichi Suzuki
La vida y trabajo de Shinichi SuzukiLa vida y trabajo de Shinichi Suzuki
La vida y trabajo de Shinichi Suzuki
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Dernier (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

Bayesian statistics

  • 2. 2 Probability A random variable isthe basic element of probability Refers to an event and there is some degree of uncertainty as to the outcome of the event For example, the random variable A could be the event of getting a heads on a coin flip
  • 3. Classical vs. Bayesian Classical: Experiments are infinitely repeatable under the same conditions (hence: ’frequentist’) The parameter of interest (θ) is fixed and unknown Bayesian: Each experiment is unique (i.e., not repeatable) The parameter of interest has an unknown distribution
  • 4. Classical Probability Property of environment ‘Physical’ probability Imagine all data sets of size N that could be generated by sampling from the distribution determined by parameters. Each data set occurs with some probability and produces an estimate “The probability of getting heads on this particular coin is 50%”
  • 5. Bayesian Probability ‘Personal’ probability Degree of belief Property of person who assigns it Observations are fixed, imagine all possible values of parameters from which they could have come “I think the coin will land on heads 50% of the time”
  • 7. Conditional Probability P(A = true | B = true) = Out of all the outcomes in which B is true, how many also have A equal to true Read this as: “Probability of A conditioned on B” or “Probability of A given B” H = “Have a headache” F = “Coming down with Flu” P(H = true) = 1/10 P(F = true) = 1/40 P(H = true | F = true) = 1/2 “Headaches are rare and flu is rarer, but if you’re coming down with flu there’s a 50-50 chance you’ll have a headache.” P(F = true) P(H = true)
  • 8. The Joint Probability Distribution We will write P(A = true, B = true) to mean “the probability of A = trueandB = true” Notice that: P(H=true|F=true) P(F = true) P(H = true) In general, P(X|Y)=P(X,Y)/P(Y)
  • 9. The Joint Probability Distribution Joint probabilities can be between any number of variables eg. P(A = true, B = true, C = true) For each combination of variables, we need to say how probable that combination is The probabilities of these combinations need to sum to 1 Sums to 1
  • 10.
  • 11. P(A=true, B = true | C=true) = P(A = true, B = true, C = true) / P(C = true)
  • 12. The Problem with the Joint Distribution Lots of entries in the table to fill up! For k Boolean random variables, you need a table of size 2k How do we use fewer numbers? Need the concept of independence
  • 13. Independence Variables A and B are independent if any of the following hold: P(A,B) = P(A)P(B) P(A | B) = P(A) P(B | A) = P(B) This says that knowing the outcome of A does not tell me anything new about the outcome of B.
  • 14. Independence How is independence useful? Suppose you have n coin flips and you want to calculate the joint distribution P(C1, …, Cn) If the coin flips are not independent, you need 2n values in the table If the coin flips are independent, then Each P(Ci) table has 2 entries and there are n of them for a total of 2n values
  • 15. Conditional Independence Variables A and B are conditionally independent given C if any of the following hold: P(A, B | C) = P(A | C)P(B | C) P(A | B, C) = P(A | C) P(B | A, C) = P(B | C) Knowing C tells me everything about B. I don’t gain anything by knowing A (either because A doesn’t influence B or because knowing C provides all the information knowing A would give)
  • 16. Example: A Clinical Test Let’s move to a simple example, a clinical test. Consider a rare disease such that at any given point of time, on average 1 in 1000 people in the population has the disease. There exists also a clinical test for the disease (a blood test, for example), but it is not perfect. The sensitivity of the test, i.e. the probability of giving a correct positive, is .99. The specificity of the test, i.e. the probability of giving a correct negative is .98. To better visualise it, let’s draw a tree
  • 17. Example: A Clinical Test P(Disease) = p(θ=1)=.0001 P(Test Positive|Disease) = p(x=1| θ =1)=.99 P(Test Negative|No Disease) = p(x=0| θ=0)=.98 .99 + .0001 Disease .01 - .02 + .9999 No Disease .98 -
  • 18. Example: A Clinical Test Now let us consider a person, who gets worried, takes a test, and get’s a positive result. Remembering, that the test is not perfect, what can we say about the actual chances of his being ill?
  • 19. Example: A Clinical Test .99 + .0001 Disease .01 - .02 + .9999 No Disease .98 - Applying the Bayes’ formula we get the result: the probability of our patient being ill, given what we know about the prevalence of the disease in the population and about the test performance, is .0049. Naturally, higher than in the background population, but still very small. Suppose it is customary to repeat the test, and the result is positive again
  • 20. .99 + .0001 Disease .01 - .02 + .9999 No Disease .98 - Example: A Clinical Test .99 + .0049 Disease .01 - .02 + .9951 No Disease .98 - We can still use the same formula, of course, and the same tree for the visualisation, but now the probabilities of having the disease and being disease free before the test are not .0001 and .9999 respectively, but. Instead, are .0049 and .9951 based on the result of the test so far. After applying the formula this time, we get the result of .20. Still not too high, implying that the test is probably not very efficient, because evidently you have to repeat it many times before you become reasonably sure.
  • 21. Bayesian Inference: Combine prior with model to produce posterior probability distribution Step-wise modeling:
  • 22. Example Thumbtack problem: will it land on the point (heads) or the flat bit (tails)? Flip it N times What will it do on the N+1th time? How to compute p(xN+1|D, ξ) from p(θ|ξ)?
  • 23. Inference as Learning Suppose you have a coin with an unknown bias, θ ≡ P(head). You flip the coin multiple times and observe the outcome. From observations, you can infer the bias of the coin This is learning. This is inference.
  • 24. independent events -> Sufficient statistics
  • 25. Given that I have flipped a coin 100 times and it has landed heads-up 100 times, what is the likelihood that the coin is fair?
  • 26. Bayesian Solution N=10 throws. 2 ’heads’ recorded. MODEL: x|θ ~ BIN(N=10,θ) PRIOR -? Beta(θ|α=1,β=1) Beta(θ|α=5,β=5) Beta(θ|α=5,β=20)
  • 27. Posterior Distribution => θ|x,N,α,β ~ Beta(α+x,β+N-x) Beta(θ|1+2,1+10-2) i.e., Beta(θ|3,9)
  • 28.
  • 29. Posterior Distribution When the data is ’strong enough’ the posterior will not depend on prior Unless some extraneous information is available, a non-informative or vague prior can be used, in which case the inference will mostly be based on data. If, however, some prior knowledge is available regarding the parameters of interest, then it should be included in the reasoning. Furthermore, it is a common practive to conduct a sensitivity analysis – in other words, to examine the effect the prior might have on the posterior distribution. In any case, the prior assumptions should always be made explicit, and if the result is found to be dependent on them, such sensitivity should be investigated in detail.
  • 30. Posterior Inference Posterior distribution: Beta(θ|3,9) Posterior mean: .25 Posterior variance: .014 Posterior 95% HDR: (.041,.484) P(θ<.7)=.9994 Frequentist: Mean: .2 Variance: .016 Exact 95% CI: (.03,.56)
  • 32. A Bayesian Network A Bayesian network is made up of: 1. A Directed Acyclic Graph A B C D 2. A set of tables for each node in the graph
  • 33. A Directed Acyclic Graph A node X is a parent of another node Y if there is an arrow from node X to node Yeg. A is a parent of B Each node in the graph is a random variable A B C D Informally, an arrow from node X to node Y means X has a direct influence on Y
  • 34. A Set of Tables for Each Node Each node Xi has a conditional probability distribution P(Xi | Parents(Xi)) that quantifies the effect of the parents on the node The parameters are the probabilities in these conditional probability tables (CPTs) A B C D
  • 35. A Set of Tables for Each Node Conditional Probability Distribution for C given B For a given combination of values of the parents (B in this example), the entries for P(C=true | B) and P(C=false | B) must add up to 1 eg. P(C=true | B=false) + P(C=false |B=false )=1 If you have a Boolean variable with k Boolean parents, this table has 2k+1 probabilities (but only 2k need to be stored)
  • 36. Bayesian Networks Two important properties: Encodes the conditional independence relationships between the variables in the graph structure Is a compact representation of the joint probability distribution over the variables
  • 37. Conditional Independence The Markov condition: given its parents (P1, P2), a node (X) is conditionally independent of its non-descendants (ND1, ND2) P1 P2 X ND2 ND1 C1 C2
  • 38. The Joint Probability Distribution Due to the Markov condition, we can compute the joint probability distribution over all the variables X1, …, Xn in the Bayesian net using the formula: Where Parents(Xi) means the values of the Parents of the node Xi with respect to the graph
  • 39. Using a Bayesian Network Example Using the network in the example, suppose you want to calculate: P(A = true, B = true, C = true, D = true) = P(A = true) * P(B = true | A = true) * P(C = true | B = true) P( D = true | B = true) = (0.4)*(0.3)*(0.1)*(0.95) A B C D
  • 40. Using a Bayesian Network Example Using the network in the example, suppose you want to calculate: P(A = true, B = true, C = true, D = true) = P(A = true) * P(B = true | A = true) * P(C = true | B = true) P( D = true | B = true) = (0.4)*(0.3)*(0.1)*(0.95) This is from the graph structure A B These numbers are from the conditional probability tables C D
  • 41. Inference Using a Bayesian network to compute probabilities is called inference In general, inference involves queries of the form: P( X | E ) E = The evidence variable(s) X = The query variable(s)
  • 42. Inference HasAnthrax HasCough HasFever HasDifficultyBreathing HasWideMediastinum An example of a query would be: P( HasAnthrax = true | HasFever = true, HasCough= true) Note: Even though HasDifficultyBreathing and HasWideMediastinum are in the Bayesian network, they are not given values in the query (ie. they do not appear either as query variables or evidence variables) They are treated as unobserved variables