mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 12:12:59 +03:00
parent
86346b9c5b
commit
4854a14e70
@ -3,29 +3,24 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user