You are given a binary classification dataset:
-
X
: a 2D array of shape
(n_samples, n_features)
containing numeric features
-
y
: a 1D binary array of shape
(n_samples,)
with values in {0,1}
-
feature_names
: a list of length
n_features
with the name of each column in
X
Task
-
Normalize
each feature column of
X
using z-score standardization:
X:,j′=σjX:,j−μj
where μj and σj are the mean and standard deviation of feature j computed on the training set.
-
Fit a
logistic regression
model on the normalized features.
-
Rank features by their learned coefficient values (largest to smallest), and return the
top 3 feature names
.
Output
Return a list of 3 strings: the names of the top-3 features.
Notes
-
Assume binary logistic regression (one coefficient per feature).
-
Specify how you handle ties and how you deal with regularization defaults in common libraries.