% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unify_gpboost.R
\name{gpboost.unify}
\alias{gpboost.unify}
\title{Unify GPBoost model}
\usage{
gpboost.unify(gpb_model, data, recalculate = FALSE)
}
\arguments{
\item{gpb_model}{A gpboost model - object of class \code{gpb.Booster}}

\item{data}{Reference dataset. A \code{data.frame} or \code{matrix} with the same columns as in the training set of the model. Usually dataset used to train model.}

\item{recalculate}{logical indicating if covers should be recalculated according to the dataset given in data. Keep it \code{FALSE} if training data are used.}
}
\value{
a unified model representation - a \code{\link{model_unified.object}} object
}
\description{
Convert your GPBoost model into a standardized representation.
The returned representation is easy to be interpreted by the user and ready to be used as an argument in \code{treeshap()} function.
}
\examples{
\donttest{
if (requireNamespace("gpboost", quietly = TRUE)) {
  library(gpboost)
  param_gpb <- list(objective = "regression", max_depth = 2,
                     force_row_wise = TRUE, num_iterations = 20)
  data_fifa <- fifa20$data[!colnames(fifa20$data) \%in\%
               c('work_rate', 'value_eur', 'gk_diving', 'gk_handling',
               'gk_kicking', 'gk_reflexes', 'gk_speed', 'gk_positioning')]
  data <- na.omit(cbind(data_fifa, fifa20$target))
  sparse_data <- as.matrix(data[,-ncol(data)])
  x <- gpboost::gpb.Dataset(sparse_data, label = as.matrix(data[,ncol(data)]))
  gpb_data <- gpboost::gpb.Dataset.construct(x)
  gpb_model <- gpboost::gpboost(data = gpb_data, params = param_gpb,
                                  verbose = -1, num_threads = 1)
  unified_model <- gpboost.unify(gpb_model, sparse_data)
  shaps <- treeshap(unified_model, data[1:2, ])
  plot_contribution(shaps, obs = 1)
}}
}
\seealso{
\code{\link{gbm.unify}} for \code{\link[gbm:gbm]{GBM models}}

\code{\link{xgboost.unify}} for \code{\link[xgboost:xgboost]{XGBoost models}}

\code{\link{lightgbm.unify}} for \code{\link[lightgbm:lightgbm]{LightGBM models}}

\code{\link{ranger.unify}} for \code{\link[ranger:ranger]{ranger models}}

\code{\link{randomForest.unify}} for \code{\link[randomForest:randomForest]{randomForest models}}
}
