Question: ( a ) Plot the normalized histogram of the petal length for all of the data without regard to iris type from 0 to 6

(a) Plot the normalized histogram of the petal length for all of the data without regard to iris type from 0 to 6 with bin size 0.2. The normalized histogram can be computed by dividing the count in each bin by the number of observations times the bin width. In python, this can be selected by passing "density True"into the matplotlib.pyplot.hist or pandas.DataFrame.hist functions. (b) Calculate empirical mean m and standard deviation of the petal length. For a set of data [l1, l2,.,ln J, these can be computed by: In python, these can be computed by pandas.DataFrame.mean and pandas.DataFrame.std functions (c) Assume that the probability density function of the petal length, fi.(I), is given by a Gaussian distribution with mean and standard deviation computed above. You can compute values of the Gaussian distribution in python using the scyipy.stats.norm.pdf function. Note that the Gaussian distribution is also called the normal distribution Compare the normalized histogram with the plot of f,(l) by plotting both together in the same figure for I from 0 to 6. Does this look like a good model of the data? (d) Now generate plots of normalized histogram of petal length for each iris type separately. (e) Compute the empirical conditional mean and conditional variance of the petal length for each iris type using the same equation as in (b) except the summations only contain data for each iris type. In Python, you can do this automatically using "groupby". (f) Assume that the conditional probability density functions of the petal length given Setosa and Virginica, fltype (lISetosa) and ftltype(l]Versicolor), are given by Gaussian distributions with means and variances computed in (e), respectively For each iris type, compare the normalized histogram with the conditional density by plotting them both in the same figure for / from 0 to 6. Does the Gaussian assumption look like a good assumption when each iris type is considered in isolation? (g) Assume that PISetosa]= P[Versicolor]=0.5. Use the total probability theorem to combine the two conditional densities to obtain a new model distribution for the petal length, gi(l). Compare the plot of g,() with the normalized histogram in (a) by plotting both in the same figure for I from 0 to 6. How does this compare with the single Gaussian assumption in part (c)?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!