def log_reg_feat_selection(X_train, y_train, X_valid, y_valid, random_state):
"""
Feature selection based on the scores given to the features by the
RandomizedLogisticRegression algorithm.
"""
rlr = RandomizedLogisticRegression(C=[0.001, 0.01, 0.1, 1.],
sample_fraction=0.7,
n_resampling=200, selection_threshold=0.25,
verbose=5, n_jobs=-1, random_state=0)
rlr.fit(X_train, y_train)
np.save('save/feat_sel_log_reg.npy', rlr.scores_)
return rlr.scores_
评论列表
文章目录