0% found this document useful (0 votes)
32 views4 pages

Department of Electronics& Computer Science (PP Experiment No.6)

Uploaded by

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

Department of Electronics& Computer Science (PP Experiment No.6)

Uploaded by

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

Department of Electronics& Computer Science

(PP Experiment No.6)

Semester S.E. Semester III– Electronics & Computer Science


Subject Python Programming Laboratory
Subject Professor Prof. Manoj Suryawanshi
In-charge Prof. Anuradha Joshi
Lab Teacher Prof. Manoj Suryawanshi
Laboratory L05

Student Name Atharva Joshi


Roll Number 24108A2010
Grade and Subject
Teacher’s Signature

Experiment Number 6
Python Application in Machine Learning
Experiment Title
Develop a machine learning model using Python to predict
Problem Statement
the salary of an individual based on their years of
experience. You are provided with a dataset that contains
information about employees, including their years of
experience and corresponding salaries. The goal is to use
this data to train a model that can accurately predict
salaries for new inputs based on experience. The model's
performance should be evaluated using appropriate metrics,
and the results should be analysed to ensure the reliability
of the predictions.

Resources / Python IDE


Apparatus Required
Objectives In this experiment students will understand the basics
(Skill Set / concepts of machine learning using Python
Knowledge Tested /
Imparted)
Dataset:
YearsExperien
ce Salary

1.1 39343

1.3 46205

1.5 37731

2 43525

1
Department of Electronics& Computer Science
(PP Experiment No.6)
2.2 39891

2.9 56642

3 60150

3.2 54445

3.2 64445

3.7 57189

3.9 63218

4 55794

4 56957

4.1 57081

4.5 61111

4.9 67938

5.1 66029

5.3 83088

5.9 81363

6 93940

6.8 91738

7.1 98273

7.9 101302

8.2 113812

8.7 109431

9 105582

9.5 116969

9.6 112635

10.3 122391

2
Department of Electronics& Computer Science
(PP Experiment No.6)
10.5 121872

Program:

import matplotlib.pyplot as plt


import pandas as pd

dataset = pd.read_csv('Salary_Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values

from sklearn.model_selection import train_test_split


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2,
random_state = 1)

from sklearn.linear_model import LinearRegression


regressor = LinearRegression()
regressor.fit(X_train, y_train)

y_pred = regressor.predict(X_test)

prediction = regressor.predict([[10]])

regressor.coef_

regressor.intercept_

#y=mx+C
Salary=9332*10+25609
print(Salary)

accuracy = Salary/prediction*100

print(accuracy)

Result:

3
Department of Electronics& Computer Science
(PP Experiment No.6)

You might also like