aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2023-05-19 11:46:03 +0200
committerLuca Deri <deri@ntop.org>2023-05-19 11:46:03 +0200
commit5ca6f0ac62d6b2c346bc99d2a1b1200fe9df7917 (patch)
treed4ba9b547f52c27e8a7f3a65cbb1a0cd1934ca0d /example
parenta8b3baf2b8d7f4fffadc7d35a335ddd2c76770c2 (diff)
Implemented ndpi_predict_linear() for predicting a timeseries value overtime
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index efa5bd666..e43211ddd 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -5150,6 +5150,20 @@ void zscoreUnitTest() {
/* *********************************************** */
+void linearUnitTest() {
+ u_int32_t values[] = {15, 27, 38, 49, 68, 72, 90, 150, 175, 203};
+ u_int32_t prediction;
+ u_int32_t const num = NDPI_ARRAY_LENGTH(values);
+ bool do_trace = false;
+ int rc = ndpi_predict_linear(values, num, 2*num, &prediction);
+
+ if(do_trace) {
+ printf("[rc: %d][predicted value: %u]\n", rc, prediction);
+ }
+}
+
+/* *********************************************** */
+
/**
@brief MAIN FUNCTION
**/
@@ -5189,6 +5203,7 @@ int main(int argc, char **argv) {
exit(0);
#endif
+ linearUnitTest();
zscoreUnitTest();
sesUnitTest();
desUnitTest();