CodSoft Data Science Internship โข Task 1
A complete Machine Learning pipeline โ from raw data to trained model โ that predicts passenger survival on the RMS Titanic using 6 classification algorithms with hyperparameter tuning.
891
Passengers
6
ML Models
7
Engineered Features
13+
Visualizations
Understanding the business problem and dataset
The sinking of the RMS Titanic on April 15, 1912, killed more than 1,500 of the 2,224 passengers and crew. This project builds a binary classification model to predict: Did a passenger survive?
By analyzing factors like passenger class, gender, age, fare, and family size, we can understand what made certain groups more likely to survive.
| Source | Kaggle (yasserh) |
| Rows | 891 |
| Columns | 12 |
| Target | Survived |
| Task | Binary Classification |
| Survival Rate | 38.4% |
| Column | Type | Description | Missing |
|---|
End-to-end workflow executed by python main.py
Complete file organization
6 classification algorithms trained and compared
GridSearchCV with 5-fold cross-validation is performed on the top 2 models. The search explores combinations of hyperparameters to find the optimal configuration that maximizes accuracy.
Random Forest Search Space
n_estimators: [100, 200, 300]
max_depth: [5, 10, 15, None]
min_samples_split: [2, 5]
min_samples_leaf: [1, 2]
Gradient Boosting Search Space
n_estimators: [100, 200, 300]
learning_rate: [0.01, 0.05, 0.1]
max_depth: [3, 5, 7]
min_samples_split: [2, 5]
Key source files from the project
All generated files saved in the outputs/ directory
Performance table comparing all 6 models across Train Accuracy, Test Accuracy, CV Mean, and CV Std.
Test set predictions with actual labels, predicted labels, survival probabilities, and correctness flags.
Serialized best model saved with Joblib for reuse and inference without retraining.
Step-by-step instructions
git clone https://github.com/yourusername/Titanic_Survival_Prediction.git
cd Titanic_Survival_Prediction
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
Download from Kaggle
and place Titanic-Dataset.csv in the dataset/ folder.
python main.py
This executes the complete ML pipeline automatically.
cd notebook
jupyter notebook Titanic_Survival_Prediction.ipynb
python main.py does