Back
Uncategorized

Probabilistic Learning – Classification Using Naive Bayes.

Probabilistic Learning – Classification Using Naive Bayes..

Description Instructions Your exam will be conducted completely online. The exam is open book, open notes, open browser. Upload two files to the designated folder. 1. “lastname_firstname_midterm.R” which contains the R script and commented answers, demarcated by question numbers. 2. “lastname_firstname_midterm.docx” which contains the screenshots or pasted values of R outputs, demarcated by question numbers. (20 points total, 2 points for each sub question). Use the car dataset provided in the folder for the below questions. a) Read the dataset into R as a dataframe, do not use stringAsFactors=FALSE b) Look at the structure of the dataset. How many variables, rows and columns are present in the dataset. What is the data type of each variable? (Enter the response as a comment in the script.) c) Tabulate the class variable. What is the proportion of cars in each category? (round to 2 decimal places.) (Enter the response as a comment in the script.) d) Convert the categorical variables other than class into the type numeric using as.numeric function. Note: Make sure you don’t miss out on adding the class column while doing this (Hint: You might want to check the cbind function). e) Split the dataset into 75% training and 25% test. f) Run the k-NN algorithm on the dataset with k=3 and class as the categorizing variable. g) Build the confusion matrix when k=3. What is the overall error rate? (Enter the response as a comment in the script.) h) Run the k-NN algorithm on the dataset with k=5 and class as the categorizing variable. i) Build the confusion matrix. What is the overall error rate? (Enter the response as a comment in the script.) j) What percentage of the acceptable cars have been misclassified when k=5? (Enter the response as a comment in the script.)

Probabilistic Learning – Classification Using Naive Bayes.