Skip to content

Commit 4292856

Browse files
authored
Fix plotting and printing of SurvLIME for the coxph model (#73)
* Fix issue #72 * Bump version for development and update NEWS
1 parent 76993e0 commit 4292856

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: survex
22
Title: Explainable Machine Learning in Survival Analysis
3-
Version: 1.0.0
3+
Version: 1.0.0.9000
44
Authors@R:
55
c(
66
person("Mikołaj", "Spytek", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7111-2286")),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# survex (development)
2+
3+
* Fix not being able to plot or print SurvLIME results for the cph model sometimes. ([#72](https://github.com/ModelOriented/survex/issues/72))
4+
15
# survex 1.0.0
26

37
* *breaking change:* refactored the structure of `model_performance_survival` object - calculated metrics are now in a `$result` list.

R/plot_surv_lime.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ plot.surv_lime <- function(x,
3939
if (!type %in% c("coefficients", "local_importance"))
4040
stop("Type should be one of `coefficients`, `local_importance`")
4141

42-
local_importance <- as.numeric(x$result * x$variable_values)
42+
local_importance <- as.numeric(x$result) * as.numeric(x$variable_values)
4343
df <- data.frame(variable_names = names(x$variable_values),
4444
variable_values = as.numeric(x$variable_values),
4545
beta = as.numeric(x$result),

R/print.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ print.surv_feature_importance <- function(x, ...) {
3333
print.surv_lime <- function(x, ...) {
3434
res <- x$result
3535

36-
print_result <- rbind(beta = res, `X` = x$variable_values, `local importance (X*beta)` = res * x$variable_values)
36+
print_result <- rbind(beta = res, `X` = x$variable_values, `local importance (X*beta)` = res * as.numeric(x$variable_values))
3737
cat("SurvLIME for observation:\n\n")
3838
print.data.frame(x$variable_values, row.names = FALSE)
3939
cat("\n")

0 commit comments

Comments
 (0)