redflag icon indicating copy to clipboard operation
redflag copied to clipboard

Use `logging.warning()` instead of `warnings.warn()`

Open kwinkunks opened this issue 2 years ago • 1 comments

Not 100% sure which is the most idiomatic approach, or what the practical difference would be, so this is just a question for now.

kwinkunks avatar Jul 29 '23 10:07 kwinkunks

Also wondering if I should make a clearer distinction between warnings about redfalg's operation and warnings about data ("red flags"), other than just using a :triangular_flag_on_post: emoji in the data warnings.

For example, could have a custom warning like:

class RedflagWarning(UserWarning):
    def __init__(self, message):
        self.message = message
    def __str__(self):
        return f"🚩 {self.message}"

Then do warnings like

warnings.warn(f"Feature {i} has a distribution that is different from training.", category=RedflagWarning)

kwinkunks avatar Jul 29 '23 11:07 kwinkunks