Skip to content

Instantly share code, notes, and snippets.

@3catz
Created October 28, 2020 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3catz/6545aad3cb8c63517ab4af4526ffb9db to your computer and use it in GitHub Desktop.
Save 3catz/6545aad3cb8c63517ab4af4526ffb9db to your computer and use it in GitHub Desktop.
Vetting of GA feature subsets
scores = []
for i in range(len(report)):
myfeats = report.iloc[i,1] ; print(myfeats)
X = D[myfeats] ; y = y
clf = LogisticRegression(solver = "liblinear", C = 6, tol = 1)
#clf = RandomForestClassifier()
rskf = RepeatedStratifiedKFold(n_splits = 10, n_repeats = 100)
score = np.mean(cross_val_score(clf, X, y, cv = rskf, scoring = "roc_auc"))
scores.append(score)
print("Score This Round", score)
print("-------------------")
for i in range(len(scores)):
if scores[i] == np.max(scores):
print("Max Score", scores[i]); print("Features:", report.iloc[i,1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment