Skip to content

Set alpha value to 0 for RunningAverage #848

@VinhLoiIT

Description

@VinhLoiIT

❓ Questions/Help/Support

When I look at the source code of RunningAverage class, I see that there is a factor variable, alpha, which is set to 0.98 as default. As far as I know, this is to smooth the value of a metric like this:

def compute(self) -> Union[torch.Tensor, float]:
    if self._value is None:
        self._value = self._get_src_value()
    else:
        self._value = self._value * self.alpha + (1.0 - self.alpha) * self._get_src_value()
    return self._value

The use case is that I want to log my metrics during validation time (using contrib.metrics.ProgressBar), these metrics should not be smoothed, however. One more case is that the smoothed value when plotting to Tensorboard is smoothed once again, which leads to quite unreliable the plot. By disabling the smooth factor, I set alpha to 0 and it raised an exception:

if not (0.0 < alpha <= 1.0):
    raise ValueError("Argument alpha should be a float between 0.0 and 1.0.")

I wonder why it is not 0.0 <= alpha <= 1.0 ? Is it a mistake or any idea behind it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions