Recursive feature elimination (RFE) fits a model, drops the least important feature, and repeats. With a linear model on standardised features, importance is the absolute coefficient.
Implement:
ridge_coefs(X, y, lam): standardise X's columns (zero mean, unit population std; a constant column stays all zeros), centre y, and return the ridge coefficients rfe(X, y, n_keep, lam=1.0): return (kept, eliminated): the sorted original indices of the surviving features, and the features in the order they were removed. Each round, refit on the remaining columns and remove the one with the smallest |coefficient| (ties: lowest original index).