%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Weather forecast using Bayesian updating. %
% Edit relation weather for different %
% meteorological conditions. %
% Run program with the query: %
% weather(P_warm, P_rain). %
% Adrian Hopgood 2011. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
group weather_rules
r1 ,
r2 ,
r3 ,
r4 ,
r5 ,
r6 ,
r7 ,
r8 ,
r9 ,
r10 ,
r11 ,
r12 .
uncertainty_rule r1
if the clouds is rounded (affirms 19.0; denies 0.05)
then the clouds is cumulus .
uncertainty_rule r2
if the clouds is dark (affirms 19.0; denies 0.05)
then the clouds is nimbus .
uncertainty_rule r3
if the clouds is high (affirms 19.0; denies 0.05)
then the clouds is alto .
uncertainty_rule r4
if the clouds is layered (affirms 19.0; denies 0.05)
then the clouds is stratus .
uncertainty_rule r5
if the clouds is thin (affirms 19.0; denies 0.05)
then the clouds is cirrus .
uncertainty_rule r6
if the clouds is nimbus (affirms 2.7; denies 0.3)
and the clouds is alto (affirms 1.6; denies 0.4)
and the clouds is stratus (affirms 1.7; denies 0.7)
and the clouds is cirrus (affirms 0.7; denies 1.1)
and the clouds is cumulus (affirms 0.1; denies 1.6)
then the forecast is rain .
uncertainty_rule r7
if the wind is west (affirms 2.0; denies 0.7)
then the forecast is rain .
uncertainty_rule r8
if the pressure is low (affirms 5.0; denies 0.01)
then the forecast is rain .
uncertainty_rule r9
if the wind is north (affirms 9.0; denies 0.1)
then the forecast is warm .
uncertainty_rule r10
if the wind is east (affirms 0.1; denies 9.0)
then the forecast is warm .
uncertainty_rule r11
if the wind is west (affirms 9.0; denies 0.1)
then the forecast is warm .
uncertainty_rule r12
if the wind is south (affirms 9.0; denies 0.1)
then the forecast is warm .
relation weather( P_warm, P_rain)
if reset all probability values
and the probability that the clouds is rounded = 0
and the probability that the clouds is dark = 1
and the probability that the clouds is thin = 0
and the probability that the clouds is high = 1
and the probability that the pressure is low = 1
and the probability that the wind is north = 0
and the probability that the wind is south = 0.5
and the probability that the wind is east = 0
and the probability that the wind is west = 0.5
and propagate weather_rules probability rules
and the probability that the forecast is warm = P_warm
and the probability that the forecast is rain = P_rain .