mlr3 distrcompose cdf:下标越界 [英] mlr3 distrcompose cdf: subscript out of bounds

查看:23
本文介绍了mlr3 distrcompose cdf:下标越界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用的 R 版本:3.6.3,mlr3 版本:0.4.0-9000,mlr3proba 版本:0.1.6.9000,mlr3pipelines 版本:0.1.2 和 xgboost 版本:0.90.0.2(如 Rstudio 包管理器所述)

我已经部署了以下图形管道:

imputePipe = PipeOpImputeMean$new(id = "imputemean", param_vals = list())survXGPipe = mlr_pipeops$get(学习者",lrn(surv.xgboost"))graphXG=图$new()$add_pipeop(imputePipe)$add_pipeop(po("learner", lrn("surv.kaplan")))$add_pipeop(survXGPipe)$add_pipeop(po("disrcompose"))$add_edge("imputemean","surv.kaplan")$add_edge("imputemean","surv.xgboost")$add_edge("surv.kaplan","distrcompose", dst_channel = "base")$add_edge("surv.xgboost","distrcompose", dst_channel = "pred")

不幸的是在执行以下命令时:

lrnXG = GraphLearner$new(graphXG)trainResults = glrnXG$train(trainVerTask, row_ids = trainDataInd)预测结果 = glrnXG$predict(trainVerTask, row_ids = verDataInd)

调用预测函数时返回以下错误:

cdf[i, ] 错误:下标越界

这个错误似乎是 distrcompose 函数特有的,因为我尝试仅使用 surv.xgboost、surv.kaplan 来实现简单的图形,但它没有出现.

这似乎也是数据不明确的,因为我尝试更改输入数据并且只要使用 distrcompose 就会返回相同的错误.如果您希望我提供有关此事的任何进一步信息,请告诉我,提前感谢您的时间.

请使用以下代码重现错误:

库(mlr3)库(mlr3pipelines)图书馆(mlr3proba)图书馆(mlr3learners)任务 = tgen(simsurv")$generate(1000)imputePipe = PipeOpImputeMean$new(id = "imputemean", param_vals = list())survXGPipe = mlr_pipeops$get(学习者",lrn(surv.xgboost"))graphXG=图$new()$add_pipeop(imputePipe)$add_pipeop(po("learner", lrn("surv.kaplan")))$add_pipeop(survXGPipe)$add_pipeop(po("disrcompose"))$add_edge("imputemean","surv.kaplan")$add_edge("imputemean","surv.xgboost")$add_edge("surv.kaplan","distrcompose", dst_channel = "base")$add_edge("surv.xgboost","distrcompose", dst_channel = "pred")lrnXG = GraphLearner$new(graphXG)trainResults = lrnXG$train(task, row_ids = 1:900)lrnXG$预测(任务,row_ids = 901:1000)

解决方案

这里的问题出在 distr6,请从 CRAN 安装最新版本的 distr6 (1.4.2) 和 mlr3proba (0.2.0),然后重试.

R version used: 3.6.3, mlr3 version: 0.4.0-9000, mlr3proba version: 0.1.6.9000, mlr3pipelines version: 0.1.2 and xgboost version: 0.90.0.2 (as stated on Rstudio package manager)

I have deployed the following graph pipeline:

imputePipe = PipeOpImputeMean$new(id = "imputemean", param_vals = list())
survXGPipe = mlr_pipeops$get("learner",lrn("surv.xgboost"))

graphXG= Graph$new()$
  add_pipeop(imputePipe)$
  add_pipeop(po("learner", lrn("surv.kaplan")))$
  add_pipeop(survXGPipe)$
  add_pipeop(po("distrcompose"))$
  add_edge("imputemean","surv.kaplan")$
  add_edge("imputemean","surv.xgboost")$
  add_edge("surv.kaplan","distrcompose", dst_channel = "base")$
  add_edge("surv.xgboost","distrcompose", dst_channel = "pred")

Unfortunately upon executing the following commands:

lrnXG = GraphLearner$new(graphXG)
trainResults = glrnXG$train(trainVerTask, row_ids = trainDataInd)
predictionResults = glrnXG$predict(trainVerTask, row_ids = verDataInd)

When the predict function is called the following error is returned:

Error in cdf[i, ] : subscript out of bounds

This error seems to be specific to the distrcompose function since I tried implementing simple graphs using only surv.xgboost, surv.kaplan and it does not show up.

It also seems to be data inspecific since I tried changing the input data and as long as distrcompose is used the same error is returned. Please let me know if you would like me to provide any further information concernign the matter, thank you in advance for your time.

Please use the following code to reproduce the error:

library(mlr3)
library(mlr3pipelines)
library(mlr3proba)
library(mlr3learners)
task = tgen("simsurv")$generate(1000)
imputePipe = PipeOpImputeMean$new(id = "imputemean", param_vals = list())
survXGPipe = mlr_pipeops$get("learner",lrn("surv.xgboost"))

graphXG= Graph$new()$
  add_pipeop(imputePipe)$
  add_pipeop(po("learner", lrn("surv.kaplan")))$
  add_pipeop(survXGPipe)$
  add_pipeop(po("distrcompose"))$
  add_edge("imputemean","surv.kaplan")$
  add_edge("imputemean","surv.xgboost")$
  add_edge("surv.kaplan","distrcompose", dst_channel = "base")$
  add_edge("surv.xgboost","distrcompose", dst_channel = "pred")

lrnXG = GraphLearner$new(graphXG)
trainResults = lrnXG$train(task, row_ids = 1:900)
lrnXG$predict(task, row_ids = 901:1000)

解决方案

The problem lies in distr6 here, please install the latest versions of distr6 (1.4.2) and mlr3proba (0.2.0) from CRAN and then try again.

这篇关于mlr3 distrcompose cdf:下标越界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