aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_analyze.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2022-09-01 22:06:44 +0200
committerLuca Deri <deri@ntop.org>2022-09-01 22:06:57 +0200
commit7578d02de9f196f73e2de47c457a1edc7f4c248d (patch)
treea38a6b6b8f51e4e2a2cb303d3fac297e4dcafb72 /src/lib/ndpi_analyze.c
parentbd29fa46ba222c357f0a654b807eaee00a60d7d9 (diff)
Fixes on hw calculation
Diffstat (limited to 'src/lib/ndpi_analyze.c')
-rw-r--r--src/lib/ndpi_analyze.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c
index 2b5d46a90..e3418afb4 100644
--- a/src/lib/ndpi_analyze.c
+++ b/src/lib/ndpi_analyze.c
@@ -1135,9 +1135,9 @@ int ndpi_hw_add_value(struct ndpi_hw_struct *hw, const u_int64_t _value, double
error = value - *forecast;
sq_error = error * error;
- hw->sum_square_error += sq_error, hw->prev_error.sum_square_error += sq_error;;
- observations = (hw->num_values < MAX_SQUARE_ERROR_ITERATIONS) ? hw->num_values : ((hw->num_values % MAX_SQUARE_ERROR_ITERATIONS) + MAX_SQUARE_ERROR_ITERATIONS);
- sq = sqrt(hw->sum_square_error / (observations - hw->params.num_season_periods));
+ hw->sum_square_error += sq_error, hw->prev_error.sum_square_error += sq_error;
+ observations = (hw->num_values < MAX_SQUARE_ERROR_ITERATIONS) ? hw->num_values : ((hw->num_values % MAX_SQUARE_ERROR_ITERATIONS) + MAX_SQUARE_ERROR_ITERATIONS + 1);
+ sq = sqrt(hw->sum_square_error / observations);
*confidence_band = hw->params.ro * sq;
#ifdef HW_DEBUG