In this project you will build a model that predicts whether a final-year student will be placed, from academic and skill data - the kind of tool a college Training & Placement cell could use to find students who need extra support early.
placement.csv - 600 students (synthetic data created for Vindhyaedu), already loaded in every editor on this page.
Columns: student_id, branch (CSE/IT/ECE/ME/CE), cgpa, internships, projects, aptitude_score (0-100, some missing), communication (1-10, some missing), backlogs, certifications, placed (1/0, the target), salary_lpa (only for placed students).
Step 1: understand the problem#
- Task: binary classification -
placed= 1 or 0. - Features: everything known before placement season.
- Not a feature:
salary_lpa- it only exists after a student is placed. Using it would leak the answer. - Metric: accuracy overall, plus recall for "not placed" - the cell wants to catch at-risk students.
Step 2: explore the data#
(600, 11)
aptitude_score 14
communication 10
salary_lpa 188
dtype: int64
Placement rate: 0.687
By branch:
count mean
branch
IT 106 0.802
CSE 182 0.703
ECE 129 0.698
CE 79 0.633
ME 104 0.567
Average values, placed vs not placed:
cgpa internships aptitude_score backlogs
placed
0 6.98 0.78 63.15 1.12
1 7.69 1.05 67.44 0.68Placed students have a higher CGPA, more internships, higher aptitude scores and fewer backlogs - promising signals.
Step 3: prepare features with a pipeline#
features after preprocessing: 12 ['num__cgpa', 'num__internships', 'num__projects', 'num__aptitude_score', 'num__communication', 'num__backlogs', 'num__certifications', 'cat__branch_CE', 'cat__branch_CSE', 'cat__branch_ECE', 'cat__branch_IT', 'cat__branch_ME']
Step 4: compare models with cross-validation#
baseline 0.688 +/- 0.000 logistic regression 0.779 +/- 0.045 KNN (k=15) 0.744 +/- 0.016 decision tree 0.694 +/- 0.017 random forest 0.750 +/- 0.026 gradient boosting 0.731 +/- 0.062
हमने test set को छुए बिना, सिर्फ़ training data पर 5-fold cross-validation से कई models की तुलना की। हर model को baseline (हमेशा "placed" बोलने वाला) से बेहतर होना चाहिए। सबसे अच्छा model चुनकर उसे tune करेंगे, और test set पर सिर्फ़ एक बार आखिरी जाँच करेंगे।
Step 5: tune, then evaluate once on the test set#
Logistic regression performs at least as well as the more complex models here (the data has fairly simple, additive patterns), so we tune its regularisation strength C and evaluate it:
best C: 0.1 CV accuracy: 0.767
[[18 20]
[ 8 74]]
precision recall f1-score support
not placed 0.692 0.474 0.562 38
placed 0.787 0.902 0.841 82
accuracy 0.767 120
macro avg 0.740 0.688 0.702 120
weighted avg 0.757 0.767 0.753 120About 77% of test students are classified correctly - clearly better than the 69% baseline. But look at the not placed row: recall is only about 0.47, so the model finds fewer than half of the at-risk students. For the placement cell that is the number that matters, so in practice you would lower the decision threshold (for example, flag anyone with P(placed) below 0.7), accepting more false alarms in exchange for catching more students who need help.
Step 6: explain the model#
A model the placement cell cannot explain will not be trusted. Logistic regression's coefficients (on scaled features) show the direction and strength of each factor:
backlogs -0.62 branch_CE -0.59 branch_ME -0.44 branch_ECE 0.17 certifications 0.19 branch_CSE 0.23 projects 0.33 aptitude_score 0.42 communication 0.44 internships 0.47 branch_IT 0.62 cgpa 1.00 dtype: float64
Reading it: CGPA, internships and aptitude push the probability of placement up; backlogs push it down. That gives the cell concrete advice - clear backlogs, do an internship, practise aptitude.
Step 7: predict for new students#
Riya P(placed) = 0.99 -> on track Manav P(placed) = 0.05 -> needs mentoring Sakshi P(placed) = 0.83 -> on track
Sakshi's aptitude score is missing - the pipeline's imputer fills it in automatically.
Take it further#
- Real data - try the Kaggle Campus Recruitment or Placement Data datasets, or anonymised data from your own college (with permission).
- Salary model - a regression model predicting
salary_lpafor placed students. - Threshold - lower the threshold for "needs mentoring" to raise recall for at-risk students.
- Deploy - save the pipeline with
joblib.dump(model, "placement.pkl")and serve it from a Flask or FastAPI app, or a Streamlit dashboard. - Fairness - check that the model's errors are similar across branches and genders before using it for real decisions.
A model like this should support human decisions (who to mentor), never replace them. Predictions are probabilities learned from past data, which may contain historical biases.
Summary#
You completed a full ML project: problem framing, leakage check, EDA, a preprocessing pipeline, model comparison with cross-validation, tuning, a single honest test evaluation, interpretation and prediction for new cases - the same process used in industry.