# General Architecture

1. Define the model structure (such as number of input features)
2. Initialize the model’s parameters
3. Loop:
• Calculate current loss (forward propagation)
• Calculate current gradient (backward propagation)

# Step 3: Analyzing the dataset

`Number of training examples: m_train = 209Number of testing examples: m_test = 50Height/Width of each image: num_px = 64Each image is of size: (64, 64, 3)train_set_x shape: (209, 64, 64, 3)train_set_y shape: (1, 209)test_set_x shape: (50, 64, 64, 3)test_set_y shape: (1, 50)`

# Step 3: Reshaping the dataset

`train_set_x_flatten shape: (12288, 209)train_set_y shape: (1, 209)test_set_x_flatten shape: (12288, 50)test_set_y shape: (1, 50)sanity check after reshaping: [17 31 56 22 33]`

# Step 4: Sigmoid function

`print (“sigmoid([0, 2]) = “ + str(sigmoid(np.array([0,2]))))Output : sigmoid([0, 2])[ 0.5 0.88079708]`

# Step 4: Initiating parameters

`Output: w= [[ 0.] [ 0.]] b=0`

# Step 5: Forward and Backward Propogation

`Output : dw=[[ 0.99845601] [ 2.39507239]] ,db=0.00145557813678 ,cost=5.801545319394553`

# Step 6: Optimization

`w = [[0.19033591] [0.12259159]]b = 1.9253598300845747dw = [[0.67752042] [1.41625495]]db = 0.21919450454067652`

# Step 7 : Prediction

1. Calculate Ŷ =A=σ(wTX+b)Y^=A=σ(wTX+b)
2. Convert the entries of a into 0 (if activation <= 0.5) or 1 (if activation > 0.5), stores the predictions in a vector `Y_prediction`. If you wish, you can use an `if`/`else` statement in a `for` loop (though there is also a way to vectorize this).
`predictions = [[1. 1. 0.]]`

# Step 8 : Merge all functions into a mode

`train accuracy: 99.99876382512535 %test accuracy: 72.01052229722973 %`

# If you enjoyed this story, please click the 👏 button and share to help others find it! Feel free to leave a comment below.

Engineer. Data Analyst. Machine Learning enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.