Question: in R: How do you write a function that performs Naive Bayes classification for the iris data. The function will output probabiity estimates of the
in R:
How do you write a function that performs Naive Bayes classification for the iris data. The function will output probabiity estimates of the species for a test case.
The function will accept three inputs: a row matrix for the x values of the test case, a matrix of x values for the training data, and a vector of class labels for the training data.
The function will create the probability estimates based on the training data it has been provided.
Within the function use a Gaussian model and estimate the mean and standard deviation of the Gaussian populations based on the training data provided. (Hint: You have 24 parameters to estimate: the mean and standard deviation of each of the 4 variables for each of the three species. With the naive assumption, you do not have to estimate any covariances.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
