Recursive feature elimination fits a model, throws out its weakest column, and repeats until only n columns are left. Because the model is involved at every step, it can notice when two columns say the same thing.
Task: write rfe_columns(n).
load_breast_cancer(return_X_y=True, as_frame=True).train_test_split(X, y, test_size=0.25, random_state=0, stratify=y).make_pipeline(StandardScaler(), RFE(LogisticRegression(max_iter=1000), n_features_to_select=n), LogisticRegression(max_iter=1000)) and fit it on the training rows.Return a dict:
"kept": the names of the columns the RFE step kept, in the order they appear in the data,"test": the pipeline's accuracy on the test rows, rounded to 3 decimal places.