0% found this document useful (0 votes)
7 views10 pages

Task 4

This report details a mini-project applying supervised learning models to the Titanic dataset, focusing on data cleaning, feature engineering, and model evaluation. Two models, Linear Regression and Decision Tree, were trained and assessed, with the Decision Tree achieving an accuracy of 77.09%, outperforming the Linear Regression model. The findings emphasize the effectiveness of supervised learning techniques in predictive analytics and the importance of data preprocessing.
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)
7 views10 pages

Task 4

This report details a mini-project applying supervised learning models to the Titanic dataset, focusing on data cleaning, feature engineering, and model evaluation. Two models, Linear Regression and Decision Tree, were trained and assessed, with the Decision Tree achieving an accuracy of 77.09%, outperforming the Linear Regression model. The findings emphasize the effectiveness of supervised learning techniques in predictive analytics and the importance of data preprocessing.
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

INTERNSHIP MINI-PROJECT REPORT

4. SUPERVISED LEARNING MODELS ON THE


TITANIC DATASET

Submitted By:
Kishore K

Department:
[Link] Artificial Intelligence and Data Science

College:
J.N.N Institute of Engineering

Internship Organization:
Edufyi Tech Solutions
TABLE OF CONTENTS

[Link] ............................................ 3

2. Introduction ..................................... 4

3. Dataset Description ……...................5

4. Methodology ......................................7

5. Results and Discussion ….................9

6. Conclusion ......................................10

2
1. ABSTRACT
Machine learning algorithms play a significant role in predictive analytics by identifying
patterns and making predictions from historical data. Supervised learning is one of the most
widely used machine learning approaches, where models are trained using labeled data to
predict outcomes. This project focuses on applying supervised learning techniques to the
Titanic dataset after performing data cleaning and feature engineering.

The cleaned dataset was prepared by handling missing values, encoding categorical
variables, creating new features, and scaling numerical attributes. Two supervised learning
models, namely Linear Regression and Decision Tree, were implemented and trained using
the processed dataset.

The dataset was divided into training and testing sets to evaluate model performance. Linear
Regression was assessed using Mean Squared Error (MSE) and R² Score, while the Decision
Tree model was evaluated using accuracy. The experimental results demonstrated the
effectiveness of supervised learning algorithms in analyzing passenger survival patterns.

This project highlights the importance of data preprocessing and machine learning
techniques in predictive modeling and demonstrates how different supervised learning
algorithms can be applied to solve classification and prediction problems.

3
2. INTRODUCTION
Supervised learning is a branch of machine learning in which algorithms learn from labeled
data to make predictions or classifications. It is widely used in various domains such as
healthcare, finance, marketing, and transportation for predictive analytics and decision-
making. The success of supervised learning models depends on the quality of the dataset
and the effectiveness of preprocessing techniques.

The Titanic dataset is one of the most popular datasets used in machine learning studies. It
contains information about passengers aboard the RMS Titanic, including demographic
details, ticket information, passenger class, and survival status. The dataset provides an
excellent opportunity to apply machine learning algorithms and evaluate their predictive
capabilities.

In this project, the Titanic dataset was first cleaned and transformed using various
preprocessing techniques. Missing values were handled, categorical variables were
encoded, and new features were created through feature engineering. The processed dataset
was then used to train two supervised learning models: Linear Regression and Decision
Tree.

The objective of this project is to compare the performance of these models and understand
their ability to predict passenger survival. Various evaluation metrics were used to assess
model performance and determine the effectiveness of each algorithm.

4
3. DATASET DESCRIPTION

The dataset used in this project is the Titanic Dataset, which contains information about
passengers who traveled aboard the RMS Titanic. The dataset is widely used in machine
learning for classification and predictive modeling tasks. The objective is to analyze
passenger information and predict survival outcomes based on various features.

The original dataset contained demographic information, ticket details, passenger class, fare
information, and survival status. Before applying machine learning models, the dataset was
preprocessed through data cleaning and feature engineering techniques. Missing values
were handled, unnecessary attributes were removed, categorical variables were encoded,
and numerical features were standardized.

The final processed dataset consisted of 891 records and 10 input features. These features
were used to train and evaluate supervised learning models.

Dataset Information:

• Number of Records: 891


• Number of Features: 10
• Target Variable: Survived
• Type of Problem: Classification

The features used in the final dataset are:

1. PassengerId – Unique passenger identification number.


2. Pclass – Passenger travel class.
3. Sex – Gender of the passenger.
4. Age – Standardized age value.
5. SibSp – Number of siblings or spouses aboard.
6. Parch – Number of parents or children aboard.
7. Fare – Standardized fare value.
8. Embarked – Encoded port of embarkation.
5
9. Title – Encoded title extracted from passenger names.
10. AgeGroup – Encoded age category.

