You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A farmer is concerned about protecting his orange farm from thieves during the night while he is sleeping. He has installed a sensitive alarm system that can be triggered by intruders, sheep roaming the farm, or thunder. The farmer uses a Bayesian Network to model the situation and make informed decisions about activating the alarm to ensure the safety of his oranges. The Bayesian Network includes the following random variables:
IntruderPresence (I): Presence of intruders on the farm. States: True (intruders present), False (no intruders).
SheepPresence (S): Presence of sheep on the farm, which could trigger the alarm. States: True (sheep present), False (no sheep).
Thunder (T): Occurrence of thunder, which could trigger the alarm. States: True (thunder occurs), False (no thunder).
AlarmTriggered (A): Whether the alarm is triggered. States: True (alarm triggered), False (alarm not triggered).
FarmerWakeUp (F): Farmer's decision to wake up and defend the oranges. States: True (farmer wakes up), False (farmer remains asleep).
OrangeSafety (O): Safety of the oranges. States: 1 (oranges secure), 0 (oranges at risk).
The farmer has collected probability data in a dataset (night_farm_dataset.csv).
Task a) Model the Bayesian Network
Construct a directed acyclic graph (DAG) for the Bayesian Network. Define the nodes (variables) and edges (dependencies) based on the scenario. Provide a brief explanation of the dependencies chosen. Draw the DAG (sketch or describe in text).
Dependency Justification
Edge
Reason
I → A
Intruders trigger the alarm
S → A
Sheep roaming can trigger the alarm
T → A
Thunder can trigger the alarm
A → F
Farmer wakes up only if alarm sounds
I → O
Intruders directly threaten orange safety
F → O
Farmer waking up protects the oranges
Result Table for Task a
Component
Description
Number of Nodes
6 (I, S, T, A, F, O)
Number of Edges
6
Graph Type
Directed Acyclic Graph (DAG)
Task b) Construct Conditional Probability Tables (CPTs)
Define the CPTs for each variable, listing states and probabilities conditioned on parent nodes. For variables with no parents, provide prior probabilities. Assume realistic probability values from the dataset if specific values are unavailable, ensuring probabilities sum to 1.
Prior Probabilities
Variable
P(True)
I
0.04999
S
0.30099
T
0.09843
P(A | I, S, T)
I
S
T
P(A=True)
Support
True
True
True
0.9065
139
True
True
False
0.9424
1,337
True
False
True
0.9190
395
True
False
False
0.9156
3,128
False
True
True
0.7983
2,786
False
True
False
0.7478
25,837
False
False
True
0.5924
6,523
False
False
False
0.0096
59,855
P(F | A)
A
P(F=True)
Support
True
0.8019
30,595
False
0.0486
69,405
P(O | I, F)
I
F
P(O=True)
Support
True
True
1.0000
3,671
True
False
0.0000
1,328
False
True
1.0000
24,237
False
False
1.0000
70,764
Result Table for Task b
CPT
Number of Entries
Source
P(I)
2
Dataset (100,000 rows)
P(S)
2
Dataset (100,000 rows)
P(T)
2
Dataset (100,000 rows)
P(A|I,S,T)
8
Dataset (100,000 rows)
P(F|A)
2
Dataset (100,000 rows)
P(O|I,F)
4
Dataset (100,000 rows)
Task c) Calculate Marginal Probabilities
Using the Bayesian Network and CPTs, calculate the marginal probabilities for each variable (I, S, T, A, F, O) with no prior evidence. Show calculations, including chain rule or marginalization.