Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global and Local Explanation Functions Do Not Work With Datasets Have Any Missing Values #27

Open
aalhadab opened this issue Mar 28, 2022 · 2 comments

Comments

@aalhadab
Copy link

When a dataset has some any missing values, global and local functions don't work because the generated prediction matrix has different dimensions. This problem occurs even when na.action = "na.impute" is used.

library(mlr3verse)
#> Warning: package 'mlr3verse' was built under R version 4.1.2
#> Loading required package: mlr3
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.1.2
#> Warning: package 'ggplot2' was built under R version 4.1.2
#> Warning: package 'tibble' was built under R version 4.1.2
#> Warning: package 'tidyr' was built under R version 4.1.2
#> Warning: package 'readr' was built under R version 4.1.2
#> Warning: package 'purrr' was built under R version 4.1.2
#> Warning: package 'dplyr' was built under R version 4.1.2
#> Warning: package 'stringr' was built under R version 4.1.2
#> Warning: package 'forcats' was built under R version 4.1.2
library(randomForestSRC)
#> 
#>  randomForestSRC 3.0.2 
#>  
#>  Type rfsrc.news() to see new features, changes, and bug fixes. 
#> 
#> 
#> Attaching package: 'randomForestSRC'
#> The following object is masked from 'package:purrr':
#> 
#>     partial
#> The following object is masked from 'package:mlr3verse':
#> 
#>     tune
library(survival)
library(survxai)
#> Loading required package: prodlim
#> Warning: package 'prodlim' was built under R version 4.1.2
#> Welcome to survxai (version: 0.2.1).
#> Information about the package can be found in the GitHub repository: https://github.com/MI2DataLab/survxai
#> 
#> Attaching package: 'survxai'
#> The following object is masked from 'package:dplyr':
#> 
#>     explain

task  = tsk("actg")
task2 = tsk("lung")

os   = rfsrc(Surv(time, status)~. , task$data(), na.action = "na.impute", importance = "permute") 

os2  = rfsrc(Surv(time, status)~. , task2$data(), na.action = "na.impute", importance = "permute")

rsf_explain = explain(model = os, 
                     data  = task$data()[, -c(1:2)],
                     y     = Surv(task$data()$time, task$data()$status))

rsf_explain2= explain(model = os2, 
                     data  = task2$data()[, -c(1:2)],
                     y     = Surv(task2$data()$time, task2$data()$status))

model_performance(rsf_explain)  %>% plot()
#> No covariates  specified: Kaplan-Meier for censoring times used for weighting.

model_performance(rsf_explain2) %>% plot()
#> No covariates  specified: Kaplan-Meier for censoring times used for weighting.
#> No covariates  specified: Kaplan-Meier for censoring times used for weighting.
#> Error in predictSurvProb.rfsrc(X.model, newdata, times): 
#> Prediction matrix has wrong dimensions:
#> Requested newdata x times: 228 x 187
#> Provided prediction matrix: 167 x 187

Created on 2022-03-28 by the reprex package (v2.0.1)

@aalhadab aalhadab changed the title Global and Local Explanation Functions Do Work With Dataset With Missing Values Global and Local Explanation Functions Do Not Work With Datasets Have Any Missing Values Mar 29, 2022
@hbaniecki
Copy link
Member

Hi @aalhadab, you can check out our new updated package at https://github.com/ModelOriented/survex.

@agosiewska
Copy link
Contributor

As far as I am aware, the deprecation of the survxai package is not the official statement of the package maintainer @AleksandraDabrowska . Good manners and programming practices would require at least asking the author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants