Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the number of per class ground truths calculation in compute_macro_f_score() #1

Open
astrocyted opened this issue Sep 7, 2023 · 1 comment

Comments

@astrocyted
Copy link

Hi,

The number of ground truths per each class seem to be done in a degenerate way in the following line in case of zero tp_ratios leading to nan values of num_gt

        num_gts = per_class_tp / tp_ratios

https://github.com/DCASE-REPO/psds_eval/blob/41cb9639633271fd676a6a7f26dbff36fbc0c9ba/src/psds_eval/psds.py#L755C41-L755C41

Since there is already a relevant method implemented to obtain gts in the class, the above line seems unnecessary and can be replaced by :

        num_gts = self._get_dataset_counts().values[:-1].astype(float)

the [:-1] slicing is to remove the dummy class injected at the end of the counts tensor, confusion matrix, etc. by the original developers referred to as "injected_psds_world_label". similar slicing for example is perfomed in the line above of the above mentioned line to obtain the tp counts:

per_class_tp = np.diag(counts)[:-1]
@aFewThings
Copy link

Event label "injected_psds_world_label" is not added always as a last element, and it seems that self._get_dataset_counts() returns ordered data by event label alphabetically.

This may address the issue temporarily.

num_gts = self._get_dataset_counts().drop(WORLD).values.astype(float)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants