Aml Lab 2
Aml Lab 2
Max. Marks: 3
LAB ASSIGNMENT - #2
Task 1. Consider the following example: Experience of technicians in a company (in a number of
years) and their performance rating is given.
Exp. in 16 12 18 4 3 10 5 12
years
Performance 87 88 89 68 78 80 75 83
rating
[Without importing sklearn library]
i. Find out the slope and intercept by least square method.
ii. Estimate the performance rating for a technician with 30 years of experience.
Task 2. Download the following dataset: Advertising Dataset: Predicting sales based on
advertising channels. URL: https://www.statlearning.com/s/Advertising.csv
a) Read the dataset into the data frame ‘df’ and print the different statistical values and
shape of data.
c) Split the dataset into training and testing by “train_test_split” library from sklearn.
e) Implement the Polynomial regression model with (degree 2,3,4) from scikit-learn
to predict the Sales.
f) Evaluate the performance using MSE, RMSE, MAE, and R2 Score on three different
model separately and print them.
g) Read the dataset and print the different statistical values and shape of data.
▪ Preprocess data with different feature scaling methods (i.e. scaling, normalization,
standardization, etc.) and observe accuracies on given dataset.
▪ Train model on different train-test splits such as 60-40, 50-50, 70-30, 80-20, 90-10, 95-5 etc.
and observe accuracies.
▪ Shuffle training samples with different random seed values in the train_test_split function.
Check the model error for the testing.