Skip to main content
. 2023 Aug 25;13(17):2754. doi: 10.3390/diagnostics13172754
Algorithm 1: Logistic Regression algorithm pseudocode
Input:
- Training data: X_train, y_train
- Testing data: X_test
- Learning rate: η
- Regularization parameter: λ
- Number of iterations: num_iterations
Output: Predicted macrosomia risk for each test
Initialize weights w to zeros
For each iteration i in 1 to num_iterations:
         Compute sigmoid function on X_train * w to obtain z
         Compute gradient of loss function with respect to weights w
         Update weights w using gradient descent
         Compute sigmoid function on X_test * w to obtain predicted risk y_pred
Return predicted macrosomia risk for each test example: y_pred