<jupyter_start><jupyter_text>Graduate Admissions By <NAME>In this project, I will derive a model that predicts the chance of getting admitted into a Masters program at UCLA.These are the columns that will be considered as features:    1. GRE Score for all students    2. TOEFL Score for international students    3. University Rating undergradaute university rating.    4. SOP or Statement of Purpose rating.    5. LOR or Letter Of Recommendation rating.    6. CGPA cumulative GPA out of 10    7. Research whether or not they have research experience.    And the last column is the `chance of admission` for each student.I intend to write a regression model that predicts the chance of admission based on the features provided above. AcknowledgementsThis data was provided by [Kaggle.com](https://www.kaggle.com/mohansacharya/graduate-admissions/home). Check out their datasets and competitions for practice with data analysis and machine learning. Citation_<NAME>, <NAME>, <NAME> : A Comparison of Regression Models for Prediction of Graduate Admissions, IEEE International Conference on Computational Intelligence in Data Science 2019._<jupyter_code>import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

%matplotlib inline
sns.set()

df = pd.read_csv('Admission_Predict.csv') # import the CSV to a dataframe

df.head() # show the first five columns
# Drop unused columns
df = df.drop(columns = ['Serial No.'])

df.head()<jupyter_output><empty_output><jupyter_text>StatisticsLet's look at the score distributions for students with and without research experience.<jupyter_code>g = sns.FacetGrid(df, col="Research",  size= 5, sharey=True, sharex = True)
g.map(sns.distplot, "GRE Score");
g.set_axis_labels("GRE Score", "Chance of Admit");
g = sns.FacetGrid(df, col="Research", size= 5, sharey=True, sharex = True)
g.map(sns.distplot, "CGPA");
g.set_axis_labels("CGPA", "Chance of Admit");<jupyter_output><empty_output><jupyter_text>It should be apparent now that the students with research experience have higher CGPA and GRE scores.Now we check if the data is far too correlated.<jupyter_code>plt.scatter(df['GRE Score'], df['CGPA']);
plt.xlabel('GRE Score')
plt.ylabel('CGPA')
plt.title('GRE vs CGPA')
plt.show()<jupyter_output><empty_output><jupyter_text>This appears to be highly correlated, but since the correlation coefficient is not over 0.9 we can safely assume that all of these colums are useful for machine learning training.<jupyter_code>sns.set(color_codes=True)
plt.figure(figsize=(14, 12))
sns.heatmap(df.astype(float).corr(), 
            linewidths=0.1, 
            square=True, 
            linecolor='white', 
            annot=True)
plt.show()<jupyter_output><empty_output><jupyter_text>Regression AnalysisSince we have a multidimentional analysis, it will be far too difficult to visualize how the model will approach decision solution.<jupyter_code>X = df[df.columns[:-1]] # features
y = df[df.columns[-1]] # classifier as a percentage

test = pd.read_csv('Admission_Predict_Ver1.1.csv') # import testing data
test = test.drop(columns = ['Serial No.'])
X_test = test[test.columns[:-1]] # testing features
y_test = test[test.columns[-1]] # testing classifiers
from sklearn import linear_model # only a linear model will be considered

lr = linear_model.LinearRegression().fit(X, y)

lr_pred = lr.predict(X_test)

from sklearn.metrics import mean_squared_error, r2_score

print("Linear Regression MSE: %.2f" % mean_squared_error(y_test, lr_pred))

print('Variance score: %.2f' % r2_score(y_test, lr_pred))
from sklearn.ensemble import RandomForestRegressor

rfr = RandomForestRegressor(n_estimators=100)

rfr.fit(X, y)

rfr_pred = rfr.predict(X_test)

print("Random Forest Regressor MSE: %.2f" % mean_squared_error(y_test, rfr_pred))

print('Variance score: %.2f' % r2_score(y_test, rfr_pred))
br = linear_model.BayesianRidge().fit(X, y)

br_pred = br.predict(X_test)

print("Bayesian Ridge MSE: %.2f" % mean_squared_error(y_test, br_pred))

print('Variance score: %.2f' % r2_score(y_test, br_pred))
rr = linear_model.Ridge(alpha=.5).fit(X, y)

rr_pred = rr.predict(X_test)

print("Ridge Regression MSE: %.2f" % mean_squared_error(y_test, rr_pred))

print('Variance score: %.2f' % r2_score(y_test, rr_pred))<jupyter_output>Ridge Regression MSE: 0.00
Variance score: 0.82<jupyter_text>The Random Forest Regressor seems to have the best variance score of 0.95 which makes it a near perfect predictor for acceptance in a graduate program.<jupyter_code><jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10195992072230786, 'fraction_numerical': 0.012111869632239595, 'mean_word_length': 5.43342776203966, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '309919', 'license': 'MIT', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1443, 'n_words': 469, 'path': 'GraduateAdmissions.ipynb', 'repo_name': 'techshot25/GraduateAdmissions', 'size': '4570'}