Skip to content

Conversation

justinxzhao
Copy link
Contributor

@justinxzhao justinxzhao commented Oct 25, 2021

Main changes:

  1. Comment out sequence output related tests.
  2. Try / catch exceptions from metrics.

#2 was inspired by getting test_category_int_dtype to pass.

Unlike tensorflow's metrics libraries, the design of torchmetrics seems to be to throw an exception if it receives "bad" input. In this case, torch's roc_auc metric complains if the given targets have all positive or all negative targets.

The synthetic de-duped data size for the test_category_int_dtype unit test is ~18, and with the default (0.7, 0.1, 0.2) split, it's likely that the validation set (size=2) or test set (size=4) have all True or all False targets, which triggers this exception.

While this phenomenon is unlikely to occur on "real" data, it seems reasonable to simply skip computing the metric in the "rare" instance that torchmetrics throws an error.

The metrics summary table would render like so, and we can check logs for the specific exception.

╒════════════════╤════════╤════════════╤═══════════╕
│ binary_FE3AF   │   loss │   accuracy │   roc_auc │
╞════════════════╪════════╪════════════╪═══════════╡
│ train          │ 0.6899 │     0.5556 │    0.7125 │
├────────────────┼────────┼────────────┼───────────┤
│ vali           │ 0.6979 │     0.0000 │           │
├────────────────┼────────┼────────────┼───────────┤
│ test           │ 0.7006 │     0.2500 │    0.0000 │
╘════════════════╧════════╧════════════╧═══════════╛

@w4nderlust w4nderlust merged commit dd8a1b8 into tf-to-torch Oct 25, 2021
@w4nderlust w4nderlust deleted the simple branch October 25, 2021 20:58
Copy link
Contributor

@ShreyaR ShreyaR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ShreyaR ShreyaR linked an issue Oct 25, 2021 that may be closed by this pull request
4 tasks
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

Successfully merging this pull request may close these issues.

Adding unit tests and fixing integration tests

3 participants