fix: исправлена генерация значений фактора (#53)

Closes #50
This commit is contained in:
MisterMLiL 2023-10-03 11:00:34 +03:00 committed by GitHub
parent 86346b9c5b
commit 4854a14e70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,30 +3,25 @@ import numpy as np
DIRECT_LINK = 0 DIRECT_LINK = 0
INDIRECT_LINK = 1 INDIRECT_LINK = 1
def generate_x_values(mean, std, typeConnection, y): def generate_x_values(mean, std, typeConnection, y):
yMean = np.mean(y) yMean = np.mean(y)
values = [] values = []
for cur_y in y: for cur_y in y:
k = np.abs(cur_y / yMean) raz = np.abs(mean - np.random.normal(mean, std))
if k > 1:
k = 2 - 1 / k
if typeConnection == INDIRECT_LINK: if typeConnection == INDIRECT_LINK:
k = 1 / k raz *= -1
if std == 0: if cur_y > yMean:
k = 1 x = mean + raz
elif cur_y < yMean:
x = np.random.normal(mean * (k ** 3), std * k) x = mean - raz
else:
x = mean
values.append(x) 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) return np.array(values)
def variance_analysis(data): def variance_analysis(data):
return np.array([ return np.array([
[np.mean(col), np.std(col), np.min(col), np.max(col)] for col in data.T [np.mean(col), np.std(col), np.min(col), np.max(col)] for col in data.T
]) ])