【FastAI】FastAI

Posted by ShawnD on December 8, 2021

Reproducible

每次实验结果不一样, 即便使用了 set_seed(seed, reproducible=True)

每次 fit 之前都需要

1
2
seed_everything(seed)
dls.rng.seed(seed)

AUC

1
2
3
4
5
6
from sklearn.metrics import roc_auc_score

def my_auc(inp, targ):
    "Simple wrapper around scikit's roc_auc_score function for regression problems"
    inp,targ = flatten_check(inp,targ)
    return roc_auc_score(targ.cpu().numpy(), inp.cpu().numpy())

Reference

  1. https://github.com/fastai/fastai/issues/2832
  2. https://forums.fast.ai/t/using-auc-as-metric-in-fastai/38917/38