Full Training Loop
Intermediate classical-mlclassificationtraining-loop
Implement:
def train_logistic_regression(
input: np.ndarray,
target: np.ndarray,
lr: float,
epochs: int,
) -> tuple[np.ndarray, np.ndarray]:
"""
input: shape (batch_size, in_features)
target: shape (batch_size,), 0 or 1 per sample
Returns:
weight: shape (1, in_features)
bias: shape (1,)
"""
Reuse 01-hypothesis-function's linear, 01-sigmoid's sigmoid, 03-bce-gradient's bce_gradient, and Linear Regression's 04-gd-step's gd_step, rather than reimplementing any of their logic.