Running examples in ‘gKRLS-Ex.R’ failed
The error most likely occurred in:

> ### Name: ml_gKRLS
> ### Title: Machine Learning with gKRLS
> ### Aliases: ml_gKRLS SL.mgcv predict.SL.mgcv add_bam_to_mlr3
> 
> ### ** Examples
> 
> set.seed(789)
> N <- 100
> x1 <- rnorm(N)
> x2 <- rbinom(N, size = 1, prob = .2)
> y <- x1^3 - 0.5 * x2 + rnorm(N, 0, 1)
> y <- y * 10
> X <- cbind(x1, x2, x1 + x2 * 3)
> X <- cbind(X, "x3" = rexp(nrow(X)))
> 
> if (requireNamespace("SuperLearner", quietly = TRUE)) {
+ # Estimate Ensemble with SuperLearner
+   require(SuperLearner)
+   sl_m <- function(...) { SL.mgcv(formula = ~ x1 + x2 + x3, ...) }
+   fit_SL <- SuperLearner::SuperLearner(
+     Y = y, X = data.frame(X),
+     SL.library = "sl_m"
+   )
+   pred <- predict(fit_SL, newdata = data.frame(X))
+ }
Loading required package: SuperLearner
Loading required package: nnls
Loading required package: gam
Loading required package: splines
Loading required package: foreach
Loaded gam 1.22-7


Attaching package: ‘gam’

The following objects are masked from ‘package:mgcv’:

    gam, gam.control, gam.fit, s

Super Learner
Version: 2.0-40
Package created on 2025-12-14

> # Estimate Double/Debiased Machine Learning
> if (requireNamespace("DoubleML", quietly = TRUE)) {
+   require(DoubleML)
+   # Load the models; for testing *ONLY* have multiplier of 2
+   double_bam_1 <- LearnerRegrBam$new()
+   double_bam_1$param_set$values$formula <- ~ s(x1, x3, bs = "gKRLS", 
+     xt = gKRLS(sketch_multiplier = NULL, sketch_size_raw = 2))
+   double_bam_2 <- LearnerClassifBam$new()
+   double_bam_2$param_set$values$formula <- ~ s(x1, x3, bs = "gKRLS", 
+     xt = gKRLS(sketch_multiplier = NULL, sketch_size_raw = 2))
+ 
+   # Create data
+   dml_data <- DoubleMLData$new(
+     data = data.frame(X, y),
+     x_cols = c("x1", "x3"), y_col = "y",
+     d_cols = "x2"
+   )
+   # Estimate effects treatment (works for other DoubleML methods)
+   dml_est <- DoubleMLIRM$new(
+     data = dml_data,
+     n_folds = 2,
+     ml_g = double_bam_1,
+     ml_m = double_bam_2
+   )$fit()
+ }
Loading required package: DoubleML
INFO  [01:09:43.185] [mlr3] Applying learner 'classif.bam' on task 'nuis_m' (iter 1/2)
INFO  [01:09:46.513] [mlr3] Applying learner 'classif.bam' on task 'nuis_m' (iter 2/2)
Error in `[.data.table`(data, , `:=`("task_hash", task[[1L]]$hash), by = "uhash") : 
  attempt access index 9/9 in VECTOR_ELT
Calls: <Anonymous> ... initialize -> .__ResultData__initialize -> [ -> [.data.table
Execution halted