Problem description
If there is no predicted instances for a given class, both Precision and Recall for this class are 0.
The problem happens when using average="macro".
I think that the F1 score building fails because this line does not check that there is no division by zero.
Here is a minimal example:
from sklearn.metrics import f1_score
from hiclass import metrics
y_true = [0, 1]
y_pred = [1, 1]
f1_score(y_true, y_pred, average='macro')
metrics.f1(y_true, y_pred, average='macro')
Solution
The f1 function should return 0 if Precision+Recall=0.
Additionally, the f1 function may also include a "zero_division" parameter as scikit learn's f1_score function.