Git Product home page Git Product logo

ml_ex04_implementation-of-logistic-regression-model-to-predict-the-placement-status-of-student's Introduction

Ex04 - Implementation-of-Logistic-Regression-Model-to-Predict-the-Placement-Status-of-Student

AIM:

To write a program to implement the the Logistic Regression Model to Predict the Placement Status of Student.

Equipments Required:

  1. Hardware โ€“ PCs
  2. Anaconda โ€“ Python 3.7 Installation / Jupyter notebook

Algorithm

  1. Use the standard libraries in python for finding linear regression.
  2. Set variables for assigning dataset values.
  3. Import linear regression from sklearn.
  4. Predict the values of array.
  5. Calculate the accuracy, confusion and classification report by importing the required modules from sklearn.
  6. Obtain the graph.

Program:

/*
Program to implement the the Logistic Regression Model to Predict the Placement Status of Student.
Developed by: Janarthanan V K
RegisterNumber:  212222230051
*/
import pandas as pd
df = pd.read_csv("Placement_Data.csv")
df.head()
df.isnull().sum()
df1 = df.copy()
df1.duplicated().sum()

from sklearn.preprocessing import LabelEncoder
le=LabelEncoder()
df1["gender"]=le.fit_transform(df1["gender"])
df1["ssc_b"]=le.fit_transform(df1["ssc_b"])
df1["hsc_b"]=le.fit_transform(df1["hsc_b"])
df1["hsc_s"]=le.fit_transform(df1["hsc_s"])
df1["degree_t"]=le.fit_transform(df1["degree_t"])
df1["workex"]=le.fit_transform(df1["workex"])
df1["specialisation"]=le.fit_transform(df1["specialisation"])
df1["status"]=le.fit_transform(df1["status"])
df1

x = df1.iloc[:, : -1]
y = df1["status"]

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=34)

from sklearn.linear_model import LogisticRegression
model = LogisticRegression(solver = "liblinear")
model.fit(x_train, y_train)
y_pred = model.predict(x_test)

from sklearn.metrics import accuracy_score,confusion_matrix,classification_report
accuracy = accuracy_score(y_test, y_pred)
confusion = confusion_matrix(y_test, y_pred)
cr = classification_report(y_test ,y_pred)

print("Accuracy score:",accuracy)
print("\nConfusion matrix:\n",confusion)
print("\nClassification Report:\n",cr)

model.predict([[1,80,1,90,1,1,90,1,0,85,1,85]])

Output:

Data Information:

Data Status:

Accuracy Value:

Confusion Value:

Classification Report:

Prediction of LR:

Result:

Thus the program to implement the the Logistic Regression Model to Predict the Placement Status of Student is written and verified using python programming.

ml_ex04_implementation-of-logistic-regression-model-to-predict-the-placement-status-of-student's People

Contributors

janarthanan2 avatar akilamohan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.