Skip to content

Instantly share code, notes, and snippets.

@keckelt
Created April 13, 2022 11:17
Show Gist options
  • Save keckelt/685d31697613d686aa04882823310771 to your computer and use it in GitHub Desktop.
Save keckelt/685d31697613d686aa04882823310771 to your computer and use it in GitHub Desktop.
wandb -tracking hyperparameter tuning
# preprocessing
for gamma in tqdm(['scale', 'auto'], 'gamma', leave=False):
for kernel in tqdm(['rbf', 'poly'], 'kernel', leave=False):
for c in tqdm([0.1, 1, 10, 100, 1000], 'c', leave=False):
wandb.init(project="ails-challenge-1", entity="keckelt", tags=["svm"])
params = {
"gamma": gamma,
"kernel": kernel,
"C": c,
"probability":True,
"cache_size":2048, # 2GB
"random_state": korok_seed
}
models, y_hats_proba, y_hats_class = train_svm(X_train, y_train, X_test, params)
auc_per_task = calc_masked_AUC_per_task(y_hats_proba, y_test)
auc = np.mean(auc_per_task)
config = {
"AUC": auc,
"TASK_AUC": auc_per_task,
**params
}
if (auc > best_auc):
best_auc = auc
tqdm.write(str(config))
wandb.log(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment