``` r
n_replicates <- 50  # number of replicates
r2_threshold <- 0.5 # threshold for "good" prediction
TM_list <- list()
MP_list <- list()
FI_list <- list()

# Perform bootstrapping
for (i in 1:n_replicates) {
  cat("Beginning replicate", i)
  cat("\n")
  result <- train_models_split(vsd_energetic_state_GO_t, full_pred_counts)
  
  cat("Extracting results for replicate", i)
  cat("\n")
  trained_models <- result$models
  model_performance <- result$performance
  feature_importance <- get_feature_importance(trained_models)
  
  TM_list[[i]] <- trained_models
  TM_list[[i]]$Replicate <- i
  
  MP_list[[i]] <- model_performance
  MP_list[[i]]$Replicate <- i
  
  FI_list[[i]] <- feature_importance
  FI_list[[i]]$Replicate <- i
}
```

```
## Beginning replicate 1
## Extracting results for replicate 1
## Beginning replicate 2
## Extracting results for replicate 2
## Beginning replicate 3
## Extracting results for replicate 3
## Beginning replicate 4
## Extracting results for replicate 4
## Beginning replicate 5
## Extracting results for replicate 5
## Beginning replicate 6
## Extracting results for replicate 6
## Beginning replicate 7
## Extracting results for replicate 7
## Beginning replicate 8
## Extracting results for replicate 8
## Beginning replicate 9
## Extracting results for replicate 9
## Beginning replicate 10
## Extracting results for replicate 10
## Beginning replicate 11
## Extracting results for replicate 11
## Beginning replicate 12
## Extracting results for replicate 12
## Beginning replicate 13
## Extracting results for replicate 13
## Beginning replicate 14
## Extracting results for replicate 14
## Beginning replicate 15
## Extracting results for replicate 15
## Beginning replicate 16
## Extracting results for replicate 16
## Beginning replicate 17
## Extracting results for replicate 17
## Beginning replicate 18
## Extracting results for replicate 18
## Beginning replicate 19
## Extracting results for replicate 19
## Beginning replicate 20
## Extracting results for replicate 20
## Beginning replicate 21
## Extracting results for replicate 21
## Beginning replicate 22
## Extracting results for replicate 22
## Beginning replicate 23
## Extracting results for replicate 23
## Beginning replicate 24
## Extracting results for replicate 24
## Beginning replicate 25
## Extracting results for replicate 25
## Beginning replicate 26
## Extracting results for replicate 26
## Beginning replicate 27
## Extracting results for replicate 27
## Beginning replicate 28
## Extracting results for replicate 28
## Beginning replicate 29
## Extracting results for replicate 29
## Beginning replicate 30
## Extracting results for replicate 30
## Beginning replicate 31
## Extracting results for replicate 31
## Beginning replicate 32
## Extracting results for replicate 32
## Beginning replicate 33
## Extracting results for replicate 33
## Beginning replicate 34
## Extracting results for replicate 34
## Beginning replicate 35
## Extracting results for replicate 35
## Beginning replicate 36
## Extracting results for replicate 36
## Beginning replicate 37
## Extracting results for replicate 37
## Beginning replicate 38
## Extracting results for replicate 38
## Beginning replicate 39
## Extracting results for replicate 39
## Beginning replicate 40
## Extracting results for replicate 40
## Beginning replicate 41
## Extracting results for replicate 41
## Beginning replicate 42
## Extracting results for replicate 42
## Beginning replicate 43
## Extracting results for replicate 43
## Beginning replicate 44
## Extracting results for replicate 44
## Beginning replicate 45
## Extracting results for replicate 45
## Beginning replicate 46
## Extracting results for replicate 46
## Beginning replicate 47
## Extracting results for replicate 47
## Beginning replicate 48
## Extracting results for replicate 48
## Beginning replicate 49
## Extracting results for replicate 49
## Beginning replicate 50
## Extracting results for replicate 50
```

``` r
# Combine all results
all_TM <- do.call(rbind, TM_list)
all_MP <- do.call(rbind, MP_list)
all_FI <- do.call(rbind, FI_list)
```