@@ -485,18 +485,28 @@ def SAC_ensemble_training(self, index_df: pd.core.frame.DataFrame, data: pd.core
485
485
bootstrap_random_state = index_df ['bootstrap_random_state' ].iloc [0 ]
486
486
rng = np .random .default_rng (bootstrap_random_state ) # NumPy's random generator
487
487
bootstrap_indices = rng .choice (data .index , size = len (data ), replace = True ) # Full bootstrap sample
488
+ else :
489
+ bootstrap_indices = None # Place holder
488
490
489
491
res_list = []
490
492
for start in unique_start_indices :
491
- valid_index_window_data_df = data .index [
492
- (data [self .Temporal1 ] >= start ) & (data [self .Temporal1 ] < start + self .temporal_bin_interval )
493
- ]
494
- window_data_df_index = bootstrap_indices [np .isin (bootstrap_indices , valid_index_window_data_df )]
495
- window_data_df = data .loc [window_data_df_index ] # So that we don't need to make a whole copy of the data
493
+
494
+ if self .ensemble_bootstrap :
495
+ valid_index_window_data_df = data .index [
496
+ (data [self .Temporal1 ] >= start ) & (data [self .Temporal1 ] < start + self .temporal_bin_interval )
497
+ ]
498
+ window_data_df_index = bootstrap_indices [np .isin (bootstrap_indices , valid_index_window_data_df )]
499
+ window_data_df = data .loc [window_data_df_index ] # So that we don't need to make a whole copy of the data
500
+ del window_data_df_index , valid_index_window_data_df
496
501
502
+ else :
503
+ window_data_df = data [
504
+ (data [self .Temporal1 ] >= start ) & (data [self .Temporal1 ] < start + self .temporal_bin_interval )
505
+ ]
506
+
497
507
window_data_df = transform_pred_set_to_STEM_quad (self .Spatio1 , self .Spatio2 , window_data_df , index_df )
498
508
window_index_df = index_df [index_df [f"{ self .Temporal1 } _start" ] == start ]
499
-
509
+
500
510
# Merge
501
511
def find_belonged_points (df , df_a ):
502
512
return df_a [
0 commit comments