Sensor matrices arrive with holes, and the model downstream needs a dense array. Interpolating each row with a Python loop and np.interp is eight lines and works; doing it for a matrix with a hundred thousand rows in an inner loop is where it stops working.
Implement interpolate_rows(x) for a 2-D array of shape (n, d) containing nan. Along each row independently, left to right:
nan.row = [nan, 1.0, nan, nan, 4.0, nan]
result = [1.0, 1.0, 2.0, 3.0, 4.0, 4.0]
^hold ^interpolated ^hold
Known values are never modified.
Do it without any Python loops, including no loop over rows. Every part of this is expressible with np.maximum.accumulate, np.minimum.accumulate and fancy indexing, and finding that is the exercise.
Build the architecture on a canvas: place the components, configure them, connect them into a data flow, and write a short reason for each one. The AI reviewer grades your design against a rubric written specifically for this problem.
Minimum 5 components · needs a wide desktop screen