The recursive feature elimination with cross-validation is taking too long to run. How do I increase the speed?
X and y
X = df.iloc[:,7:-2]
y = df["subtype"]
X.shape
(867, 142513)
Scale the dataset
# scale the dataset
sc = StandardScaler()
X = pd.DataFrame(sc.fit_transform(X))
RFE with cross-validation
# Recursive feature elimination with cross-validation
## Create the RFE object and compute a cross-validated score.
svc = SVC(kernel="linear")
## The "accuracy" scoring shows the proportion of correct classifications
min_features_to_select = 7000 # Minimum number of features to consider
rfecv = RFECV(
estimator=svc,
step=7,
cv=StratifiedKFold(5),
scoring="accuracy",
min_features_to_select=min_features_to_select,
)
rfecv.fit_transform(X, y)