0% found this document useful (0 votes)
40 views2 pages

Titanic Survival Prediction WebApp

This project involves building a machine learning model to predict which passengers were more likely to survive the sinking of the Titanic using passenger data from the training and test sets. The model must be implemented in a web application using Streamlit that allows the user to select an ML algorithm (KNN, logistic regression, random forest), set hyperparameters, run classification on the test set, and view the confusion matrix of results.

Uploaded by

houssam ziouany
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Titanic Survival Prediction WebApp

This project involves building a machine learning model to predict which passengers were more likely to survive the sinking of the Titanic using passenger data from the training and test sets. The model must be implemented in a web application using Streamlit that allows the user to select an ML algorithm (KNN, logistic regression, random forest), set hyperparameters, run classification on the test set, and view the confusion matrix of results.

Uploaded by

houssam ziouany
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

M1 - 4MLSP - Machine Learning

Project: Binary Classification WebApp

PREAMBULE
This project is to be solved in groups of no more than three. Any form of plagiarism, even partially,
is strictly prohibited and will be punished. You will need to send a single notebook containing all your
commented python scripts.

CONTEXT
The sinking of the Titanic is one of the most infamous shipwrecks in history. On April 15, 1912,
during her maiden voyage, the widely considered “unsinkable” RMS Titanic sank after colliding with
an iceberg.

Unfortunately, there were not enough lifeboats for everyone onboard, resulting in the death of 1502
out of 2224 passengers and crew. While there was some element of luck involved in surviving, it
seems some groups of people were more likely to survive than others.

In this challenge, we ask you to build a predictive model that answers the question: “what sorts of
people were more likely to survive?” using passenger data (ie name, age, gender, socio-economic
class, …).

DATA
The data has been split into two groups:
• training set ([Link])
• test set ([Link]).

The training set should be used to build your machine learning models. For the training set, we
provide the outcome (also known as the “ground truth”) for each passenger. Your model will be
based on “features” like passengers’ gender and class. You can also use feature engineering to
create new features.

The test set should be used to see how well your model performs on unseen data. For the test set,
we do not provide the ground truth for each passenger. It is your job to predict these outcomes. For
each passenger in the test set, use the model you trained to predict whether or not they survived
the sinking of the Titanic.

TO DO
1. Make an EDA.
2. Preprocess the data with the function « ColumnTransformer».
3. K-NN Classifier with GridSearchCV
4. Logistic regression classifier with GridSearchCV
5. Random Forest classifier With GridSearchCV
6. Implement a web application using streamlit where the user can.

- Select the ML model to use.

- Hyperparameters setting like

- Run the classification with classify button!

- Finally, the application prints a confusion matrix like:

Good luck!!

Common questions

Powered by AI

An effective EDA for the Titanic dataset should include summary statistics of the data, visualization of the distribution of each feature, analysis of correlations between features, and investigation of missing data patterns. Also, exploration of categorical variables like gender, class, and embarked location can reveal insights into survival rates. Feature relationships with the target variable (survival) should be visualized to identify potential predictors .

Challenges include overfitting to the training set, ensuring model generalization to the unseen test set, and dealing with potentially missing or anomalous data qualities not present in training. Rigorous cross-validation, feature normalization, regularization techniques, and careful feature selection with thorough EDA can mitigate these challenges ensuring accurate predictions .

GridSearchCV is recommended because it systematically works through multiple combinations of parameter values to evaluate model performance using cross-validation, ensuring a robust and unbiased selection of the best-performing set of hyperparameters for models like K-NN, Logistic Regression, and Random Forest. It balances accuracy with computational cost, particularly important in complex datasets such as the Titanic passenger data .

Feature engineering could enhance model performance by converting categorical variables into numerical ones, creating interaction terms between variables like age and class, and introducing new features such as family size or title extracted from names. Imputation of missing values with insights from related data points, and binning continuous variables such as age into ranges could also improve performance .

Key considerations include ensuring user interface intuitiveness for selecting ML models, setting hyperparameters, and triggering predictions. It should efficiently load and preprocess new data, dynamically update the interface based on user interaction, and display results like a confusion matrix clearly. Security and latency assessments are crucial for handling client-server interactions .

Random Forest classifier offers advantages such as inherent handling of missing data, robustness to overfitting due to its ensemble nature, and ability to measure the relative importance of each feature. Compared to K-NN, it scales better with the number of features and data size, and unlike Logistic Regression, it can model non-linear relationships without requiring feature transformation, which can be significant in complex datasets like Titanic .

The confusion matrix enables evaluation by displaying true positive, false positive, true negative, and false negative predictions, facilitating the calculation of performance metrics such as accuracy, precision, recall, and F1-score. These metrics help understand the classifier's performance on survival prediction particularly in imbalanced classifications typical in datasets like Titanic .

Using historical datasets necessitates consideration of privacy as real individuals' data is used, albeit anonymized. It's crucial to mitigate biases that may arise in the dataset due to historical inequalities, and ensure that models do not perpetuate these biases. Responsibility in accurate representation and handling of sensitive information is critical, along with the implication of derived insights that should not reinforce stereotypes .

K-NN might be preferred if the aim is to maintain simplicity in implementation or when the dataset is small and low dimensional, as it does not require a training phase unlike others. It can also be intuitive to adjust neighbors for better performance in locally nuanced datasets. However, it might struggle with handling missing data or large datasets effectively .

The context suggests focusing on features that historically influenced survival such as age, gender, and class. Preprocessing might include handling missing age entries, encoding gender, and considering the cabin as a location. The socio-economic class demands conversion to numerical form for analytical utility. Deep understanding of the incident directs the identification of relevant features .

You might also like