Skip to content

In verbose mode, make the prefix of the progress bar a fixed-length #487

@npatki

Description

@npatki

Problem Description

When CTGAN or TVAE is used in verbose mode, we show a progress bar (from tqdm) as well as stats about the progress, eg. the discriminator and generator score.

The problem is that the stats change for each epoch. And if the stats end up taking up a different number of characters, then the entire progress bar "jumps" back and forth during the fitting process, which it hard to read. For example, if the discriminator score changes from positive to negative, the bar jumps as follows:

Gen. (-0.93) | Discrim. (-0.21): 90%|█████████     | 900/1000 [01:03<00:10, 15.86it/s]
Gen. (-0.93) | Discrim. (0.01): 90%|█████████     | 900/1000 [01:03<00:10, 15.86it/s]

Expected behavior

I expect that the prefix of the progress bar should be fixed-length not matter what the stats are. This would prevent the bar from jumping back and forth.

I suggest making all the displayed scores (for generators, disciminators, etc) 6-characters long:

  • First character is a + or - sign
  • Then there is a 2-digit number -- padded by a 0 if needed
  • Then a decimal point
  • Then the 2-digit decimal

For example:

Gen. (-00.93) | Discrim. (-01.21): 90%|█████████     | 900/1000 [01:03<00:10, 15.86it/s]
Gen. (-00.93) | Discrim. (+00.01): 90%|█████████     | 900/1000 [01:03<00:10, 15.86it/s]

Additional context

If the score is less than -99.99 or greater than +99.99 (very rare case), then we can just clip the displayed score to -99.99 and +99.99.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions