Implement:
def train_linear_regression_production(
input: np.ndarray,
target: np.ndarray,
lr: float,
epochs: int,
batch_size: int,
seed: int | None = None,
) -> tuple[np.ndarray, np.ndarray]:
"""
Mini-batch gradient descent, reusing mse_gradient / gd_step per batch
instead of once per epoch over the full dataset.
"""
Your function should:
batch_size (the last batch may be smaller if n_samples doesn't divide evenly, must not crash or silently drop it).input at a time inside the per-batch step (no operation should touch the full input array once batching starts).seed: when given, two calls with the same seed (and the same everything else) must return exactly the same weight, bias, including across epochs, not just within the first one. When seed is None, training is genuinely random run to run.weight/bias follow 01-hypothesis-function's convention: weight shape (1, in_features), bias shape (1,), never squeezed.Click "Run Tests" to test your implementation