https://github.com/cran/live
Raw File
Tip revision: 8aed1f23c19d367e5b7d23427a5b7a167af51d2e authored by Mateusz Staniak on 15 January 2020, 05:30:17 UTC
version 1.5.13
Tip revision: 8aed1f2
local_permutation_importance.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/local_perimp.R
\name{local_permutation_importance}
\alias{local_permutation_importance}
\title{Local permutation variable importance}
\usage{
local_permutation_importance(
  explained_instance,
  data,
  explained_var,
  model,
  top_n = nrow(data)
)
}
\arguments{
\item{explained_instance}{Data frame with one observation for which
prediction will be explained}

\item{data}{Data from with the same columns as explained_instance}

\item{explained_var}{Character with the names of response variable}

\item{model}{Model to be explained}

\item{top_n}{Number of observation that will be used to calculate 
local variable importance}
}
\value{
list of class "local_permutation_importance" that consists of
\item{residuals}{Data frame with names of variables in the dataset ("label") and
values of drop-out loss ("dropout_loss")}
\item{weighted_local_mse}{Value of weighted MSE for the whole dataset with weights
given by 1 - Gower distance from the explained instance}
\item{explained_instance}{Explained instance as a data frame}
}
\description{
This function calculates local variable importance (variable drop-out)
by finding top_n observations closest to the explained instance,
performing permutation variable importance and using weighted mean square
error as loss function with weights equal to 1 - Gower distances of the
closest observations to the explainedi instance.
}
\examples{
\dontrun{
local_permutation_importance(wine[5, ], wine, 
                             randomForest(quality~., data = wine),
                             top_n = 1000)
}

}
back to top