Пример #1
0
def get_vectors(R0_scale=1):
    beta_vec_new = R0_scale * beta_vec
    beta_vec_list_new = beta_vec_new.tolist()
    beta_0 = R0_scale * np.random.gamma(R0_scale * R0_isol_mean, 1 / R0_scale,
                                        N_nodes) / Trec_vec
    beta_0_list = beta_0.tolist()
    beta_1 = R0_scale * hp.power_law_pdf(np.random.uniform(0, 1, N_nodes), a0,
                                         a1, scale_nonisol) / Trec_vec
    beta_1_list = beta_vec_list_new
    return beta_vec_list_new, Trec_vec_list, beta_0_list, beta_1_list
Пример #2
0
## 2.add distribution for R0
## 2.A self-isolated
isol_share = 0.7
N_nodes_isol = round(isol_share * N_nodes)
R0_scale = 100  #10**2
R0_isol_mean = 0.25 * 3.96  # 1.43
R0_isol_vec = np.random.gamma(R0_scale * R0_isol_mean, 1 / R0_scale,
                              N_nodes_isol)

## 2.B non-isolated
a0 = R0_isol_mean + np.std(R0_isol_vec)  #2
a1 = 14  #16
scale_nonisol = 2.3  #1.65
N_nodes_nonisol = N_nodes - N_nodes_isol
R0_nonisol_vec = hp.power_law_pdf(np.random.uniform(0, 1, N_nodes_nonisol), a0,
                                  a1, scale_nonisol)

## 2.C joint distribution
R0_vec = shuffle(np.transpose(
    [*np.transpose(R0_isol_vec), *np.transpose(R0_nonisol_vec)]),
                 random_state=0)
R0_vec_list = R0_vec.tolist()
R0_mean = np.mean(R0_vec)
R0_std = np.std(R0_vec)

## 3. exctract Beta
beta_vec = R0_vec / Trec_vec
beta_vec_mean = np.mean(beta_vec)
## use this -->>
beta_vec_list = beta_vec.tolist()