wrap4Explanation: Wrap prediction model for explanations

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The function wraps given prediction model to be used with ExplainPrediction package. Currently nnet from nnet package and models of class svm from package e1071 are supported, but others can easily be added. Please, note that models from CORElearn-package can be used directly and need no wrapper. If inclusion of other models into ExplainPrediction is desired, please, contact the author.

Usage

1

Arguments

model

The model as returned by nnet or any of svm functions in e1071

package.

Details

The function adds necessary components to the prediction model so that function explainVis can generate explanations and their visualizations. Currently, four components are added:

If for a given model the method predict returns the class value probabilities as matrix or in a list with component probabilities, nothing else is needed, otherwise the internal function getPredictions has to be adequately modified.

Value

The function returns unchanged model with the components described in Details.

Author(s)

Marko Robnik-Sikonja

See Also

explainVis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# use iris data set, split it randomly into a training and testing set
trainIdxs <- sample(x=nrow(iris), size=0.7*nrow(iris), replace=FALSE)
testIdxs <- c(1:nrow(iris))[-trainIdxs]
# build a nnet model with certain parameters
require(nnet)
modelNN <- nnet(Species ~ ., iris[trainIdxs,], size=20)

# use wrapper
modelNNet <- wrap4Explanation(modelNN)

# generate model explanation and visualization
# turn on history in the visualization window to see all graphs
explainVis(modelNNet, iris[trainIdxs,], iris[testIdxs,], method="EXPLAIN",visLevel="both",
           problemName="iris", fileType="none", 
           naMode="avg", explainType="WE", classValue=1, displayColor="color") 

## End(Not run)

rmarko/ExplainPrediction documentation built on May 5, 2019, 5:54 p.m.