You are on page 1of 9

Neural network Project :task 2

Coemption name : titanic -machine learning from disaster .


Team members :
Hana Mohamed kamel 21100863
Ayten Hosam Ahmed 21100785
Ahmed Elsayed Atef 21100818

Step 1) we implemented all libraries we need for the code such as tensorflow / keras / numpy /
pandas

Step 2) we got the dataset from kaggle competetion as splitted train data and test data then
uploaded it to our code

Step 3) we started to preprocess the dataset: this may include handling missing values,
encoding categorical variables, scaling features, and splitting the data into training, validation,
and test sets.
1) we filled the missing values in Age column by the median of values in it
2) we filled the missing values in Embarked coulmns by the mode of its values

3) we added title column and we added in it the intials of every passenger


4) we added age_cat column and we added in it the category of ages of every passenger

5) we added family columns and we added in it the sum of Siblings and Parch of every
passenger then we split it by catigoris as single/ couple/large group
6) we removed 6 unnecessary coulmns with useless information
"PassengerId","Cabin","Name", "SibSp", "Parch", "Ticket","Age"

7) we started to labelencode feauters that needed


8) we splitted the feautres and the output

9) we splitted the trainig set and validation set


Step 4) Training and Cross-Validation: Train the model on the training set and tune
hyperparameters using cross-validation on the validation set. Perform a sensitivity analysis on
the hyperparameters to understand their impact on model performance.
-NN model :

We used input layer , 3 hidden layers , output layer.


1) We used batch normalization to the input. It normalizes the activations of a layer, making the
model more stable and accelerating training.
2) we used dense layers, Activations are rectified linear units (ReLU) for hidden layers, The first
dense layer has 128 neurons, the second has 32, and the third has 16.
3) we used Dropout as regularization technique that randomly sets a fraction of input units to
zero during training to prevent overfitting. The dropout rate is set to 0.1 (10%).
4) The output layer has one neuron with a sigmoid activation function. Sigmoid activation is
suitable for binary classification problems as it outputs values between 0 and 1.
-Optimizer algorithm to update learning rate iteratively based on training data is adam
optimizer and loss function is binary crossentropy we used it because we used sigmoid
activation function in out output layer :
Step 5) Evaluation for model :
Early stopping callback that stops training when a monitored metric has stopped improving:
At first we used learning rate = 0.005 and patience=8 “Number of epochs with no improvement
after which training will be stopped” epochs=1000 “Maximum number of epochs to train the
model”. We used Stochastic gradient descent as an optimization algorithm that uses batch
size=500 “Number of samples per gradient update”
Step 6) Error Analysis :
Our model accuracy starts from a low value (0.38) and gradually improves over epochs, the
validation accuracy does not seem to improve significantly; it hovers around 0.61-0.73.
In the graph the gap between training and validation accuracy indicate for overfitting, where
the model is learning the training data too well but struggles to generalize to new unseen data.

The prediction of our model vs the given data by the competition :


Step 7) Plan for Improvement :

You might also like