Predict risk scores or transformed survival times from a fastsvm model

# S3 method for class 'fastsvm'
predict(object, newdata, ...)

Arguments

object

An object of class "fastsvm" returned by fastsvm().

newdata

A data.frame containing the covariate columns used in the original fit (same names as in object$x_cols).

...

Additional arguments passed to methods.

Value

A numeric vector of predictions:

  • If rank_ratio = 1, higher values indicate higher risk.

  • If rank_ratio < 1, values correspond to transformed survival times (lower = shorter survival, higher = longer).

Examples

if (reticulate::py_module_available("sksurv")) {
  set.seed(1)
  n <- 50
  df <- data.frame(
    time   = rexp(n, 0.1),
    status = rbinom(n, 1, 0.6),
    x1     = rnorm(n),
    x2     = rnorm(n)
  )

  fit <- fastsvm(
    data      = df,
    time_col  = "time",
    delta_col = "status",
    kernel    = "rbf"
  )

  preds <- predict(fit, df)
  head(preds)
}
#> [1]  7.095621  8.094882  9.384865  4.230931  8.591273 12.119048