Gradient Descent Method
Functions
gradient_descent(model, X_train, Y_train, loss, learning_rate)
Perform one step of gradient descent on the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model |
Sequential
|
The neural network model. |
required |
X_train |
ndarray
|
Input training data. |
required |
Y_train |
ndarray
|
True labels for training data. |
required |
loss |
str
|
The loss function to use. |
required |
learning_rate |
float
|
The learning rate for parameter updates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(accuracy, loss_value) accuracy (float): The model's accuracy on the training data. loss_value (float): The loss value for the current state of the model. |
Example
Note
This function performs forward propagation, backward propagation, and parameter updates. It also calculates and returns the accuracy and loss for the current state of the model.