@@ -42,11 +42,14 @@ def sha256(path: Path) -> str:
4242 return digest .hexdigest ()
4343
4444
45- def bootstrap_interval (values : np .ndarray , seed : int , count : int ) -> tuple [float , float ]:
45+ def bootstrap_interval (
46+ values : np .ndarray , seed : int , count : int , level : float
47+ ) -> tuple [float , float ]:
4648 values = np .asarray (values , dtype = float )
4749 rng = np .random .default_rng (seed )
4850 sampled = values [rng .integers (0 , len (values ), size = (count , len (values )))].mean (axis = 1 )
49- low , high = np .quantile (sampled , [0.025 , 0.975 ])
51+ tail = (1.0 - level ) / 2.0
52+ low , high = np .quantile (sampled , [tail , 1.0 - tail ])
5053 return float (low ), float (high )
5154
5255
@@ -203,6 +206,7 @@ def main() -> None:
203206 generic_mean = np .asarray (lock ["generic_prior_mean" ], dtype = float )
204207 generic_settings = lock ["selection" ]["generic" ]
205208 solvai_settings = lock ["selection" ]["solvai" ]
209+ expected_sem = np .asarray (lock ["expected_sem_by_lambda" ], dtype = float )
206210 generic_covariance = rbf_covariance (
207211 grid , generic_settings ["amplitude" ], generic_settings ["lengthscale" ]
208212 )
@@ -223,16 +227,10 @@ def main() -> None:
223227 solvai_settings ["lengthscale" ],
224228 local ,
225229 )
226- generic_expected_noise = np .full (
227- len (grid ),
228- np .nanmedian (group .five_block_sem_kcal_mol .to_numpy (float )) ** 2
229- * generic_settings ["noise_inflation" ],
230- )
231- solvai_expected_noise = np .full (
232- len (grid ),
233- np .nanmedian (group .five_block_sem_kcal_mol .to_numpy (float )) ** 2
234- * solvai_settings ["noise_inflation" ],
230+ generic_expected_noise = (
231+ expected_sem ** 2 * generic_settings ["noise_inflation" ]
235232 )
233+ solvai_expected_noise = expected_sem ** 2 * solvai_settings ["noise_inflation" ]
236234 schedules : list [tuple [str , int , list [int ], np .ndarray , np .ndarray , float , bool ]] = [
237235 (
238236 "fixed_solvai_bq" ,
@@ -424,17 +422,28 @@ def main() -> None:
424422 candidate .absolute_integral_error_kcal_mol
425423 - control .absolute_integral_error_kcal_mol
426424 ).to_numpy (float )
427- low , high = bootstrap_interval (
428- difference , config ["bootstrap_seed" ], config ["bootstrap_resamples" ]
425+ low90 , high90 = bootstrap_interval (
426+ difference ,
427+ config ["bootstrap_seed" ],
428+ config ["bootstrap_resamples" ],
429+ 0.90 ,
430+ )
431+ low95 , high95 = bootstrap_interval (
432+ difference ,
433+ config ["bootstrap_seed" ],
434+ config ["bootstrap_resamples" ],
435+ 0.95 ,
429436 )
430437 comparisons .append (
431438 {
432439 "total_windows" : budget ,
433440 "candidate" : "active_solvai_bq" ,
434441 "comparator" : comparator ,
435442 "candidate_minus_comparator_mae" : float (difference .mean ()),
436- "ci95_low" : low ,
437- "ci95_high" : high ,
443+ "ci90_low" : low90 ,
444+ "ci90_high" : high90 ,
445+ "ci95_low" : low95 ,
446+ "ci95_high" : high95 ,
438447 "fraction_candidate_improved" : float (np .mean (difference < 0 )),
439448 }
440449 )
0 commit comments