@@ -71,6 +71,9 @@ def sim1(sim_size,sim_sigma = 5.5,sim_lam = 1e-4,sim_weak_nonlin = 0.5,random_se
71
71
LVp = compute_Linv (Lp ,1 )
72
72
LV = apply_eigen_perm (Pr ,LVp )
73
73
V = (LV .T @ LV ) * sim_sigma
74
+ V = V .toarray ()
75
+ V [np .abs (V ) < 1e-4 ] = 0 # Minimize numerical inaccuracies between different systems to ensure similar behavior
76
+
74
77
#V = scp.sparse.linalg.spsolve(sim_mat.T @ sim_mat + sim_S,scp.sparse.eye((sim_S.shape[1]),format='csc')) * sim_sigma
75
78
76
79
# Get matrix for x effects
@@ -116,9 +119,9 @@ def sim1(sim_size,sim_sigma = 5.5,sim_lam = 1e-4,sim_weak_nonlin = 0.5,random_se
116
119
rand_matrix = np .zeros ((100 ,len (time_pred )))
117
120
for sim_idx in range (sim_size ):
118
121
if not random_seed is None :
119
- sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = random_seed + sim_idx ),cov = V . toarray () ,size = 1 ,random_state = random_seed + sim_idx )
122
+ sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = random_seed + sim_idx ),cov = V ,size = 1 ,random_state = random_seed + sim_idx )
120
123
else :
121
- sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = None ),cov = V . toarray () ,size = 1 ,random_state = None )
124
+ sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = None ),cov = V ,size = 1 ,random_state = None )
122
125
sample [0 ] = 0
123
126
take = np_gen .integers (int (len (time_pred )/ 4 ),len (time_pred )+ 1 )
124
127
fact .extend (np .repeat (fl [sim_idx ],take ))
@@ -228,6 +231,9 @@ def sim2(sim_size,sim_sigma = 5.5,sim_lam = 1e-4,set_zero = 1,random_seed=None,f
228
231
LVp = compute_Linv (Lp ,1 )
229
232
LV = apply_eigen_perm (Pr ,LVp )
230
233
V = (LV .T @ LV ) * sim_sigma
234
+ V = V .toarray ()
235
+ V [np .abs (V ) < 1e-4 ] = 0 # Minimize numerical inaccuracies between different systems to ensure similar behavior
236
+
231
237
#V = scp.sparse.linalg.spsolve(sim_mat.T @ sim_mat + sim_S,scp.sparse.eye((sim_S.shape[1]),format='csc')) * sim_sigma
232
238
233
239
# Get matrix for x effects
@@ -278,9 +284,9 @@ def sim2(sim_size,sim_sigma = 5.5,sim_lam = 1e-4,set_zero = 1,random_seed=None,f
278
284
rand_matrix = np .zeros ((100 ,len (time_pred )))
279
285
for sim_idx in range (sim_size ):
280
286
if not random_seed is None :
281
- sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = random_seed + sim_idx ),cov = V . toarray () ,size = 1 ,random_state = random_seed + sim_idx )
287
+ sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = random_seed + sim_idx ),cov = V ,size = 1 ,random_state = random_seed + sim_idx )
282
288
else :
283
- sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = None ),cov = V . toarray () ,size = 1 ,random_state = None )
289
+ sample = scp .stats .multivariate_normal .rvs (mean = scp .stats .norm .rvs (size = (sim_S .shape [1 ]),scale = 5 ,random_state = None ),cov = V ,size = 1 ,random_state = None )
284
290
sample [0 ] = 0
285
291
take = np_gen .integers (int (len (time_pred )/ 4 ),len (time_pred )+ 1 )
286
292
0 commit comments