plotTensor: Visualize bivariate tensor products

View source: R/plot_tensor.R

plotTensorR Documentation

Visualize bivariate tensor products

Description

This function visualizes the contribution of a bivariate tensor product.

Usage

plotTensor(cboost, tname, npoints = 100L, nbins = 15L)

Arguments

cboost

(Compboost)
A trained Compboost object.

tname

(character(2L))
Name of the tensor base learner.

npoints

(integer(1L))
Number of grid points per numerical feature. Note: For two numerical features, the overall number of grid points is npoints^2. For a numerical and categorical feature it is npoints * ncat with ncat the number of categories. For two categorical features ncat^2 grid points are drawn.

nbins

(logical(1L))
Number of bins for the surface. Only applies in the case of two numerical features. A smooth surface is drawn if nbins = NULL.

Value

ggplot object containing the graphic.

Examples


cboost = Compboost$new(data = iris, target = "Petal.Length",
  learning_rate = 0.1)

cboost$addTensor("Sepal.Width", "Sepal.Length", df1 = 4, df2 = 4, n_knots = 10)
cboost$addTensor("Sepal.Width", "Species", df1 = 4, df2 = 2, n_knots = 10)

cboost$train(100L)

plotTensor(cboost, "Sepal.Width_Species_tensor")
plotTensor(cboost, "Sepal.Width_Sepal.Length_tensor")


schalkdaniel/compboost documentation built on April 15, 2023, 9:03 p.m.