l-magnificence / Mime

Machine learning-based integration model with elegant performance
Other
47 stars 7 forks source link

terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append #26

Closed liudanmai11 closed 3 weeks ago

liudanmai11 commented 1 month ago

Hi, when I use ML.Dev.Prog.Sig function I get the following error, how can I solve this problem? Error in unserialize(node$con) : error reading from connection

  1. unserialize(node$con)
  2. recvData.SOCKnode(con)
  3. recvData(con)
  4. FUN(X[[i]], ...)
  5. lapply(cl[1:jobs], recvResult)
  6. staticClusterApply(cl, fun, length(x), argfun)
  7. clusterApply(cl = cl, x = splitList(X, nchunks), fun = lapply, FUN = fun, ...)
  8. do.call(c, clusterApply(cl = cl, x = splitList(X, nchunks), fun = lapply, FUN = fun, ...), quote = TRUE)
  9. parallel::parLapply(cl = cluster, X = 1:cv.folds, fun = gbmDoFold, i.train, x, y, offset, distribution, w, var.monotone, n.trees, interaction.depth, n.minobsinnode, shrinkage, bag.fraction, cv.group, var.names, response.name, group, seeds)
  10. gbmCrossValModelBuild(cv.folds, cv.group, n.cores, i.train, x, y, offset, distribution, w, var.monotone, n.trees, interaction.depth, n.minobsinnode, shrinkage, bag.fraction, var.names, response.name, group)
  11. gbmCrossVal(cv.folds = cv.folds, nTrain = nTrain, n.cores = n.cores, class.stratify.cv = class.stratify.cv, data = data, x = x, y = y, offset = offset, distribution = distribution, w = w, var.monotone = var.monotone, n.trees = n.trees, interaction.depth = interaction.depth, ...
  12. gbm(formula = Surv(OS.time, OS) ~ ., data = est_dd2, distribution = "coxph", n.trees = 10000, interaction.depth = 3, n.minobsinnode = 10, shrinkage = 0.001, cv.folds = 10, n.cores = 6)
  13. ML.Dev.Prog.Sig(train_data = trainlist$train, list_train_vali_Data = trainlist, unicox.filter.for.candi = T, unicox_p_cutoff = 0.05, candidate_genes = genelist, mode = "all", nodesize = 5, seed = 123)
l-magnificence commented 1 month ago

Hi, I think this error may be due to the multiple cores used in gbm, Please reinstall and retry using following code to see if it can run

res= ML.Dev.Prog.Sig(train_data = list_train_vali_Data$Dataset1,
                     list_train_vali_Data = list_train_vali_Data,
                     unicox.filter.for.candi = T,
                     unicox_p_cutoff = 0.05,
                     candidate_genes = genelist,
                     mode = 'single',
                     single_ml = "GBM",
                     nodesize =5,seed = 5201314,
                     cores_for_parallel=1)
yandouwahhh commented 1 month ago

Thank for your reply.However, the 'ML.Dev.Prog.Sig' function has no 'cores_for_parallel' parameters. And after I reinstalled the gbm package, I still got the same error.

---the number of the raw candidate genes is 35 --- ---the number of the common feature is 35 --- --- Data preprocessing --- [1] "Starting the data preprocess" [1] "Rejecting a null value" [1] "Gets the intersection of genelist and expression profile" [1] "Processing the input representation matrix" [1] "Data preprocessing completed" [1] "Stating the univariable cox regression" 6% 11% 17% 23% 29% 34% 40% 46% 51% 57% 63% 69% 74% 80% 86% 91% 97% [1] "Finished the univariable cox regression" ---the number of the final unicox filtered candidate genes is 6 --- [1] "CAPS" "BTBD16" "EFNA3" "VWA1" "WFDC10A" "AC117386.2" --- Start GBM --- terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append Error in unserialize(node$con) : error reading from connection terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append

l-magnificence commented 1 month ago

Thank for your reply.However, the 'ML.Dev.Prog.Sig' function has no 'cores_for_parallel' parameters. And after I reinstalled the gbm package, I still got the same error.

---the number of the raw candidate genes is 35 --- ---the number of the common feature is 35 --- --- Data preprocessing --- [1] "Starting the data preprocess" [1] "Rejecting a null value" [1] "Gets the intersection of genelist and expression profile" [1] "Processing the input representation matrix" [1] "Data preprocessing completed" [1] "Stating the univariable cox regression" 6% 11% 17% 23% 29% 34% 40% 46% 51% 57% 63% 69% 74% 80% 86% 91% 97% [1] "Finished the univariable cox regression" ---the number of the final unicox filtered candidate genes is 6 --- [1] "CAPS" "BTBD16" "EFNA3" "VWA1" "WFDC10A" "AC117386.2" --- Start GBM --- terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append Error in unserialize(node$con) : error reading from connection terminate called after throwing an instance of 'std::length_error' what(): vector::_M_default_append

Please reinstall Mime not gbm and we have add parameter "cores_for_parallel" before.