% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tree_explainer.R
\name{loss}
\alias{loss}
\title{Alias for qshap_loss}
\usage{
loss(explainer, x, y, y_mean_ori = NULL)
}
\arguments{
\item{explainer}{A qshap_tree_explainer object created by \code{gazer()}}

\item{x}{Feature matrix or data frame}

\item{y}{Response vector}

\item{y_mean_ori}{Optional pre-computed mean of y (for efficiency)}
}
\value{
A matrix of loss contributions with dimensions (n_samples, n_features)
}
\description{
This is a convenience alias for \code{qshap_loss()} that provides a shorter
function name for calculating feature-specific loss contributions.
}
\examples{
library(xgboost)
set.seed(42)
n <- 100
p <- 100
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
y <- X[, 1] - X[, 2] + rnorm(n, sd = 0.2)
model <- xgboost(X, y, nrounds = 15, max_depth = 2, verbose = 0)
explainer <- gazer(model)
loss_matrix <- loss(explainer, X, y)
dim(loss_matrix)

}
\seealso{
\code{\link{qshap_loss}}
}
