aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2021-03-14 11:01:19 +0100
committerLuca Deri <deri@ntop.org>2021-03-14 11:01:51 +0100
commit9419015711a78c266f9bf054caf551b88d0ad42d (patch)
tree99684c1affdbc14dacc2fbe4c3da7c26f149d5ed /src/include
parent7f9a18fd054211de0eb24f2340d4c40026c36c6c (diff)
Implemented square erro rollup to avoid overflow
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_typedefs.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index aac7b56db..51a2beb61 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -1646,7 +1646,8 @@ typedef struct {
/* **************************************** */
-#define HW_HISTORY_LEN 4
+#define HW_HISTORY_LEN 4
+#define MAX_SQUARE_ERROR_ITERATIONS 64 /* MUST be < num_values_rollup (256 max) */
struct ndpi_hw_struct {
struct {
@@ -1655,6 +1656,11 @@ struct ndpi_hw_struct {
u_int16_t num_season_periods; /* num of values of a season */
} params;
+ struct {
+ double sum_square_error;
+ u_int8_t num_values_rollup;
+ } prev_error;
+
u_int32_t num_values;
double u, v, sum_square_error;
@@ -1668,6 +1674,11 @@ struct ndpi_ses_struct {
double alpha, ro;
} params;
+ struct {
+ double sum_square_error;
+ u_int8_t num_values_rollup;
+ } prev_error;
+
u_int32_t num_values;
double sum_square_error, last_forecast, last_value;
};
@@ -1677,6 +1688,11 @@ struct ndpi_des_struct {
double alpha, beta, ro;
} params;
+ struct {
+ double sum_square_error;
+ u_int8_t num_values_rollup;
+ } prev_error;
+
u_int32_t num_values;
double sum_square_error, last_forecast, last_trend, last_value;
};