Hyperparameter Tuning and Regularization Paths in Logistic Regression

Published:

In this project, we implemented logistic regression for binary classification using mini-batch stochastic gradient descent (SGD) with L2 regularization and applied it to the UCI Spambase dataset. The dataset was intentionally split into a very small training set (5%) and a large held-out test set (95%) in order to emphasize overfitting and highlight the bias-variance trade-off. We first examined optimization behaviour under different batch sizes and learning rates, comparing training dynamics with and without L2 regularization. We then performed K-fold cross validation to tune hyperparameters, including learning rate, batch size, number of epochs, and regularization strength. Next, we explicitly demonstrated the bias-variance trade-off sweeping the L2 regularization parameter and evaluating training and validation performance. Finally, we studied L1-regularized logistic regression to visualize the regularization path, observe sparsity patterns in feature coefficients, and examine the trade-off between interpretability and predictive performance.

View Paper | Download Code

Model Architecture