% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/explainability.R
\name{explain_survex}
\alias{explain_survex}
\title{Create a Time-Dependent Survex Explainer}
\usage{
explain_survex(model, data, y, times, label = NULL)
}
\arguments{
\item{model}{A fitted SuperSurv object OR a single wrapper output.}

\item{data}{Covariate data for explanation (data.frame).}

\item{y}{The survival object (\code{Surv(time, event)}).}

\item{times}{The time grid for evaluation.}

\item{label}{Optional character string to name the explainer.}
}
\value{
An explainer object of class \code{survex_explainer} created by
\code{\link[survex]{explain_survival}}, which can be passed to DALEX and survex functions for further model diagnostics and plotting.
}
\description{
Bridges a fitted SuperSurv ensemble or a single base learner to the
\code{survex} package for Time-Dependent SHAP and Model Parts.
}
\examples{
if (requireNamespace("survex", quietly = TRUE) &&
    requireNamespace("glmnet", quietly = TRUE)) {
  data("metabric", package = "SuperSurv")
  dat <- metabric[1:80, ]
  x_cols <- grep("^x", names(dat))[1:5]
  X <- dat[, x_cols, drop = FALSE]
  times <- seq(20, 120, by = 20)
  y <- survival::Surv(dat$duration, dat$event)

  fit <- SuperSurv(
    time = dat$duration,
    event = dat$event,
    X = X,
    newdata = X,
    new.times = times,
    event.library = c("surv.coxph", "surv.ridge"),
    cens.library = c("surv.coxph"),
    control = list(saveFitLibrary = TRUE)
  )

  explainer <- explain_survex(
    model = fit,
    data = X,
    y = y,
    times = times,
    label = "SuperSurv_demo"
  )

  class(explainer)
}
}
