ciu | R Documentation |
ciu
object.Sets up a ciu
object with the given parameters. This is not the same as
a CIU
object as returned by the function ciu.new! a ciu
object is a
list with all the parameter values needed for Contextual Importance and
Utility calculations, whereas a CIU
object only exposes a set of methods
that can be called using the $
operator. CIU
provides the method
$as.ciu
for retrieving a ciu
object from a CIU
object.
ciu( model, formula = NULL, data = NULL, in.min.max.limits = NULL, abs.min.max = NULL, input.names = NULL, output.names = NULL, predict.function = NULL, vocabulary = NULL )
model |
Model/"black-box" object (same parameter as |
formula |
Formula that describes input versus output values. Only to
be used together with |
data |
The training data used for training the model. If this parameter
is provided, a |
in.min.max.limits |
matrix with one row per output and two columns, where the first column indicates the minimal value and the second column the maximal value for that input. |
abs.min.max |
data.frame or matrix of min-max values of outputs, one row per output, two columns (min, max). |
input.names |
labels of inputs. |
output.names |
labels of outputs. |
predict.function |
can be supplied if a model that is not supported by ciu should be used. As an example, this is the function for lda: o.predict.function <- function(model, inputs) { pred <- predict(model,inputs) return(pred$posterior) } |
vocabulary |
list of labels/concepts to be used when producing
explanations and what combination of inputs they correspond to. Example of
two intermediate concepts and a higher-level one that combines them:
|
ciu
object.
Kary Främling
ciu.new
# Explaining the classification of an Iris instance with lda model. # We use a versicolor (instance 100). library(MASS) test.ind <- 100 iris_test <- iris[test.ind, 1:4] iris_train <- iris[-test.ind, 1:4] iris_lab <- iris[[5]][-test.ind] model <- lda(iris_train, iris_lab) # Create CIU object ciu <- ciu(model, Species~., iris) # This can be used with explain method for getting CIU values # of one or several inputs. Here we get CIU for all three outputs # with input feature "Petal.Length" that happens to be the most important. ciu.explain(ciu, iris_test, 1) # It is, however, more convenient to use one of the graphical visualizations. # Here's one using ggplot. ciu.ggplot.col(ciu, iris_test)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.