A scaled logistic regression classifies the three wine growers. Which columns does it actually lean on, measured on wines it has not seen?
Task: write top_columns(n).
load_wine(return_X_y=True, as_frame=True).train_test_split(X, y, test_size=0.3, random_state=1, stratify=y).make_pipeline(StandardScaler(), LogisticRegression(max_iter=1000)) on the training rows.permutation_importance(model, X_test, y_test, n_repeats=10, random_state=0).n columns with the highest mean importance, highest first.