Probabilistic Reasoning
Probabilistic Reasoning
Bayesian Networks
Prof. Dr. Paulo André L. de Castro
[email protected]
www.comp.ita.br/~pauloac Sala 110,
IEC-ITA
Summary
• Introduction and Review of Probability
• Interpretations of Probabilities
• Probabilistic Inference
P ( e | h ) P ( e2 |h ) P ( e3 |h ) P ( e4 |h ) P ( e6 |h ) 1 / 3000
• Furthermore, P(h|e) is not equal to 1-P(e| not h), but to : (using Bayes investion and sum-out)
P (e | h ) P ( h ) P (e | h ) P ( h )
P (h | e)
P (e) P (e | h ) P ( h ) P (e | h ) P ( h )
Example 2: People vs Collins – cont.
2
• μ is the mean •
ba
is the standard deviation
12
• σ is the standard deviation
Example of a Discrete Distribution
i
P( X i )
j 1
j
Probability Axioms
• For any propositons A and B
Condicional probability
(Probabilidade condicional)
P ( A, B )
P( A | B)
P(B)
• Or we can write as:
P ( A, B ) P ( A | B ) P ( B )
• And we know that (sum-out):
P ( A) P ( A, Bi )
i
• Then
P ( A) P ( A | Bi ) P ( Bi )
i
Chain Rule (Regra da Cadeia)
n
P ( X 1 , X 2 , X 3 ,.. X n ) P ( X i | X 1 , X 2 , X 3 ,.. X )
i 1
• Demonstration:
P ( X 1 , X 2 , X 3 ,.. X n ) P ( X n | X 1 , X 2 , X 3 ,.. X n 1 ) P ( X 1 , X 2 , X 3 ,.. X n 1 )
P ( X n | X 1 , X 2 , X 3 ,.. X n 1 ) P ( X n 1 | X 1 , X 2 , X 3 ,.. X n 2 ) P ( X 1 , X 2 , X 3 ,.. X n 2 )
......
P ( X n | X 1 , X 2 , X 3 ,.. X n 1 ) P ( X n 1 | X 1 , X 2 , X 3 ,.. X n 2 ).. P ( X 1 )
n
P( X
i 1
i | X 1 , X 2 , X 3 ,.. X )
Bayes Rule (Regra de Bayes)
P (e | H ) P ( H )
P ( H | e)
P (e)
P(H): Hypothesis a priori probability
Why is it relevant?
Cause and Effect
• We usually observe an effect and try to identify its cause
• We know that:
P (12 | dice ) P ( dice )
P ( dice | 12 )
P (12 )
P( A a
i
i | E e ) 1 P ( E e | A ai ) P ( A ai ) / P ( E e )
i
• Then:
P ( E e ) P ( E e | A ai ) P ( A ai )
i
Calculating the probability of the
evidence - 2
• Since P ( E e ) P ( E e | A ai ) P ( A ai )
i
P ( A a k | E e ) P ( E e | A a k ) P ( A a k ) / P ( E e | A ai ) P ( A ai )
i
P ( E e | A ak ) P ( A ak )
P ( A | E e ) P ( E e | A) P ( A)
Inference from Full joint distributions
• Tyipcally w, we are interested in the posterior joint distribution of the query variable Y
• given specifc values e for the evidence variables E
• then the required summation of joint entries is done by summing out the hidden variables:
• the terms in the summation are joint entries because Y, E and H together exhaust the set of random
variables
• Obvious problems
1. Worst-case time complexity O(dn) where d is the number of possible elments of variable
2. Space complexity O(dn) to store the joint distirbution
3. How to find the numbers (probabilities) for O(dn) entrtries?
• n – number of variables
Inference from Full joint distributions - 2
• Interpretations of Probabilities
• Probabilistic Inference
• Syntax:
• a set of nodes, one node per variable
• a directed, acyclic graph (link means “directly influences”)
• a conditional probabilty distribution (CPD) for each node given its
parents:
• P(Xi | Parents(Xi) )
• In the simplest case, conditional distribution are represented as a
conditional probability table (CPT) giving the distribution over Xi for
each combination of parent values
Example: Is it an Earthquake or burglar?
Example - 2
Markov Blanket (Cobertor de Markov)
A very simple Method to build Bayes
Networks
Exemplo
Another Example: Car Diagnosis
Another Example: Car Insurance
• Problem: Estimate expected costs (Medical, Liability,
Property) given some information (gray nodes)
I-map and D-map and Perfect Map
• I-map: All direct dependencies in the system being modeled
are explicitly shown via arcs. (Independence Map or I-map for
short).
• Inferência probabilística
Observe que α pode ser visto como um fator de normalização para o vetor resultante
da distribuição de probabilidade, pedida P(A|b). Assim pode-se evitar seu cálculo,
Simplesmente normalizando <P(a,b); P(⌐a , b) >
Inferência em Redes Bayesianas
Inferência por Enumeração
• Enumeração é ineficiente (ex. calcula P(j|a)P(m|a) repetidamente), mas pode ser melhorada através
do armazenamento dos valores já calculados (Programação Dinâmica)
Calculando P(b|j,m) não normalizado
0,0005922
0,001
+ 0,5922426
0,001197 0,591046
* 0,002 0,998
+ 0,598525 0,59223
0,001492
0,999
+ 0,001493
0,000366 0,001127
* 0,002 * 0,998
+ 0,183055 + 0,00113
0,001492
P (b | j , m ) 0,7159
0,0005922 0,001492
Algoritmo de Enumeração
Inferência por Enumeração
• Algoritmo de Enumeração permite determinar uma
distribuição de probabilidade condicional
• P(variável de saída| evidências conhecidas)
• Demonstração?….
Demonstração
como:
Inferência por Enumeração
• Como observado, a enumeração tende a recalcular várias
vezes alguns valores
• Inferência probabilística
• Problemas?
• Como determinar a topologia?
• Como estimar as probabilidades ?
• Quão complexas são essas tarefas?
• Isto é quantas topologias e quantas probabilidades precisariam ser
determinadas….
Tamanho das Tabelas de Probabilidade Condicional e
Distribuição Conjunta Total
• Vamos supor que cada variável é influenciada por no máximo k outras variáveis
(Naturalmente, k<n=total de variáveis).
• Enquanto, na distribuição conjunta Total haverá 2n entradas. Por exemplo, para n=30
com no máximo cinco pais (k=5) isto significa 960 ao invés de mais um bilhão (230)
Número de “entradas” da Distribuição
Conjunta e na Rede Bayesiana - 2
• Em domínios onde cada variável pode ser diretemante influenciada por
todas as outras, tem-se a rede totalmente conectada e assim exige-se a
quantidade de entradas da mesma ordem da distribuição conjunta total
• Problema a resolver:
Solução:
• P(Play|Outlook,Temp,Hum,Wind)=
• P(Outlook,Temp,Hum,Wind|Play)P(Play)/P(Outlook,Temp,Hum,
Wind)=
• Regra da cadeia e indepêndencia:
• P(Outlook|Play)P(Temp|Play)P(Hum|Play)P(Wind|Play)P(Play)/
P(Outlook,Temp,Hum,Wind)
• P(Play=s|Outlook=sunny,Temp=cool,Hum=high,Wind=tru
e)=
• P(sunny|play)P(cool|play)P(high|play)P(true|play)P(Play)
/P(evidencia) = 2/9*3/9*3/9*3/9*9/14 / P(e)
=0.0053/P( e)
Solução 3 - continuação
• Da mesma forma,
• P(sunny|play)P(cool|play)P(high|play)P(true|play)P(Play)/P(e) =
3/5*1/5*4/5*3/5*5/14/P(e) =0.0206/P( e)
• Mas P(H |e) e P(not H|e) tem que somar 1, assim:
Estimativas de Probabilides
• Qual a estimativa da probabilidade
P(Outlook=overcast|Play=no)?