napkinxc.measures.f1_measure¶
- napkinxc.measures.f1_measure(Y_true, Y_pred, average='micro', zero_division=0)[source]¶
Calculate F1 measure, also known as balanced F-score or F-measure.
- Parameters:
Y_true (ndarray, csr_matrix, list[list|set[int|str]]) – Ground truth provided as a matrix with non-zero values for true labels or a list of lists or sets of true labels.
Y_pred (ndarray, csr_matrix, list[list|set[int|str]], list[list|set[tuple[int|str, float]]) – Predicted labels provided as a matrix with scores or list of lists of labels or tuples of labels with scores (label, score).
average (str) – Determines the type of performed averaging {
'micro'
,'macro'
,'sample'
}, default to'micro'
zero_division (float, optional) – Value to add when there is a zero division, typically set to 0, defaults to 0
- Returns:
Value of F1-measure.
- Return type:
float