TensorTonicTensorTonic
Problems
Study PlansProjectsNewInterviewPricingFeedback
Problems
Loading...
1 / 1

Double Exponential Smoothing

Time Series
Medium

Holt's double exponential smoothing tracks both the current level and a linear trend. Initialize the level with the first observation and the trend with the difference between the first two observations.

Update the level at each later time:

ℓt=αyt+(1−α)(ℓt−1+bt−1)\ell_t = \alpha y_t + (1-\alpha)(\ell_{t-1}+b_{t-1})ℓt​=αyt​+(1−α)(ℓt−1​+bt−1​)

Then update the trend:

bt=β(ℓt−ℓt−1)+(1−β)bt−1b_t = \beta(\ell_t-\ell_{t-1}) + (1-\beta)b_{t-1}bt​=β(ℓt​−ℓt−1​)+(1−β)bt−1​

In these equations, the observation is the current input value, the level is its smoothed estimate, and the trend is the smoothed rate of change. Alpha controls level smoothing, while beta controls trend smoothing. Return all level values, including the initial level.

Loading visualization...

Examples

Input: series = [10, 20, 30], alpha = 0.5, beta = 0.5

Output: [10, 20.0, 30.0]

Explanation: The initialized trend is 10, so both updates follow this perfectly linear series.

Input: series = [5, 5, 5, 5], alpha = 0.9, beta = 0.1

Output: [5, 5.0, 5.0, 5.0]

Hint 1

Store the old level until both update equations have been evaluated.

Hint 2

Append the initial level before looping from index 1.

Requirements

  • Initialize level from the first value.
  • Initialize trend as the second value minus the first.
  • Update level before using the new level to update trend.
  • Return one level value for every input observation.

Constraints

  • series contains at least two numeric values.
  • 0 < alpha <= 1.
  • 0 < beta <= 1.
  • Time limit: 300 ms.
Try Similar Problems
Exponential Moving AverageWeighted Moving AverageSimple Moving AverageSeasonal AverageLag Features

Sign in to take notes on this problem

Case 1
Case 2

Accepts: array

Accepts: number

Accepts: number

You must run your code first.
PrevNext

Double Exponential Smoothing

Time Series
Medium

Holt's double exponential smoothing tracks both the current level and a linear trend. Initialize the level with the first observation and the trend with the difference between the first two observations.

Update the level at each later time:

ℓt=αyt+(1−α)(ℓt−1+bt−1)\ell_t = \alpha y_t + (1-\alpha)(\ell_{t-1}+b_{t-1})ℓt​=αyt​+(1−α)(ℓt−1​+bt−1​)

Then update the trend:

bt=β(ℓt−ℓt−1)+(1−β)bt−1b_t = \beta(\ell_t-\ell_{t-1}) + (1-\beta)b_{t-1}bt​=β(ℓt​−ℓt−1​)+(1−β)bt−1​

In these equations, the observation is the current input value, the level is its smoothed estimate, and the trend is the smoothed rate of change. Alpha controls level smoothing, while beta controls trend smoothing. Return all level values, including the initial level.

Loading visualization...

Examples

Input: series = [10, 20, 30], alpha = 0.5, beta = 0.5

Output: [10, 20.0, 30.0]

Explanation: The initialized trend is 10, so both updates follow this perfectly linear series.

Input: series = [5, 5, 5, 5], alpha = 0.9, beta = 0.1

Output: [5, 5.0, 5.0, 5.0]

Hint 1

Store the old level until both update equations have been evaluated.

Hint 2

Append the initial level before looping from index 1.

Requirements

  • Initialize level from the first value.
  • Initialize trend as the second value minus the first.
  • Update level before using the new level to update trend.
  • Return one level value for every input observation.

Constraints

  • series contains at least two numeric values.
  • 0 < alpha <= 1.
  • 0 < beta <= 1.
  • Time limit: 300 ms.
Try Similar Problems
Exponential Moving AverageWeighted Moving AverageSimple Moving AverageSeasonal AverageLag Features

Sign in to take notes on this problem

Case 1
Case 2

Accepts: array

Accepts: number

Accepts: number

You must run your code first.