Implement Linear Regression Training
Company: N/A
Role: Machine Learning Engineer
Category: Coding & Algorithms
Interview Round: Onsite
Quick Answer: This question evaluates understanding of linear regression, mean squared error loss, gradient computation, parameter updates, and proficiency with vectorized numerical operations used in batch gradient descent.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([[1.0],[2.0]], [2.0,4.0], 0.1, 2)
Expected Output: [[1.32], 0.78]
Explanation: Two epochs from zero initialization.
Input: ([[1.0,0.0],[0.0,1.0]], [1.0,2.0], 0.05, 3)
Expected Output: [[0.121625, 0.26425], 0.385875]
Explanation: Multiple features are updated by batch gradients.
Input: ([], [], 0.1, 5)
Expected Output: [[], 0.0]
Explanation: Empty data returns zero parameters.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.