Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary lines for Admission Prediction using ML #158

Open
ahmtkltr opened this issue May 31, 2023 · 0 comments
Open

Unnecessary lines for Admission Prediction using ML #158

ahmtkltr opened this issue May 31, 2023 · 0 comments

Comments

@ahmtkltr
Copy link

Describe the bug
There is a two line of code in the script that affects to run correctly.
And they are useless. pandas can read csv file without them. so we can clean those.

To Reproduce
Steps to reproduce the behavior:
just run all the script.

Clean version;

Admission_Prediction_using_Machine_Learning By Zahra Shahid

"""# Import libraries"""

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

"""# Upload and Read file"""

#from google.colab import files
#files.upload()

df = pd.read_csv("Admission_Predict_Ver1.1.csv")

df.head(8)

"""# Cleaning the data"""

df.columns

df.drop('Serial No.',axis=1,inplace=True)

df.head()

"""#Exploratory Data Aanalysis"""

df.describe()

df.corr()

sns.heatmap(df.corr(), annot=True)

sns.distplot(df.CGPA)

sns.pairplot(df,x_vars=['SOP','GRE Score','TOEFL Score','CGPA'],y_vars=['Chance of Admit '],height=5, aspect=0.8, kind='reg')

"""# Creating Model"""

df.columns

x=df[['GRE Score', 'TOEFL Score', 'CGPA']]

y=df[['Chance of Admit ']]

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import random

x_train, x_test, y_train, y_test =train_test_split(x,y,test_size=0.20,random_state=0)

x_train.shape

y_train.shape

linreg = LinearRegression()
linreg.fit(x_train,y_train)

"""# Testing and Evaluating the Model"""

y_pred=linreg.predict(x_test)

y_pred[:7]

y_test.head(7)

from sklearn import metrics
print(metrics.mean_absolute_error(y_test,y_pred)) #96% prediction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant