W&B Smoothing Features
Customize line plot smoothing to better visualize noisy data
Created on March 16|Last edited on March 16
Comment
1. Unsmoothed line
Here's our starting point: an unsmoothed timeseries logged with wandb.log() over a series of steps.
Run: magic-morning-17
1
2. Exponential moving average
Here's what that chart looks like with exponential moving average smoothing. This is the default type of smoothing on line plots. I duplicated the chart above, clicked edit, and set the default smoothing to 0.5.
Run: magic-morning-17
1
Original line in the background
You can see a very faint line in the background. This shows the original data, before smoothing. Toggle Show Original off in settings to hide this ghosted line.

Details
Exponential weighted average is calculated by taking the weighted average of the terms coming before a value where the weights correspond to an exponential decay function.
The basic formula for this is
We also add a debiasing term to make our calculation identical to tensorboard without which points close to the beginning would be closer to zero, so the actual formula we use is:
One downside of an exponential weighted average is that it only considers the points to the left of a given point, so a smooth line when smoothed will have an artificially decreased slope.
3. Gaussian smoothing
Here's the same line plot with gaussian smoothing. I duplicated the panel above, clicked edit and set the smoothing type to Gaussian, and the smoothing factor to 1.
Run: magic-morning-17
1
4. Running average
Here's the same line plot with running average smoothing. I duplicated the panel, clicked edit and set the smoothing type to Running Average, and smoothing factor to 5.
Run: magic-morning-17
1
5. Try it yourself!
Open a chart in your own project and try tweaking the smoothing options.

Need sample data to play with? Here's what I ran in Google Colab to make this example:
!pip install wandb -qqq
Then run this cell to log some noisy sample data, which will create a line plot in W&B:
import wandbimport mathimport random# Start a run that logs a sample metric at 100 stepsrun = wandb.init(project="smoothing-example")for step in range(100):wandb.log({"sample_metric": 0.1 * (math.log(1 + step + random.random()) + random.random())})# Mark that run finished - useful in a Jupyter contextwandb.finish()
Add a comment