Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1 : Perceptron Learning ( 1 5 marks ) The dataset lab 0 2 _ dataset _ 1 . csv has a 3 -
Problem : Perceptron Learning marks
The dataset labdatasetcsv has a dimensional input space and a class label of
Positive and Negative. For this task, you are not allowed to use any functionalities of the
sklearn module.
Write a function myperceptron which applies perceptron algorithm on the
dataset to create a linear separator. myperceptron should return a dimensional
weight vector which can be used to create the linear separator. Use a classification
threshold of ie myperceptron will terminate once the misclassification
rate is less than marks
Create a D plot which showcases the dataset in a Dspace alongwith the linear
separator you obtained from myperceptron Use two different colors to represent
the data points belonging in the two classes for ease of viewing. marksProblem : Nave Bayes Learning marks
The dataset labdatasetxlsx contains observations on various vehicles. You
will use the observations in this dataset to train models that predict the usage of a vehicle.
Your models will use the following variables:
Output Label:
CARUSE. Vehicle Usage. It has two categories, namely, Commercial and Private.
Input Features:
CARTYPE. Vehicle Type. It has six categories, namely, Minivan, Panel Truck,
Pickup, SUV, Sports Car, and Van.
OCCUPATION. Occupation of Vehicle Owner. It has nine categories, namely,
Clerical, Home Maker, Doctor, Lawyer, Manager, Professional, Blue Collar,
Student, and Unknown.
EDUCATION. Highest Education Level of Vehicle Owner. It has five categories
namely Below High Sc High School, Bachelors, Masters, PhD
You will use only observations where there are no missing values in all the above four
variables. After dropping the missing values, you will use all the complete
observations for training your Nave Bayes models using sklearn. For each observation,
you will calculate the predicted probabilities for CARUSE Commercial and CARUSE
Private. You will classify the observation in the CARUSE category that has the highest
predicted probability. In case of ties, choose Private category as the output.
You will train a Nave Bayes model with a Laplace smoothing of marks
Output the Class counts and Probabilities Also display the probability of the
input variables, given each output label alongwith their counts. marks
Let us study a couple of fictitious persons test cases One person works in a Blue
Collar occupation, has an education level of and owns an SUV. Another person
works in a Managert occupation, has a Below High Sc level of education, and owns
a Sports Car. What are the Car Usage probabilities of both these people? marks
Generate a histogram of the predicted probabilities of CARUSE Private. The
bin width is The vertical axis is the proportion of observations. marks
Finally, what is the misclassification rate of the Nave Bayes model? marks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started