Laurae icon indicating copy to clipboard operation
Laurae copied to clipboard

validation_data=NULL

Open ablanda opened this issue 8 years ago • 3 comments

Hi, I try to set validation_data=NULL, but after 1 Layer it stops by this message: Error in alloc.col(dt1, length(colnames(dt1)) + length(cols)) : alloccol has been passed a NULL dt Could you help me? Thanks

ablanda avatar May 12 '17 16:05 ablanda

Do you have a reproducible example?

Laurae2 avatar May 14 '17 14:05 Laurae2

library(Laurae) library(Matrix) library(xgboost) library(data.table)

data("airquality") airquality<-na.omit(airquality) nrow(airquality)

label_train<-airquality[,1] train<-as.data.table(airquality[,-1])

m<-CascadeForest( training_data = train, validation_data = NULL, training_labels = label_train, folds = folds, boosting = FALSE, nthread = 3,

cascade_lr = 1, training_start = NULL, validation_start = NULL, cascade_forests = c(rep(4, 2), 0), cascade_trees = 100, cascade_rf = 4, objective = "reg:linear", eval_metric = Laurae::df_rmse, multi_class = FALSE, early_stopping = 2, maximize = TRUE, verbose = TRUE, essentials = TRUE )

I think you sholud change at row 306 of Cascade forest's script in validation_data <- if (!is.null(validation_data)) { Laurae::DTcbind(validation_data, model[[i]]$valid_preds)} else { NULL }

ablanda avatar May 15 '17 07:05 ablanda

@ablanda My home repo is currently out of sync with the main repo, so I will fix it later.

You can temporarily fix this by doing this like you said:

https://github.com/Laurae2/Laurae/blob/master/R/CascadeForest.R#L306-L307

if (!is.null(validation_data)) {
    validation_data <- Laurae::DTcbind(validation_data, model[[i]]$valid_preds) # Routine overwrites if column names are identical
    validation_start <- if (boosting) {rowMeans(model[[i]]$valid_preds)} else {NULL}
}

do the same for the if here: https://github.com/Laurae2/Laurae/blob/master/R/CascadeForest.R#L445-L446

Laurae2 avatar May 19 '17 21:05 Laurae2