$24
1. A village contains only kids and adults. The probability of a random citizen being a kid is given by P (kid) and that of an adult is P (adult). Each person is also having a discrete attribute called height denoted by x, which takes values in the set {4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8}. The probability of height given that the person is a kid and adult is given by
p(x|kid) = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
and
p(x|adult) = [0.02, 0.02, 0.02, 0.02, 0.02, 0.18, 0.18, 0.18, 0.18, 0.18]
(a) Implement an environment called village that produces a random person in this village, i.e., it gives out the two tuple (kid/adult,height). Query the environment for say n = 100,
1000 times and then show the histograms for age, height, height given age. [25] (b) Implement an agent which is initialized with P (kid) = p as input. The agent should also
contain another method which maps the height attribute to deciding adult or kid, using
Bayes Rule. [15] (c) Computing the expected loss of a given decision: Initialize the agent as well as environment,
query the environment some n = 100, 1000 or 10000 times. Pass the height attribute to
the agent and get the decision. The loss is 1 if the decision is not same as the state,
otherwise it is 0. Average the loss over n, and print it. [10]
2. A village contains kids as well as adults. The probability of kids is given by P (kid) and that of adult by P (adult). Each person is also having a continuous attribute called height denoted by x
(a) Repeat Q.1 for the following (see figure below): [10]
1 x−µ1 2
1 x−µ2 2
(b) Repeat Q.1 when p(x|kid) =
1
√2πσ1
e− 2 σ1
and p(x|adult) =
1
√2πσ2
e− 2 σ2
are
both one-dimensional Gaussian random variables. [10]
3. Repeat Q 2.2, with two attributes namely height and weight, i.e., x = (x1 , x2), where x1
denotes height and x2 denotes weight.
2 1
x −µ 2
1
p(x|kid) = √2πσ
1 x1 −µ11
−
e √
1 2 12
e−
and
2 σ11
11
2
2πσ12
σ12
2 1
x −µ 2
1
p(x|adult) = √2πσ
1 x1 −µ21
−
e √
1 2 22
e−
2 σ21
21
2
2πσ22
σ22
[20]
End of paper