Browse Source

Merge branch 'master' of https://github.com/01-edu/Branch-AI

pull/42/head
Badr Ghazlane 3 years ago
parent
commit
105d1a7f1a
  1. 238
      one_md_per_day_format/piscine/Week3/w3day02.md
  2. 150
      one_md_per_day_format/piscine/Week3/w3day03.md
  3. 318
      one_md_per_day_format/piscine/Week3/w3day1.md
  4. 83
      one_md_per_day_format/projects/project1/project1.md

238
one_md_per_day_format/piscine/Week3/w3day02.md

@ -3,182 +3,189 @@
# Table of Contents:
# Table of Contents
# Introduction
Keras backend TF
The goal of this day is to learn to use Keras to build Neural Networks.
The goal of this day is to learn to use Keras to build Neural Networks.
There are two ways to build Keras models: sequential and functional.
The sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs. The exercises focuses on the usage of the sequential API.
The sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs. The exercises focuses on the usage of the sequential API.
'2.4.3'
## Historical
## Rules
The correction will provide the code and output because it is not straightforward to reproduce results using Keras. There are many source of randomness. Even if all the seeds are fixed to a constant they may be other source of randomness. https://machinelearningmastery.com/reproducible-results-neural-networks-keras/
The correction will provide the code and output because it is not straightforward to reproduce results using Keras. There are many source of randomness. Even if all the seeds are fixed to a constant they may be other source of randomness.
- https://machinelearningmastery.com/reproducible-results-neural-networks-keras/
A developper
## Ressources
https://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
## Resources
- https://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
# Exercise 1 Sequential
The goal of this exercise is to learn to call the object `Sequential`.
The goal of this exercise is to learn to call the object `Sequential`.
1. Put the object Sequential in a variable named `model` and print the variable `model`.
## Correction
## Correction
1. This question is validated if the output is: `<tensorflow.python.keras.engine.sequential.Sequential object at xxx`
# Exercise 2 Dense
The goal of this exercise is to learn to create layers of neurons. Keras proposes options to create custom layers. The neural networks build in these exercises do not require custom layers. `Dense` layers do the job. A dense layer is simply a layer where each unit or neuron is connected to each neuron in the next layer. As seen yesterday, there are three main types of layers: input, hidden and output. The **input layer** that specifies the number of inputs (features) is not represented as a layer in Keras. However, `Dense` has a parameter `input_dim` that gives the number of inputs in the previous layer. The output layer as any hidden layer can be created using `Dense`, the only difference is that the output layer contains one single neuron.
The goal of this exercise is to learn to create layers of neurons. Keras proposes options to create custom layers. The neural networks build in these exercises do not require custom layers. `Dense` layers do the job. A dense layer is simply a layer where each unit or neuron is connected to each neuron in the next layer. As seen yesterday, there are three main types of layers: input, hidden and output. The **input layer** that specifies the number of inputs (features) is not represented as a layer in Keras.
1. Create a `Dense` layer with these parameters and return the output of `get_config`:
However, `Dense` has a parameter `input_dim` that gives the number of inputs in the previous layer. The output layer as any hidden layer can be created using `Dense`, the only difference is that the output layer contains one single neuron.
- First hidden layer connected to 5 input variables.
- 8 neurons
- sigmoid as activation function
1. Create a `Dense` layer with these parameters and return the output of `get_config`:
- First hidden layer connected to 5 input variables.
- 8 neurons
- sigmoid as activation function
2. Create a `Dense` layer with these parameters and return the output of `get_config`:
2. Create a `Dense` layer with these parameters and return the output of `get_config`:
- Hidden layer (not the first one)
- 4 neurons
- sigmoid as activation function
- Hidden layer (not the first one)
- 4 neurons
- sigmoid as activation function
3. Create a `Dense` layer with these parameters and return the output of `get_config`:
3. Create a `Dense` layer with these parameters and return the output of `get_config`:
- Output layer
- 1 neuron
- sigmoid as activation function
- Output layer
- 1 neuron
- sigmoid as activation function
## Correction
## Correction
1. This question is validated if the fields`batch_input_shape`,`units` and `activation` match this output:
1. This question is validated if the fields`batch_input_shape`,`units` and `activation` match this output:
```console
{'name': 'dense_7',
'trainable': True,
'batch_input_shape': (None, 5),
'dtype': 'float32',
'units': 8,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
```
{'name': 'dense_7',
'trainable': True,
'batch_input_shape': (None, 5),
'dtype': 'float32',
'units': 8,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
2. This question is validated if the fields`units` and `activation` match this output:
```
{'name': 'dense_8',
'trainable': True,
'dtype': 'float32',
'units': 4,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
3. This question is validated if the fields`units` and `activation` match this output:
```
{'name': 'dense_9',
'trainable': True,
'dtype': 'float32',
'units': 1,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
2. This question is validated if the fields`units` and `activation` match this output:
```console
{'name': 'dense_8',
'trainable': True,
'dtype': 'float32',
'units': 4,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
# Exercise 3 Architecture
3. This question is validated if the fields`units` and `activation` match this output:
```console
{'name': 'dense_9',
'trainable': True,
'dtype': 'float32',
'units': 1,
'activation': 'sigmoid',
'use_bias': True,
'kernel_initializer': {'class_name': 'GlorotUniform',
'config': {'seed': None}},
'bias_initializer': {'class_name': 'Zeros', 'config': {}},
'kernel_regularizer': None,
'bias_regularizer': None,
'activity_regularizer': None,
'kernel_constraint': None,
'bias_constraint': None}
```
The goal of this exercise is to combine the layers and to create a neural network.
# Exercise 3 Architecture
1. Create a neural network for regression with the following architecture and return `print(model.summary())`:
The goal of this exercise is to combine the layers and to create a neural network.
- 5 inputs variables
- hidden layer 1: 8 neurons and sigmoid as activation function
- hidden layer 2: 4 neurons and sigmoid as activation function
- output layer: 1 neuron. Find the adapted activation function
1. Create a neural network for regression with the following architecture and return `print(model.summary())`:
## Correction
- 5 inputs variables
- hidden layer 1: 8 neurons and sigmoid as activation function
- hidden layer 2: 4 neurons and sigmoid as activation function
- output layer: 1 neuron. Find the adapted activation function
1. This question is validated if the code that creates the neural network is:
## Correction
```
model = keras.Sequential()
model.add(Dense(8, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(4, activation= 'sigmoid'))
model.add(Dense(1, activation= 'linear'))
1. This question is validated if the code that creates the neural network is:
```
```python
model = keras.Sequential()
model.add(Dense(8, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(4, activation= 'sigmoid'))
model.add(Dense(1, activation= 'linear'))
```
The first two layers could use another activation function that sigmoid (eg: relu)
# Exercise 4 Optimize
The goal of this exercise is to learn to train the neural network. Once the architecture of the neural network is set there are two steps to train the neural network:
The goal of this exercise is to learn to train the neural network. Once the architecture of the neural network is set there are two steps to train the neural network:
- `compile`: The compilation step aims to set the loss function, to choose the algorithm to minimize the chosen loss function and to choose the metric the model outputs.
- `compile`: The compilation step aims to set the loss function, to choose the algoithm to minimize the chosen loss function and to choose the metric the model outputs.
- The **optimizer**. We’ll stick with a pretty good default: the Adam gradient-based optimizer. Keras has many other optimizers you can look into as well.
- The **optimizer**. We’ll stick with a pretty good default: the Adam gradient-based optimizer. Keras has many other optimizers you can look into as well.
- The **loss function**. Depending on the problem to solve: classification or regression Keras proposes different loss functions. In classification Keras distinguishes between `binary_crossentropy` (2 classes) and `categorical_crossentropy` (>2 classes), so we’ll use the latter.
- The **metric(s)**. A list of metrics. Depending on the problem to solve: classification or regression Keras proposes different loss functions. For example for classification the metric can be the accuracy.
- The **loss function**. Depending on the problem to solve: classification or regression Keras proposes different loss functions. In classification Keras distinguishes between `binary_crossentropy` (2 classes) and `categorical_crossentropy` (>2 classes), so we will use the latter.
- The **metric(s)**. A list of metrics. Depending on the problem to solve: classification or regression Keras proposes different loss functions. For example for classification the metric can be the accuracy.
- `fit`: Training a model in Keras literally consists only of calling fit() and specifying some parameters. There are a lot of possible parameters, but we’ll only manually supply a few:
- The **training data**, commonly known as X and Y, respectively.
- The **number of epochs** (iterations over the entire dataset) to train for.
- The **number of epochs** (iterations over the entire dataset) to train for.
- The **batch size** (number of samples per gradient update) to use when training.
This article gives more details about **epoch** and **batch size**: https://machinelearningmastery.com/difference-between-a-batch-and-an-epoch/
This article gives more details about **epoch** and **batch size**:
- https://machinelearningmastery.com/difference-between-a-batch-and-an-epoch/
1. Create the following neural network (classification):
- Set the right number of inputs variables
- hidden layer 1: 10 neurons and sigmoid as activation function.
- hidden layer 2: 5 neurons and sigmoid as activation function.
- output layer: 1 neuron and sigmoid as activation function.
- Choose the accuracy metric, the adam optimizer, the adapted loss and epoch smaller than 50.
1. Create the following neural network (classification):
Import the breast cancer data set from `sklearn.datasets` using `load_breast_cancer` and train the neural network on the data set.
- Set the right number of inputs variables
- hidden layer 1: 10 neurons and sigmoid as activation function.
- hidden layer 2: 5 neurons and sigmoid as activation function.
- output layer: 1 neuron and sigmoid as activation function.
- Choose the accuracy metric, the adam optimizer, the adapted loss and epoch smaller than 50.
2. Scale the data using `StandardScaler` from `sklearn.preprocessing`. Train the neural network again.
Import the breast cancer data set from `sklearn.datasets` using `load_breast_cancer` and train the neural network on the data set.
2. Scale the data using `StandardScaler` from `sklearn.preprocessing`. Train the neural network again.
## Correction
1. This question is validated if the output of `model.get_config()['layers']` matches the fields `batch_input_shape`, `units` and `activation`.
```
```console
[{'class_name': 'InputLayer',
'config': {'batch_input_shape': (None, 30),
'dtype': 'float32',
@ -232,9 +239,10 @@ The goal of this exercise is to learn to train the neural network. Once the arch
'kernel_constraint': None,
'bias_constraint': None}}]
```
You should notice that the neural network is struggling to learn. By luck the initialization of the weights might have led to an accuracy close of 90%. But when I trained the neural network, with `batch_size=300` on the data here is the ouptput of the last epoch (50):
You should notice that the neural network is struggling to learn. By luck the initialization of the weights might have led to an accuracy close of 90%. But when I trained the neural network, with `batch_size=300` on the data here is the output of the last epoch (50):
`Epoch 50/50
2/2 [==============================] - 0s 1ms/step - loss: 0.6559 - accuracy: 0.6274`
2. This solution is validated if the the accuracy at epoch 50 is higher than 95%.
2. This solution is validated if the the accuracy at epoch 50 is higher than 95%.

150
one_md_per_day_format/piscine/Week3/w3day03.md

@ -3,94 +3,97 @@
# Table of Contents:
# Table of Contents
# Introduction
Keras backend TF
The goal of this day is to learn to use Keras to build Neural Networks and train them on small data sets.
classification & regression
The goal of this day is to learn to use Keras to build Neural Networks and train them on small data sets.
classification & regression
'2.4.3'
## Historical
## Rules
The correction will provide the code and output because it is not straightforward to reproduce results using Keras. There are many source of randomness. Even if all the seeds are fixed to a constant they may be other source of randomness. https://machinelearningmastery.com/reproducible-results-neural-networks-keras/
A developper
## Ressources
https://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
## Resources
- https://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
# Exercise 1 Regression - Optimize
# Exercise 1 Regression - Optimize
The goal of this exercise is to learn to set up the optimization for a regression neural network. There's no code to run in that exercise. In W2D2E3, we implemented a neural network designed for regression. We will be using this neural network:
The goal of this exercise is to learn to set up the optimization for a regression neural network. There's no code to run in that exercise. In W2D2E3, we implemented a neural network designed for regression. We will be using this neural network:
```
model = keras.Sequential()
model.add(Dense(8, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(4, activation= 'sigmoid'))
model.add(Dense(1, activation= 'linear'))
```python
model = keras.Sequential()
model.add(Dense(8, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(4, activation= 'sigmoid'))
model.add(Dense(1, activation= 'linear'))
```
```
As a reminder, the main difference between a regression and classification neural network's architecture is the output layer activation function.
1. Fill this chunk of code to set up the optimization part of the regression neural network:
1. Fill this chunk of code to set up the optimization part of the regression neural network:
```
```python
model.compile(
optimizer='adam',
loss='',#TODO1
metrics=[''] #TODO2
)
```
Hint:
- Mean Squared Error (MSE) and Mean Absolute Error (MAE) are common loss functions used for regression problems. Mean Absolute Error is less sensitive to outliers. Different loss functions are used for classification problems. Similarly, evaluation metrics used for regression differ from classification.
Hint:
- Mean Squared Error (MSE) and Mean Absolute Error (MAE) are common loss functions used for regression problems. Mean Absolute Error is less sensitive to outliers. Different loss functions are used for classification problems. Similarly, evaluation metrics used for regression differ from classification.
https://keras.io/api/metrics/regression_metrics/
## Correction:
## Correction
1. This question is validated if the chunk of code is:
1. This question is validated if the chunk of code is:
```
```python
model.compile(
optimizer='adam',
loss='mse',
metrics=['mse']
)
```
All regression metrics or losses used are correct. As explained before, the loss functions are chosen thanks to nice mathematical properties. That is why most of the time the loss function used for regression is the MSE or MAE.
https://keras.io/api/losses/regression_losses/
https://keras.io/api/metrics/regression_metrics/
All regression metrics or losses used are correct. As explained before, the loss functions are chosen thanks to nice mathematical properties. That is why most of the time the loss function used for regression is the MSE or MAE.
- https://keras.io/api/losses/regression_losses/
- https://keras.io/api/metrics/regression_metrics/
# Exercise 2 Regression example
The goal of this exercise is to learn to train a neural network to perform a regression on a data set.
The data set is Auto MPG Dataset and the go is to build a model to predict the fuel efficiency of late-1970s and early 1980s automobiles. To do this, provide the model with a description of many automobiles from that time period. This description includes attributes like: cylinders, displacement, horsepower, and weight.
https://www.tensorflow.org/tutorials/keras/regression
The data set is Auto MPG Dataset and the goal is to build a model to predict the fuel efficiency of late-1970s and early 1980s automobiles. To do this, provide the model with a description of many automobiles from that time period. This description includes attributes like: cylinders, displacement, horsepower, and weight.
- https://www.tensorflow.org/tutorials/keras/regression
1. Preprocess the data set as follow:
- Drop the columns: **model year**, **origin**, **car name**
- Split train test without shuffling the data. Keep 20% for the test set.
- Scale the data using Standard Scaler
- Drop the columns: **model year**, **origin**, **car name**
- Split train test without shuffling the data. Keep 20% for the test set.
- Scale the data using Standard Scaler
2. Train a neural network on the train set and predict on the test set. The neural network should have 2 hidden layers and the loss should be **mean_squared_error**. The expected **mean absolute error** on the test set is maximum 10.
*Hint*: inscrease the number of epochs
**Warning**: Do no forget to evaluate the neural network on the **SCALED** test set.
*Hint*: increase the number of epochs
**Warning**: Do no forget to evaluate the neural network on the **SCALED** test set.
## Correction
## Correction
1. This question is validated if the input DataFrames are:
1. This question is validated if the input DataFrames are:
X_train_scaled shape is (313, 5) and the first 5 rows are:
@ -102,7 +105,7 @@ X_train_scaled shape is (313, 5) and the first 5 rows are:
| 3 | 1.28377 | 0.856996 | 0.987205 | 0.375034 | -1.19481 |
| 4 | 1.28377 | 0.838549 | 0.737087 | 0.393214 | -1.74247 |
The train target is:
The train target is:
| | mpg |
|---:|------:|
@ -112,7 +115,6 @@ The train target is:
| 3 | 16 |
| 4 | 17 |
X_test_scaled shape is (79, 5) and the first 5 rows are:
| | cylinders | displacement | horsepower | weight | acceleration |
@ -123,7 +125,7 @@ X_test_scaled shape is (79, 5) and the first 5 rows are:
| 318 | -1.00255 | -0.710983 | -0.5135 | -0.445337 | 0.0830525 |
| 319 | -1.00255 | -0.840111 | -0.888676 | -0.637363 | 0.813262 |
The test target is:
The test target is:
| | mpg |
|----:|------:|
@ -133,9 +135,9 @@ The test target is:
| 318 | 29.8 |
| 319 | 31.3 |
2. This question is validated if the mean absolute error on the test set is smaller than 10. Here is an architecture that works:
2. This question is validated if the mean absolute error on the test set is smaller than 10. Here is an architecture that works:
```
```python
# create model
model = Sequential()
model.add(Dense(30, input_dim=5, activation='sigmoid'))
@ -146,51 +148,53 @@ model.compile(loss='mean_squared_error',
optimizer='adam', metrics='mean_absolute_error')
```
The output neuron has to be `Dense(1)` - by defaut the activation funtion is linear. The loss has to be **mean_squared_error** and the **input_dim** has to be **5**. All variations on the others parameters are accepted.
The output neuron has to be `Dense(1)` - by default the activation function is linear. The loss has to be **mean_squared_error** and the **input_dim** has to be **5**. All variations on the others parameters are accepted.
*Hint*: To get the score on the test set, `evaluate` could have been used: `model.evaluate(X_test_scaled, y_test)`.
*Hint*: To get the score on the test set, `evaluate` could have been used: `model.evaluate(X_test_scaled, y_test)`.
# Exercise 3 Multi classification - Softmax
The goal of this exercise is to learn to a neural network architecture for multi-class data. This is an important type of problem on which to practice with neural networks because the three class values require specialized handling. A multi-classification neural network uses as output layer a **softmax** layer. The **softmax** activation function is an extension of the sigmoid as it is designed to output the probabilities to belong to each class in a multi-class problem. This output layer has to contain as much neurons as classes in the multi-classification problem. This article explains in detail how it works. https://developers.google.com/machine-learning/crash-course/multi-class-neural-networks/softmax
The goal of this exercise is to learn to a neural network architecture for multi-class data. This is an important type of problem on which to practice with neural networks because the three class values require specialized handling. A multi-classification neural network uses as output layer a **softmax** layer. The **softmax** activation function is an extension of the sigmoid as it is designed to output the probabilities to belong to each class in a multi-class problem. This output layer has to contain as much neurons as classes in the multi-classification problem. This article explains in detail how it works.
Let us assume we want to classify images and we know they contain either apples, bears, candies, eggs or dogs (extension of the example in the link above).
- https://developers.google.com/machine-learning/crash-course/multi-class-neural-networks/softmax
1. Create the architecture for a multi-class neural network with the following architecture and return `print(model.summary())`:
Let us assume we want to classify images and we know they contain either apples, bears, candies, eggs or dogs (extension of the example in the link above).
- 5 inputs variables
- hidden layer 1: 16 neurons and sigmoid as activation function
- hidden layer 2: 8 neurons and sigmoid as activation function
- output layer: The number of neurons and the activation function should be adapted to this multi-classification problem.
1. Create the architecture for a multi-class neural network with the following architecture and return `print(model.summary())`:
- 5 inputs variables
- hidden layer 1: 16 neurons and sigmoid as activation function
- hidden layer 2: 8 neurons and sigmoid as activation function
- output layer: The number of neurons and the activation function should be adapted to this multi-classification problem.
## Correction
## Correction
1. This question is validated if the code that creates the neural network is:
1. This question is validated if the code that creates the neural network is:
```
model = keras.Sequential()
model.add(Dense(16, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(8, activation= 'sigmoid'))
model.add(Dense(5, activation= 'softmax'))
```python
model = keras.Sequential()
model.add(Dense(16, input_shape=(5,), activation= 'sigmoid'))
model.add(Dense(8, activation= 'sigmoid'))
model.add(Dense(5, activation= 'softmax'))
```
```
# Exercise 4 Multi classification - Optimize
# Exercise 4 Multi classification - Optimize
The goal of this exercise is to learn to optimize a multi-classification neural network. As learnt previously, the loss function used in binary classification is the log loss - also called in Keras `binary_crossentropy`. This function is defined for binary classification and can be extended to multi-classfication. In Keras, the extended loss that supports multi-classification is `binary_crossentropy`. There's no code to run in that exercise.
1. Fill the chunk of code below in order to optimize the neural network defined in the previous exercise. Choose the adapted loss, adam as optimizer and the accuracy as metric.
```
```python
model.compile(loss='',#TODO1
optimizer='', #TODO2
metrics=['']) #TODO3
```
## Correction
## Correction
1. This question is validated if the chunk of code is:
```
```python
model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
@ -198,25 +202,25 @@ model.compile(loss='categorical_crossentropy',
# Exercise 5 Multi classification example
The goal of this exercise is to learn to use a neural network to classify a multiclass data set. The data set used is the Iris data set which allows to classify flower given basic features as flower's measurement.
The goal of this exercise is to learn to use a neural network to classify a multiclass data set. The data set used is the Iris data set which allows to classify flower given basic features as flower's measurement.
Preliminary:
- Split train test. Keep 20% for the test set. Use `random_state=1`.
- Scale the data using Standard Scaler
Preliminary:
- Split train test. Keep 20% for the test set. Use `random_state=1`.
- Scale the data using Standard Scaler
1. Use the `LabelBinarizer` from Sckit-learn to create a one hot encoding of the target. As you know, the output layer of a multi-classification neural network shape is equal to the number of classes. The output layer expects to have a target with the same shape as its output layer.
1. Use the `LabelBinarizer` from Sckit-learn to create a one hot encoding of the target. As you know, the output layer of a multi-classification neural network shape is equal to the number of classes. The output layer expects to have a target with the same shape as its output layer.
2. Train a neural network on the train set and predict on the test set. The neural network should have 1 hidden layers. The expected **accuracy** on the test set is minimum 90%.
*Hint*: inscrease the number of epochs
**Warning**: Do no forget to evaluate the neural network on the **SCALED** test set.
*Hint*: increase the number of epochs
**Warning**: Do no forget to evaluate the neural network on the **SCALED** test set.
## Correction
## Correction
1. This question is validated if the output of the first ten values of the train labels are:
1. This question is validated if the output of the first ten values of the train labels are:
```
```console
array([[0, 1, 0],
[0, 0, 1],
[0, 1, 0],
@ -231,9 +235,9 @@ array([[0, 1, 0],
2. This question is validated if the accuracy on the test set is bigger than 90%. To evaluate the accuracy on the test set you can use: `model.evaluate(X_test_sc, y_test_multi_class)`.
Here is an implementation that gives 96% accuracy on the test set.
Here is an implementation that gives 96% accuracy on the test set.
```
```python
model = Sequential()
model.add(Dense(10, input_dim=4, activation='sigmoid'))
model.add(Dense(3, activation='softmax'))

318
one_md_per_day_format/piscine/Week3/w3day1.md

@ -1,5 +1,6 @@
# W3D1 Piscine AI - Data Science
# Table of Contents
# Table of Contents:
@ -7,57 +8,63 @@
# Introduction
Deep learning is a huge domain. We will focus on Artificial Neural Networks. The goal is to understand how do the neural networks train and train them on data. Understand the challenges of training a neural network
Architectures as RNN, LSTM (learn sequences, used in TS and NLP),CNN used a lot in image processing are well know algorithms in deep learning but won't be covered by the AI branch. Once you have a good understanding of ANN feel free to extend your knowledge to new architectures.
Architectures as RNN, LSTM (learn sequences, used in TS and NLP), CNN used a lot in image processing are well know algorithms in deep learning but won't be covered by the AI branch. Once you have a good understanding of ANN feel free to extend your knowledge to new architectures.
## Rules
## Ressources
https://victorzhou.com/blog/intro-to-neural-networks/
## Resources
. https://victorzhou.com/blog/intro-to-neural-networks/
https://srnghn.medium.com/deep-learning-overview-of-neurons-and-activation-functions-1d98286cf1e4#:~:text=What%20is%20a%20neuron%3F,to%20become%20the%20neuron's%20output.
- https://srnghn.medium.com/deep-learning-overview-of-neurons-and-activation-functions-1d98286cf1e4#:~:text=What%20is%20a%20neuron%3F,to%20become%20the%20neuron's%20output.
Reproduire cet article sans back prop
https://towardsdatascience.com/machine-learning-for-beginners-an-introduction-to-neural-networks-d49f22d238f9
- Reproduire cet article sans back prop https://towardsdatascience.com/machine-learning-for-beginners-an-introduction-to-neural-networks-d49f22d238f9
# Exercise 1 The neuron
# Exercise 1 The neuron
The goal of this exercise is to understand the role of a neuron and to implement a neuron.
The goal of this exercise is to understand the role of a neuron and to implement a neuron.
An artificial neuron, the basic unit of the neural network, (also referred to as a perceptron) is a mathematical function. It takes one or more inputs that are multiplied by values called “weights” and added together. This value is then passed to a non-linear function, known as an activation function, to become the neuron’s output.
As desbribed in the article, **a neuron takes inputs, does some math with them, and produces one output**.
As described in the article, **a neuron takes inputs, does some math with them, and produces one output**.
Let us assume there are 2 inputs. Here are the three steps involved in the neuron:
Let us assume there are 2 inputs. Here are the three steps involved in the neuron:
1. Each input is multiplied by a weight
- x1 -> x1 * w1
- x2 -> x2 * w2
2. The weighted inputs are added together with a biais b
- (x1 * w1) + (x2 * w2) + b
3. The sum is passed through an activation function
- y = f((x1 * w1) + (x2 * w2) + b)
1. Each input is multiplied by a weight:
- `x1 -> x1 * w1`
- `x2 -> x2 * w2`
2. The weighted inputs are added together with a biais b:
- The activation function is a function you know from W2DAY2 (Logistic Regression): **the sigmoid**
- `(x1 * w1) + (x2 * w2) + b`
Example:
3. The sum is passed through an activation function:
- `y = f((x1 * w1) + (x2 * w2) + b)`
- The activation function is a function you know from W2DAY2 (Logistic Regression): **the sigmoid**
x1 = 2 , x2 = 3 , w1 = 0, w2= 1, b = 4
Example:
`x1 = 2`, `x2 = 3`, `w1 = 0`, `w2 = 1`, `b = 4`
1. Step 1: Multiply by a weight
- x1 -> 2 * 0 = 0
- x2 -> 3 * 1 = 3
- `x1 -> 2 * 0 = 0`
- `x2 -> 3 * 1 = 3`
2. Step 2: Add weigthed inputs and bias
- 0 + 3 + 4 = 7
- `0 + 3 + 4 = 7`
3. Step 3: Activation function
- y = f(7) = 0.999
- `y = f(7) = 0.999`
---
1. Implement a the function feedforward of the class `Neuron` that takes as input the inputs (x1, x2) and that uses the attributes: the weights and the biais to return y:
1. Implement a the function `feedforward` of the class `Neuron` that takes as input the inputs (x1, x2) and that uses the attributes: the weights and the biais to return y:
```
class Neuron:
```python
class Neuron:
def __init__(self, weight1, weight2, bias):
self.weights_1 = weight1
self.weights_2 = weight2
@ -66,213 +73,208 @@ x1 = 2 , x2 = 3 , w1 = 0, w2= 1, b = 4
def feedforward(self, x1, x2):
#TODO
return y
```
```
Note: if you are confortable with matrix multiplication, feel free to vectorize the operations as done in the article.
Note: if you are comfortable with matrix multiplication, feel free to vectorize the operations as done in the article.
https://victorzhou.com/blog/intro-to-neural-networks/
## Correction:
## Correction
1. This question is validated if this code:
```
neuron = Neuron(0,1,4)
neuron.feedforward(2,3)
```
returns **0.9990889488055994**.
```python
neuron = Neuron(0,1,4)
neuron.feedforward(2,3)
```
returns **0.9990889488055994**.
# Exerice 2 Neural network
The goal of this exercise is to understand how to combine three neurons to form a neural network. A neural newtwork is nothing else than neurons connected together. As shown in the figure the neural network is composed of **layers**:
The goal of this exercise is to understand how to combine three neurons to form a neural network. A neural network is nothing else than neurons connected together. As shown in the figure the neural network is composed of **layers**:
- Input layer: it only represents input data. **It doesn't contain neurons**.
- Output layer: it represents the last layer. It contains a neuron (in some cases more than 1).
- Hidden layer: any layer between the input (first) layer and output (last) layer. Many hidden layers can be stacked. When there are many hidden layers, the neural networks is deep.
- Input layer: it only represents input data. **It doesn't contain neurons**.
- Output layer: it represents the last layer. It contains a neuron (in some cases more than 1).
- Hidden layer: any layer between the input (first) layer and output (last) layer. Many hidden layers can be stacked. When there are many hidden layers, the neural networks is deep.
Notice that the neuron **o1** in the output layer takes as input the output of the neurons **h1** and **h2** in the hidden layer.
Notice that the neuron **o1** in the output layer takes as input the output of the neurons **h1** and **h2** in the hidden layer.
In exercise 1, you implemented this neuron.
![alt text][neuron]
[neuron]: images/day1/ex2/w3_day1_neuron.png "Plot"
[neuron]: images/day1/ex2/w3_day1_neuron.png 'Plot'
Now, we add two more neurons:
Now, we add two more neurons:
- h2, the second neuron of the hidden layer
- o1, the neuron of the output layer
![alt text][nn]
[nn]: images/day1/ex2/w3_day1_neural_network.png "Plot"
[nn]: images/day1/ex2/w3_day1_neural_network.png 'Plot'
1. Implement the function `feedforward` of the class `OurNeuralNetwork` that takes as input the input data and returns the output y. Return the output for these neurons:
```
neuron_h1 = Neuron(1,2,-1)
neuron_h2 = Neuron(0.5,1,0)
neuron_o1 = Neuron(2,0,1)
```
```
class OurNeuralNetwork:
def __init__(self, neuron_h1, neuron_h2, neuron_o1):
self.h1 = neuron_h1
self.h2 = neuron_h2
self.o1 = neuron_o1
def feedforward(self, x1, x2):
# The inputs for o1 are the outputs from h1 and h2
# TODO
return y
```python
neuron_h1 = Neuron(1,2,-1)
neuron_h2 = Neuron(0.5,1,0)
neuron_o1 = Neuron(2,0,1)
```
```
```python
class OurNeuralNetwork:
def __init__(self, neuron_h1, neuron_h2, neuron_o1):
self.h1 = neuron_h1
self.h2 = neuron_h2
self.o1 = neuron_o1
def feedforward(self, x1, x2):
# The inputs for o1 are the outputs from h1 and h2
# TODO
return y
```
## Correction
## Correction
1. This question is validated the output is: **0.9524917424084265**
1. This question is validated if for `x1=2` and `x2=3`, the output is: **0.9524917424084265**
# Exercise 3 Log loss
The goal of this exercise is to implement the Log loss function. As mentioned last week, this function is used in classification as a **loss function**. It means that the better the classifier is, the smaller the loss function is. W2D1, you implemented the gradient descent on the MSE loss to update the weights of the linear regression. Similarly, the minimization of the Log loss leads to finding optimal weights.
The goal of this exercise is to implement the Log loss function. As mentioned last week, this function is used in classification as a **loss function**. It means that the better the classifier is, the smaller the loss function is. W2D1, you implemented the gradient descent on the MSE loss to update the weights of the linear regression. Similarly, the minimization of the Log loss leads to finding optimal weights.
Log loss: - 1/n * Sum[(y_true*log(y_pred) + (1-y_true)*log(1-y_pred))]
Log loss: `- 1/n * Sum[(y_true*log(y_pred) + (1-y_true)*log(1-y_pred))]`
1. Create a function `log_loss_custom` and compute the loss for the data below:
1. Create a function `log_loss_custom` and compute the loss for the data below:
```
y_true = np.array([0,1,1,0,1])
y_pred = np.array([0.1,0.8,0.6, 0.5, 0.3])
```
Check that `log_loss` from `sklearn.metrics` returns the same result
https://scikit-learn.org/stable/modules/generated/sklearn.metrics.log_loss.html
```python
y_true = np.array([0,1,1,0,1])
y_pred = np.array([0.1,0.8,0.6, 0.5, 0.3])
```
## Correction
Check that `log_loss` from `sklearn.metrics` returns the same result
1. This question is validated if the output is: **0.5472899351247816**.
- https://scikit-learn.org/stable/modules/generated/sklearn.metrics.log_loss.html
## Correction
# Exercise 4 Forward propagation
The goal of this exerice is to compute the log loss on the output of the forward propagation. The data used is the tiny data set below.
1. This question is validated if the output is: **0.5472899351247816**.
# Exercise 4 Forward propagation
| name | math | chemistry | exam_success |
|:-------|-------:|------------:|---------------:|
| Bob | 12 | 15 | 1 |
| Eli | 10 | 9 | 0 |
| Tom | 18 | 18 | 1 |
| Ryan | 13 | 14 | 1 |
The goal of this exercise is to compute the log loss on the output of the forward propagation. The data used is the tiny data set below.
| name | math | chemistry | exam_success |
| :--- | ---: | --------: | -----------: |
| Bob | 12 | 15 | 1 |
| Eli | 10 | 9 | 0 |
| Tom | 18 | 18 | 1 |
| Ryan | 13 | 14 | 1 |
The goal if the network is to predict the success at the exam given math and chemistry grades. The inputs are `math` and `chemistry` and the target is `exam_sucess`.
1. Compute and return the output of the neural network for each of the students. Here are the weights and biases of the neural network:
1. Compute and return the output of the neural network for each of the students. Here are the weights and biases of the neural network:
```python
neuron_h1 = Neuron(0.05, 0.001, 0)
neuron_h2 = Neuron(0.02, 0.003, 0)
neuron_o1 = Neuron(2,0,0)
```
```
neuron_h1 = Neuron(0.05, 0.001, 0)
neuron_h2 = Neuron(0.02, 0.003, 0)
neuron_o1 = Neuron(2,0,0)
```
2. Compute the logloss for the data given the output of the neural network with the 4 students.
2. Compute the `log_loss` for the data given the output of the neural network with the 4 students.
## Correction
## Correction
1. This question is validated if the output is:
```
Bob: 0.7855253278357536
Eli: 0.7771516558846259
Tom: 0.8067873659804015
Ryan: 0.7892343955586032
```
2. This question is validated if the logloss for the 4 students is **0.5485133607757963**.
1. This question is validated if the output is:
```console
Bob: 0.7855253278357536
Eli: 0.7771516558846259
Tom: 0.8067873659804015
Ryan: 0.7892343955586032
```
# Exercise 5 Regression
2. This question is validated if the `log_loss` for the 4 students is **0.5485133607757963**.
The goal of this exercise is to learn to adapt the output layer to regression.
As a reminder, one of reasons for which the sigmoid is used in classification is because it contracts the output between 0 and 1 which is the expected output range for a probability (W2D2: Logistic regression). However, the output of the regression is not a probability.
# Exercise 5 Regression
In order to perform a regression using a neural network, the activation function of the neuron on the output layer has to be modified to **identity function**. In mathematics, the identity function is: **f(x) = x**. In other words it means that it returns the input as so. The three steps become:
The goal of this exercise is to learn to adapt the output layer to regression.
As a reminder, one of reasons for which the sigmoid is used in classification is because it contracts the output between 0 and 1 which is the expected output range for a probability (W2D2: Logistic regression). However, the output of the regression is not a probability.
In order to perform a regression using a neural network, the activation function of the neuron on the output layer has to be modified to **identity function**. In mathematics, the identity function is: **`f(x) = x`**. In other words it means that it returns the input as so. The three steps become:
1. Each input is multiplied by a weight
- x1 -> x1 * w1
- x2 -> x2 * w2
2. The weighted inputs are added together with a biais b
- (x1 * w1) + (x2 * w2) + b
3. The sum is passed through an activation function
- y = f((x1 * w1) + (x2 * w2) + b)
- The activation function is **the identity**
- y = (x1 * w1) + (x2 * w2) + b
All other neurons' activation function **doesn't change**.
- `x1 -> x1 * w1`
- `x2 -> x2 * w2`
1. Adapt the neuron class implemented in exercise 1. It now takes as a parameter `regression` which is boolean. When its value is `True`, `feedforward` should use the identity function as activation function instead of the sigmoid function.
2. The weighted inputs are added together with a biais `b`
- `(x1 * w1) + (x2 * w2) + b`
```
class Neuron:
def __init__(self, weight1, weight2, bias, regression):
self.weights_1 = weight1
self.weights_2 = weight2
self.bias = bias
#TODO
3. The sum is passed through an activation function
- `y = f((x1 * w1) + (x2 * w2) + b)`
- The activation function is **the identity**
- `y = (x1 * w1) + (x2 * w2) + b`
def feedforward(self, x1, x2):
#TODO
return y
All other neuron's activation function **doesn't change**.
```
1. Adapt the neuron class implemented in exercise 1. It now takes as a parameter `regression` which is boolean. When its value is `True`, `feedforward` should use the identity function as activation function instead of the sigmoid function.
- Compute the output for:
```python
class Neuron:
def __init__(self, weight1, weight2, bias, regression):
self.weights_1 = weight1
self.weights_2 = weight2
self.bias = bias
#TODO
```
neuron = Neuron(0,1,4, True)
neuron.feedforward(2,3)
```
def feedforward(self, x1, x2):
#TODO
return y
```
- Compute the output for:
2. Now, the goal of the network is to predict the physics' grade at the exam given math and chemistry grades. The inputs are `math` and `chemistry` and the target is `physics`.
```python
neuron = Neuron(0,1,4, True)
neuron.feedforward(2,3)
```
| name | math | chemistry | physics |
|:-------|-------:|------------:|---------------:|
| Bob | 12 | 15 | 16 |
| Eli | 10 | 9 | 10 |
| Tom | 18 | 18 | 19 |
| Ryan | 13 | 14 | 16 |
2. Now, the goal of the network is to predict the physic's grade at the exam given math and chemistry grades. The inputs are `math` and `chemistry` and the target is `physics`.
| name | math | chemistry | physics |
| :--- | ---: | --------: | ------: |
| Bob | 12 | 15 | 16 |
| Eli | 10 | 9 | 10 |
| Tom | 18 | 18 | 19 |
| Ryan | 13 | 14 | 16 |
Compute and return the output of the neural network for each of the students. Here are the weights and biases of the neural network:
Compute and return the output of the neural network for each of the students. Here are the weights and biases of the neural network:
```
#replace regression by the right value
neuron_h1 = Neuron(0.05, 0.001, 0, regression)
neuron_h2 = Neuron(0.002, 0.003, 0, regression)
neuron_o1 = Neuron(2,7,10, regression)
```
3. Compute the MSE for the 4 students.
```python
#replace regression by the right value
neuron_h1 = Neuron(0.05, 0.001, 0, regression)
neuron_h2 = Neuron(0.002, 0.003, 0, regression)
neuron_o1 = Neuron(2,7,10, regression)
```
## Correction
3. Compute the MSE for the 4 students.
## Correction
1. This question is validated if the output is **7**.
2. This question is validated if the outputs are:
```
Bob: 14.918863163724454
Eli: 14.83137890625537
Tom: 15.086662606964074
Ryan: 14.939270885974128
```
```console
Bob: 14.918863163724454
Eli: 14.83137890625537
Tom: 15.086662606964074
Ryan: 14.939270885974128
```
3. This question is validated if the MSE is **10.237608699909138**

83
one_md_per_day_format/projects/project1/project1.md

@ -1,6 +1,6 @@
# First Kaggle
# First Kaggle
## Introduction
## Introduction
The goal of this **1 week** project is to get the highest possible score on a Data Science competition. More precisely you will have to predict who survived the Titanic crash.
@ -8,40 +8,37 @@ The goal of this **1 week** project is to get the highest possible score on a Da
[titanic]: titanic.jpg "Titanic"
### Kaggle
### Kaggle
Kaggle is an online community of data scientists and machine learning practitioners. Kaggle allows users to find and publish data sets, explore and build models in a web-based data-science environment, work with other data scientists and machine learning engineers, and enter competitions to solve data science challenges. It’s a crowd-sourced platform to attract, nurture, train and challenge data scientists from all around the world to solve data science, machine learning and predictive analytics problems.
### Titanic - Machine Learning from Disaster
One of the first Kaggle competition I did was: Titanic - Machine Learning from Disaster. This is a not-to-be-missed Kaggle competition.
https://www.kaggle.com/c/titanic
One of the first Kaggle competition I did was: Titanic - Machine Learning from Disaster. This is a not-to-be-missed Kaggle competition.
You can see more [here](https://www.kaggle.com/c/titanic)
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 weren’t enough lifeboats for everyone onboard, resulting in the death of 1502 out of 2224 passengers and crew.
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, you have 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, etc).
## Preliminary
The way the Kaggle platform works is explained in the challenge overview page. If you need more details, I suggest this ressource that gives detailed explanations.
In this challenge, you have 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, etc). **You will have to submit your prediction on Kaggle**.
https://towardsdatascience.com/getting-started-with-kaggle-f9138b35ae18
## Preliminary
The way the Kaggle platform works is explained in the challenge overview page. If you need more details, I suggest this [resource](https://towardsdatascience.com/getting-started-with-kaggle-f9138b35ae18) that gives detailed explanations.
- Create a username following that structure: username_01EDU_ location_MM_YYYY. Submit the description profil and push it on GitHub the first day of the week. Do not touch this file anymore.
- Create a username following this structure: username_01EDU_ location_MM_YYYY. Submit the description profile and push it on GitHub the first day of the week. Do not touch this file anymore.
- It is possible to have different personal accounts merged in a team for one single competition.
## Deliverables
```
```console
project
│ README.md
│ environment.yml
│ environment.yml
│ username.txt
└───data
@ -55,57 +52,65 @@ project
|───scripts
```
- `README.md` introducts the project, shows the username, describes the features engineering and the best score on the **leaderboard**.
```
- `README.md` introduction to the project, shows the username, describes the features engineering and the best score on the **leaderboard**.
- `environment.yml` contains all libraries required to run the code.
- `username.txt` contains the username, the last modified date of the file **has to correspond to the first day of the project**.
- `EDA.ipynb` contains the exploratory data analysis. This file is should contain all steps of data analysis that contributed or not to improve the accuracy. It has to be commented so that the reviewer can understand the analysis and run it without any problem.
- `scripts` contains python file(s) that perform(s) the feature engineering, the model's training and prediction on the test set. It could also be one single Jupyter Notebook. It has to be commented to help the reviewers understand the approach and run the code without any bugs.
- `username.txt` contains the username, the last modified date of the file **has to correspond to the first day of the project**.
- `EDA.ipynb` contains the exploratory data analysis. This file is should contain all steps of data analysis that contributed or not to improve the accuracy. It has to be commented so that the reviewer can understand the analysis and run it without any problem.
- `scripts` contains python file(s) that perform(s) the feature engineering, the model's training and prediction on the test set. It could also be one single Jupyter Notebook. It has to be commented to help the reviewers understand the approach and run the code without any bugs.
- **Submit your predictions on the Kaggle's competition platform**. Check your ranking and score in the leaderboard.
### Scores
In order to validate the project you will have to score at least **79% accuracy on the Leaderboard**:
In order to validate the project you will have to score at least **79% accuracy on the Leaderboard**:
- 79% accuracy is the minimum score to validate the project.
- 79% accuracy is the minimum score to validate the project.
Scores indication:
Scores indication:
- 79% difficult - minimum required
- 81% very difficult: smart feature engineering needed
- More than 83%: excellent that corresponds to the top 2% on Kaggle
- More than 85%: cheating
- More than 85%: cheating
#### Cheating
#### Cheating
It is impossible to get 100%. Who would have predicted that Rose wouldn't let Jack on the door ? https://www.insider.com/jack-and-rose-werent-on-a-door-in-titanic-2019-7
It is impossible to get 100%. Who would have predicted that Rose wouldn't let [Jack on the door](https://www.insider.com/jack-and-rose-werent-on-a-door-in-titanic-2019-7) ?
All people having 100% of accuracy on the Leaderboard cheated, there's no point to compare with them or to cheat. The Kaggle community estimates that having more than 85% is almost considered as cheated submissions as they are element of luck involved in the surviving.
All people having 100% of accuracy on the Leaderboard cheated, there's no point to compare with them or to cheat. The Kaggle community estimates that having more than 85% is almost considered as cheated submissions as they are element of luck involved in the surviving.
**You can't used external data sets than the ones provided in that competition.**
**You can't used external data sets than the ones provided in that competition.**
## The key points
- **Feature engineering**:
Imagine yourself as an investigator trying to understand what happened exactly in that boat. Do not hesitate to watch the movie to try to find as many insights as possible. Without the feature engineering there's no way to validate the project ;-)
- The leaderboard evaluates on test data for which you don't have the labels. It means that there's no point to overfit the train set. Check the overfitting on the train set by dividing the data and by cross-validating the accuracy.
Imagine yourself as an investigator trying to understand what happened exactly in that boat. Do not hesitate to watch the movie to try to find as many insights as possible. Without the feature engineering there's no way to validate the project ;-)
- The leaderboard evaluates on test data for which you don't have the labels. It means that there's no point to over fit the train set. Check the over fitting on the train set by dividing the data and by cross-validating the accuracy.
## Advice
Don't try to build the perfect model the first day. Iterate a lot and test your assumptions:
Iteration 1:
Don't try to build the perfect model the first day. Iterate a lot and test your assumptions:
Iteration 1:
- Predict all passengers die
Iteration 2
- Fit a logisitc regression with a basic feature engineering
Iteration 3:
- Perform an EDA. Make assumptions and check them. Example: What if first class passengers survived more. Check the assumption through EDA and create relevant features to help the model capture the information.
- Run a gridsearch
- Fit a logistic regression with a basic feature engineering
Iteration 3:
- Perform an EDA. Make assumptions and check them. Example: What if first class passengers survived more. Check the assumption through EDA and create relevant features to help the model capture the information.
- Run a gridsearch
Iteration 4:
Iteration 4:
- Good luck !
- Good luck !

Loading…
Cancel
Save