ciu.meta.explain {ciu} | R Documentation |
ciu.meta.explain
Description
ciu.meta.explain
Usage
ciu.meta.explain(
ciu,
instance,
ind.inputs = NULL,
in.min.max.limits = NULL,
n.samples = 100,
concepts.to.explain = NULL,
target.concept = NULL,
target.ciu = NULL
)
Arguments
ciu |
|
instance |
Input values for the instance to explain. Should be a
data.frame even though a |
ind.inputs |
Indices of input features to explain (the set i in CIU formulae) |
in.min.max.limits |
data.frame or 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 output. ONLY NEEDED HERE IF not given as parameter to ciu.new or if the limits are different for this specific instance than the default ones. |
n.samples |
How many instances to generate for estimating CI and CU. For inputs of type factor, all possible combinations of input values are generated, so this parameter only influences how many instances are (at least) generated for continuous-valued inputs. |
concepts.to.explain |
List of input feature concepts to explain, as defined
by vocabulary provided as argument to ciu.new. If |
target.concept |
If provided, then calculate CIU of inputs
|
target.ciu |
|
Value
An object of class ciu.meta.result
.
Author(s)
Kary Främling
Examples
# 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.new(model, Species~., iris)
# Get ciu.meta.result. This can either be 'ciu$meta.explain(...)'
# or 'ciu.meta.explain(ciu, ...)'
ciu.meta <- ciu$meta.explain(iris_test)
# Use same result for different visualisations.
ciu$ggplot.col.ciu(ciu.meta = ciu.meta)
ciu$barplot.ciu(ind.output = 2, ciu.meta = ciu.meta)
ciu$pie.ciu(ind.output = 2, ciu.meta = ciu.meta)
## Not run:
# Same with Boston Housing data set.
library(caret)
gbm <- train(medv ~ ., Boston, method="gbm", trControl=trainControl(method="cv", number=10))
ciu <- ciu.new(gbm, medv~., Boston)
instance <- Boston[370,1:13]
ciu.meta <- ciu$meta.explain(instance)
ciu$barplot.ciu(ciu.meta = ciu.meta, sort = "CI")
ciu$pie.ciu(ciu.meta = ciu.meta)
ciu$ggplot.col.ciu(ciu.meta = ciu.meta)
## End(Not run)