Skip to contents

Predict based on the model

Usage

catboost_predict(model, pool, prediction_type = "Probability", ...)

Arguments

model

The trained model.

pool

The dataset to predict on.

prediction_type

Prediction type.

...

Additional parameters.

Value

Predicted values.

Examples

sim_data <- msaenet::msaenet.sim.binomial(
  n = 100,
  p = 10,
  rho = 0.6,
  coef = rnorm(5, mean = 0, sd = 10),
  snr = 1,
  p.train = 0.8,
  seed = 42
)

x_train <- catboost_load_pool(data = sim_data$x.tr, label = sim_data$y.tr)
x_test <- catboost_load_pool(data = sim_data$x.te, label = NULL)

fit <- catboost_train(
  x_train,
  NULL,
  params = list(
    loss_function = "Logloss",
    iterations = 100,
    depth = 3,
    logging_level = "Silent"
  )
)

catboost_predict(fit, x_test)
#>  [1] 0.6489797 0.6749884 0.3331358 0.5018237 0.7541328 0.3806107 0.2357996
#>  [8] 0.4752205 0.7186610 0.4027660 0.2351567 0.7293696 0.5726987 0.3565523
#> [15] 0.2649454 0.5513967 0.3885718 0.6271439 0.3863992 0.5583793