cherry.plot¶
cherry.plot.ci95(values)
¶
Description¶
Computes the 95% confidence interval around the given values.
Arguments¶
values
(list) - List of values for which to compute the 95% confidence interval.
Returns¶
(float, float)
The lower and upper bounds of the confidence interval.
Example¶
from statistics import mean
smoothed = []
for replay in replays:
rewards = replay.rewards.view(-1).tolist()
y_smoothed = ch.plot.smooth(rewards)
smoothed.append(y_smoothed)
means = [mean(r) for r in zip(*smoothed)]
confidences = [ch.plot.ci95(r) for r in zip(*smoothed)]
lower_bound = [conf[0] for conf in confidences]
upper_bound = [conf[1] for conf in confidences]
cherry.plot.exponential_smoothing(x, y = None, temperature = 1.0)
¶
Decription¶
Two-sided exponential moving average for smoothing a curve.
It performs regular exponential moving average twice from two different sides and then combines the results together.
Credit¶
Adapted from OpenAI's baselines implementation.
Arguments¶
x
(ndarray/tensor/list) - x values, in accending order.y
(ndarray/tensor/list) - y values.temperature
(float, optional, default=1.0) - The higher, the smoother.
Return¶
- x_smoothed (ndarray) - x values after resampling.
- y_smoothed (ndarray) - y values after smoothing.
Example¶
from cherry.plot import exponential_smoothing
x_smoothed, y_smoothed, _ = exponential_smoothing(x_original,
y_original,
temperature=3.)