# Lab 4 Solution

\$30.00

Category:

## Description

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 f4:9; 5:0; 5:1; 5:2; 5:3; 5:4; 5:5; 5:6; 5:7; 5:8g. The probability of height given that the person is a kid and adult is given by

 p(xjkid) = [0:1; 0:1; 0:1; 0:1; 0:1; 0:1; 0:1; 0:1; 0:1; 0:1] and p(xjadult) = [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]
1. 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]
1. 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]
1. 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 gure below): [10] (b) Repeat Q.1 when p(x kid) = p2 1 e 2 1 2 and p(x adult) = p2 2 e 2 2 2 are j 1 1 x 1 j 1 1 x 2 both one-dimensional Gaussian random variables. [10]
1. Repeat Q 2.2, with two attributes namely height and weight, i.e., x = (x1; x2), where x1 denotes height and x2 denotes weight.

 p(x kid) = 1 e 2 x 1 1111 2 1 e 2 x 2 1212 2 j p 1 p 1 2 11 2 12 and 1 1 2121 2 1 2 2222 2 p(x adult) = e 2 x e 2 x j p 1 p 1 2 21 2 22

[20]

End of paper

error: Content is protected !!