xspline: Builds predictive model based GLM.

Description Usage Arguments Details Value Examples

View source: R/xspline.R

Description

The method provides main functionality on building GLM models with automatic variables transformation. The transformations are based on specified single variable responses for selected black-box model. See details in vignette("xspliner").

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
xspline(object, ...)

model_surrogate_xspliner(object, ...)

## Default S3 method:
xspline(object, lhs = NULL, response = NULL,
  predictors = NULL, data = NULL, form = "additive", bare = NULL,
  env = parent.frame(), ...)

## S3 method for class 'formula'
xspline(object, model, data = NULL,
  consider = "specials", env = parent.frame(), ...)

## S3 method for class 'explainer'
xspline(object, env = parent.frame(), ...)

Arguments

object

Predictive model, formula or explainer (see DALEX) object.

...

Other arguments passed to xspline methods or build_xspliner.

lhs

Left-hand side of model formula. Can be transformed response.

response

Name of response variable of model.

predictors

Predictor values that should be used in final model.

data

Training data of model.

form

Can be 'additive' (default) or 'multiplicative'. Specifies formula form in final model.

bare

Variable names that mustn't be transformed in final model.

env

Environment in which optional variables passed into parameters are stored. variables transformation. See vignette("xspliner") for details.

model

When object is formula - predictive model. Basic model used for extracting predictors transformation.

consider

One of c("specials", "all"). If "specials", only components with xs or xf call are considered in transition.

Details

model_surrogate_xspliner is a wrapper of xspline method to assure consistency with https://github.com/ModelOriented/DrWhy tools

Value

GLM object of class 'xspliner'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# preparing blackbox model
library(randomForest)
rf_iris <- randomForest(
  Petal.Width ~  Sepal.Length + Petal.Length + Species,
  data = iris)

# formula based xspliner
xs_iris <- xspline(
  Petal.Width ~ xs(Sepal.Length) + xs(Petal.Length) + xf(Species),
  model = rf_iris)
summary(xs_iris)
plot(xs_iris, "Sepal.Length")

# passing just the model
xs_iris <- xspline(rf_iris)
summary(xs_iris)
plot(xs_iris, "Sepal.Length")

# using DALEX
library(DALEX)
xs_iris_explainer <- explain(rf_iris)
xs_iris <- xspline(rf_iris)
summary(xs_iris)
plot(xs_iris, "Sepal.Length")

krystian8207/xspliner documentation built on Oct. 6, 2019, 11:02 p.m.