Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 3, 2024
1 parent a9992b0 commit 6022e06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion polars_xdt/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,6 @@ def ewma_by_time(
The **adjusted** version is
.. math::
y_0 &= x_0
Expand Down
3 changes: 2 additions & 1 deletion src/ewma_by_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ pub(crate) fn impl_ewma_by_time_float(
let delta_time = time - prev_time;
let result: f64;
if adjust {
let alpha = (prev_alpha+1.) * Pow::pow(0.5, delta_time as f64 / halflife as f64);
let alpha =
(prev_alpha + 1.) * Pow::pow(0.5, delta_time as f64 / halflife as f64);
result = (value + alpha * prev_result) / (1. + alpha);
prev_alpha = alpha;
} else {
Expand Down

0 comments on commit 6022e06

Please sign in to comment.