Metrics

Metrics not included in fastai.


source

MatthewsCorrCoefBinary


def MatthewsCorrCoefBinary(
    sample_weight:NoneType=None
):

Matthews correlation coefficient for single-label classification problems


source

get_task_metrics


def get_task_metrics(
    dls, binary_metrics:NoneType=None, multi_class_metrics:NoneType=None, regression_metrics:NoneType=None,
    verbose:bool=True
):

Call self as a function.

All metrics applicable to multi classification have been created by Doug Williams (https://github.com/williamsdoug). Thanks a lot Doug!!


source

F1_multi


def F1_multi(
    args:VAR_POSITIONAL, kwargs:VAR_KEYWORD
):

Call self as a function.


source

Fbeta_multi


def Fbeta_multi(
    inp, targ, beta:float=1.0, thresh:float=0.5, sigmoid:bool=True
):

Computes Fbeta when inp and targ are the same size.


source

balanced_accuracy_multi


def balanced_accuracy_multi(
    inp, targ, thresh:float=0.5, sigmoid:bool=True
):

Computes balanced accuracy when inp and targ are the same size.


source

specificity_multi


def specificity_multi(
    inp, targ, thresh:float=0.5, sigmoid:bool=True
):

Computes specificity (true negative rate) when inp and targ are the same size.


source

recall_multi


def recall_multi(
    inp, targ, thresh:float=0.5, sigmoid:bool=True
):

Computes recall when inp and targ are the same size.


source

precision_multi


def precision_multi(
    inp, targ, thresh:float=0.5, sigmoid:bool=True
):

Computes precision when inp and targ are the same size.


source

metrics_multi_common


def metrics_multi_common(
    inp, targ, thresh:float=0.5, sigmoid:bool=True, by_sample:bool=False
):

Computes TP, TN, FP, FN when inp and targ are the same size.


source

accuracy_multi


def accuracy_multi(
    inp, targ, thresh:float=0.5, sigmoid:bool=True, by_sample:bool=False
):

Computes accuracy when inp and targ are the same size.


source

mae


def mae(
    inp, targ
):

Mean absolute error between inp and targ.


source

mape


def mape(
    inp, targ
):

Mean absolute percentage error between inp and targ.

n_classes = 4
inp = torch.normal(0, 1, (16, 20, n_classes))
targ = torch.randint(0, n_classes, (16, 20)).to(torch.int8)
_mAP(inp, targ)
0.27493315845795063