<jupyter_start><jupyter_text>EDA<jupyter_code>sns.countplot(df['Gender'])<jupyter_output><empty_output><jupyter_text>Number of Males Are More than Female For Placements.<jupyter_code>plt.figure(figsize=(16,4))
sns.countplot(df.Stream)<jupyter_output><empty_output><jupyter_text>We can See that for placements Students From Computer Science And It are More than And Other Stream.<jupyter_code>plt.figure(figsize=(13,5))
df.groupby('Stream')['Internships'].sum().plot(kind='bar')<jupyter_output><empty_output><jupyter_text>From The Following Graph We can that that Students From Computer Science Has More Internships than Any Other Stream.<jupyter_code>plt.figure(figsize=(13,5))
df.groupby('Stream')['PlacedOrNot'].sum().plot(kind='bar')<jupyter_output><empty_output><jupyter_text>From The Graph We can that that Students From Computer Science and It Has More Chance of Getting Placed Than Any Other Steam.  Encoding<jupyter_code>from sklearn.preprocessing import LabelEncoder
lr = LabelEncoder()
df['gender'] = pd.DataFrame(lr.fit_transform(df[['Gender']]))
df.head()
df['stream'] = pd.DataFrame(lr.fit_transform(df['Stream']))
df2 = df.drop(['Gender','Stream'],axis=1)
X = df2.drop('PlacedOrNot',axis=1)
y = df2.PlacedOrNot
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.3,random_state=1)<jupyter_output><empty_output><jupyter_text>Logistic Regression<jupyter_code>from sklearn import metrics
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report
from sklearn.metrics import cohen_kappa_score
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_curve
from sklearn.metrics import accuracy_score

# import function to perform feature selection
from sklearn.feature_selection import RFE
log_reg = LogisticRegression()
log_reg.fit(X_train,y_train)
y_pred = log_reg.predict(X_test)
print('Accuracy Score',accuracy_score(y_test,y_pred)*100)
#model has 76% Accuracy...
FP_rate,TP_rate,threshold=roc_curve(y_test,y_pred)

plt.figure(figsize=(15,8))
plt.plot(FP_rate,TP_rate,color='red')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.0])
plt.title('ROC curve for Admission Prediction Classifier (Full Model)', fontsize = 15)
plt.xlabel('False positive rate (1-Specificity)', fontsize = 15)
plt.ylabel('True positive rate (Sensitivity)', fontsize = 15)
plt.text(x = 0.02, y = 0.9, s = ('AUC Score:', round(metrics.roc_auc_score(y_test, y_pred),4)))                               
plt.grid(True)
plt.show()<jupyter_output><empty_output><jupyter_text>Decision Tree:-<jupyter_code>from sklearn.tree import DecisionTreeClassifier
DT=DecisionTreeClassifier() 
DT_model_full = DT.fit(X_train,y_train) 
y_pred_test = DT_model_full.predict(X_test) 
print("Accuracy Score on Test dayta:\t",accuracy_score(y_test,y_pred_test))
y_pred_train = DT_model_full.predict(X_train) 
print("Accuracy Score on Train Data:\t",accuracy_score(y_train,y_pred_train))
FP_rate,TP_rate,threshold=roc_curve(y_test,y_pred_test)

plt.figure(figsize=(15,8))
plt.plot(FP_rate,TP_rate,color='red')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.0])
plt.title('ROC curve for Admission Prediction Classifier (Full Model)', fontsize = 15)
plt.xlabel('False positive rate (1-Specificity)', fontsize = 15)
plt.ylabel('True positive rate (Sensitivity)', fontsize = 15)
plt.text(x = 0.02, y = 0.9, s = ('AUC Score:', round(metrics.roc_auc_score(y_test, y_pred_test),4)))                               
plt.grid(True)
plt.show()<jupyter_output><empty_output><jupyter_text>From the Above Both Models We Can Say That Decision Tree Has Better Accuracy Than Logistic Regression In this DataSet.<jupyter_code>X_train.head(2)<jupyter_output><empty_output><jupyter_text>Lets Predict...<jupyter_code>Val = [[30,0,8,0,0,1,5]]
print("Predicted VAlue:- ",DT_model_full.predict(Val) )<jupyter_output>Predicted VAlue:-  [1]
{'fraction_non_alphanumeric': 0.13853258081067213, 'fraction_numerical': 0.022575679835813236, 'mean_word_length': 7.331196581196581, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '400653', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1399, 'n_words': 276, 'path': 'College_placement_Prediction.ipynb', 'repo_name': 'shubhambhatt623/College_Placement_prediction', 'size': '3898'}