0% found this document useful (0 votes)
52 views2 pages

Aml Lab 2

The document provides instructions for students to complete three tasks involving linear regression, polynomial regression, and logistic regression models. Task 1 involves finding the slope, intercept, and predicting an outcome for a linear regression problem with years of experience and performance rating data. Task 2 involves loading an advertising dataset, splitting into train and test, and implementing linear and polynomial regression to predict sales. Task 3 involves loading an Iris dataset, splitting into train and test, and implementing logistic regression to classify flowers by species and evaluate performance.

Uploaded by

Rohit Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views2 pages

Aml Lab 2

The document provides instructions for students to complete three tasks involving linear regression, polynomial regression, and logistic regression models. Task 1 involves finding the slope, intercept, and predicting an outcome for a linear regression problem with years of experience and performance rating data. Task 2 involves loading an advertising dataset, splitting into train and test, and implementing linear and polynomial regression to predict sales. Task 3 involves loading an Iris dataset, splitting into train and test, and implementing logistic regression to classify flowers by species and evaluate performance.

Uploaded by

Rohit Rai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

School of Computer Science Engineering and Technology

Course- Ph.D Type- Core


Course Code- ECSE601-L Course Name-AML
Year- 2024 Semester- EVEN
Date- 16-02-2024 Batch- NA

Max. Marks: 3
LAB ASSIGNMENT - #2

Objective: To provide hands-on experience to students in implementing and applying linear


regression models and evaluate the performance.

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.

b) Separate the features into X and target value in Y.

c) Split the dataset into training and testing by “train_test_split” library from sklearn.

d) Implement the linear regression model from scikit-learn to predict sales on


features.
School of Computer Science Engineering and Technology

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.

Task 3. Download the following dataset:

IRIS Dataset: https://www.kaggle.com/datasets/erscodingzone/user-datacsv

Or you can directly import the dataset from sklearn.datasets.

g) Read the dataset and print the different statistical values and shape of data.

h) Split the dataset into training and testing set.

i) Implement logistic regression model.

j) Evaluate the performance using Accuracy, Precision, Recall, F-Score, AUC.

Other Practice Questions (will not be evaluated):

▪ 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.

▪ Print other classification metrics such as: classification report


(sklearn.metrics.classification_report),
▪ confusion matrix (sklearn.metrics.confusion_matrix)

You might also like