From 419ab2e36fb1de4339f98a6b4c5aa81016aa8dd4 Mon Sep 17 00:00:00 2001 From: Alexandr Velikiy <39257464+VargBurz@users.noreply.github.com> Date: Mon, 23 Jul 2018 21:05:14 +0300 Subject: [PATCH] new init (#92) --- analytics/utils/__init__.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/analytics/utils/__init__.py b/analytics/utils/__init__.py index 39a0bf5..8d763e0 100644 --- a/analytics/utils/__init__.py +++ b/analytics/utils/__init__.py @@ -79,4 +79,22 @@ def logistic_sigmoid(self, x1, x2, alpha, height): for i in range(x1, x2): F = 1 * height / (1 + math.exp(-i * alpha)) distribution.append(F) - return distribution \ No newline at end of file + return distribution + +def findOneJump(data, x, size, height, err): + l = [] + for i in range(x + 1, x + size): + if (data[i] > data[x] and data[x + size] > data[x] + height): + l.append(data[i]) + if len(l) > size * err: + return x + else: + return 0 + +def findAllJumps(data, size, height): + possible_jump_list = [] + for i in range(len(data - size): + x = findOneJump(data, i, size, height, 0.9) + if x > 0: + possible_jump_list.append(x) + return possible_jump_list \ No newline at end of file