Lag Feature Matrix
~10 mincode completion
Implement lag_features(series, k) returning the array whose row for time t is [yt−1,…,yt−k]. Assume .
Where this shows up
~10 min
••••••••••••••••
8 employers weight this skill
3 big tech firms, 2 AI product companies, 1 defense company, 1 enterprise vendor, 1 quant fund. Top match scores 87.
Python
import numpy as np
def lag_features(series, k):
"""
Build a lag feature matrix from a 1D series.
Args:
series: array of shape (n,), in time order
k: number of lags, 1 <= k < n
Returns:
array of shape (n - k, k); row i is [y[t-1], ..., y[t-k]] for t = k + i
"""
# YOUR CODE HERE
pass