The target variable "Survived" indicates whether a passenger survived the disaster. A value
of 1 represents survival, while a value of 0 indicates that the passenger did not survive.

The processed dataset provides a suitable foundation for applying supervised learning
algorithms and evaluating their predictive performance.

Feature Description
PassengerId Passenger ID
Pclass Passenger Class
Sex Gender
Age Standardized Age
SibSp Siblings/Spouses Aboard
Parch Parents/Children Aboard
Fare Standardized Fare
Embarked Encoded Embarkation Port
Title Encoded Passenger Title
AgeGroup Encoded Age Category
Survived Target Variable
Table 3.1 : Attributes and Description

6
4. METHODOLOGY
The methodology followed in this project consists of data preprocessing, dataset preparation,
model training, prediction, and performance evaluation. The Titanic dataset was first cleaned
and transformed using data cleaning and feature engineering techniques before applying
supervised learning algorithms.

4.1 Dataset Preparation

The processed Titanic dataset obtained after data cleaning and feature engineering was used
for model development. The dataset contained numerical features suitable for machine
learning algorithms. The target variable was Survived, while the remaining attributes were
used as input features.

4.2 Feature Selection

The input features included PassengerId, Pclass, Sex, Age, SibSp, Parch, Fare, Embarked,
Title, and AgeGroup. These features were assigned to the variable X, while the Survived
column was assigned to the target variable y.

4.3 Train-Test Split

To evaluate model performance, the dataset was divided into training and testing sets using
the train_test_split() function from the Scikit-learn library. Eighty percent of the data was
used for training, while twenty percent was used for testing. This approach helps measure
the ability of the models to make predictions on unseen data.

Figure 4.1 : Training and Testing Dataset Split

7
4.4 Linear Regression Model

A Linear Regression model was implemented using the Scikit-learn library. The model was
trained using the training dataset and used to predict survival outcomes on the testing dataset.
The model established a relationship between passenger attributes and survival probability.

4.5 Decision Tree Model

A Decision Tree Classifier was implemented as a supervised learning model. The Decision
Tree algorithm creates decision rules based on feature values and classifies passengers into
survival categories. The model was trained using the training dataset and tested using unseen
records.

4.6 Model Evaluation

The Linear Regression model was evaluated using Mean Squared Error (MSE) and R² Score.
The Decision Tree model was evaluated using Accuracy Score. These evaluation metrics
were used to measure the effectiveness of the models and compare their predictive
performance.

8
5. RESULTS AND DISCUSSION
After training the Linear Regression and Decision Tree models using the processed Titanic
dataset, their performance was evaluated using appropriate evaluation metrics.

The Linear Regression model was trained using the training dataset and used to predict
survival outcomes for the testing dataset. The model achieved a Mean Squared Error (MSE)
of 0.136 and an R² Score of 0.438. These results indicate a moderate relationship between
the selected features and passenger survival.

The Decision Tree model was also trained and evaluated using the testing dataset. The model
achieved an accuracy of 77.09%, demonstrating its ability to classify passenger survival
outcomes effectively. Compared to Linear Regression, the Decision Tree model provided
better performance for this classification problem.

The experimental results indicate that supervised learning algorithms can successfully
analyze passenger data and predict survival outcomes. Among the two models, the Decision
Tree algorithm produced more accurate predictions and proved to be more suitable for the
Titanic survival classification task.

Figure 5.1 : Linear Regression Predictions

9
6. CONCLUSION
In this project, supervised learning techniques were successfully applied to the Titanic
dataset after performing data cleaning and feature engineering. The dataset was prepared by
handling missing values, encoding categorical variables, creating new features, and scaling
numerical attributes. These preprocessing steps improved the quality of the dataset and made
it suitable for machine learning applications.

Two supervised learning models, namely Linear Regression and Decision Tree, were
implemented and evaluated. The Linear Regression model was assessed using Mean Squared
Error (MSE) and R² Score, while the Decision Tree model was evaluated using accuracy.
The experimental results showed that both models were capable of analyzing passenger data
and generating predictions.

Among the two models, the Decision Tree algorithm achieved better performance with an
accuracy of approximately 77.09%, making it more suitable for the Titanic survival
prediction problem. The results demonstrate that machine learning algorithms can
effectively identify patterns in passenger information and assist in predictive analysis.

This project highlights the importance of supervised learning in solving real-world


prediction problems and demonstrates how different machine learning models can be
compared to determine the most effective approach for a given dataset.

10

You might also like