From 4854a14e709272fe92463ac43d29f9a73a5f9875 Mon Sep 17 00:00:00 2001 From: MisterMLiL <99662459+MisterMLiL@users.noreply.github.com> Date: Tue, 3 Oct 2023 11:00:34 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B0=20(#53)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #50 --- statapp/calculations.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/statapp/calculations.py b/statapp/calculations.py index d06abd1..208eae9 100644 --- a/statapp/calculations.py +++ b/statapp/calculations.py @@ -3,30 +3,25 @@ import numpy as np DIRECT_LINK = 0 INDIRECT_LINK = 1 + def generate_x_values(mean, std, typeConnection, y): yMean = np.mean(y) values = [] for cur_y in y: - k = np.abs(cur_y / yMean) - if k > 1: - k = 2 - 1 / k + raz = np.abs(mean - np.random.normal(mean, std)) if typeConnection == INDIRECT_LINK: - k = 1 / k - if std == 0: - k = 1 - - x = np.random.normal(mean * (k ** 3), std * k) + raz *= -1 + if cur_y > yMean: + x = mean + raz + elif cur_y < yMean: + x = mean - raz + else: + x = mean values.append(x) - # if (x > gfw.mat and cur_y > yMat) or (x < gfw.mat and cur_y < yMat): - # dd = np.append(dd, 1) - # else: - # dd = np.append(dd, 0) - - # x_arr = x_arr.reshape(len(x_arr), 1) - return np.array(values) + def variance_analysis(data): return np.array([ [np.mean(col), np.std(col), np.min(col), np.max(col)] for col in data.T - ]) + ]) \ No newline at end of file