Learn R Programming

PivotalR (version 0.1.18.5)

text.dt.madlib: Add labels onto the figure generated by plot.dt.madlib

Description

This is a function which adds labels to the plot generated by plot.dt.madlib.

Usage

# S3 method for dt.madlib
text(x, splits = TRUE, label, FUN = text, all = FALSE,
    pretty = NULL, digits = getOption("digits") - 3L, use.n = FALSE, fancy
    = FALSE, fwidth = 0.8, fheight = 0.8, bg = par("bg"), minlength = 1L, ...)

Arguments

x

The fitted tree from the result of madlib.rpart

splits

A boolean, if TRUE, labels the splits with the criterion for the split.

label

This is currently ignored.

FUN

The name of a labeling function, e.g. text

all

A boolean, if TRUE, labels all the nodes, otherwise just the terminal nodes.

pretty

An alternative to the minlength argument.

digits

Number of significant digits to include in numeric labels.

use.n

A boolean, if TRUE, adds to label (\#events level1/ \#events level2/etc. for classification and n for regression)

fancy

A boolean, if TRUE, represents internal nodes by ellipses and leaves by rectangles.

fwidth

Controls the width of the ellipses and rectangles if fancy=TRUE.

fheight

Controls the height of the ellipses and rectangles if fancy=TRUE.

bg

The color used to paint the background if fancy=TRUE.

minlength

The length to use for factor labels.

Other graphical parameters to be supplied as input to this function (see par).

References

[1] Documentation of decision tree in MADlib 1.6, https://madlib.apache.org/docs/latest/

See Also

madlib.rpart is the wrapper for MADlib's tree_train function for decision trees. plot.dt.madlib, print.dt.madlib are visualization functions for a model fitted through madlib.rpart

predict.dt.madlib is a wrapper for MADlib's predict function for decision trees.

madlib.lm, madlib.glm, madlib.summary, madlib.arima, madlib.elnet are all MADlib wrapper functions.

Examples

Run this code
# NOT RUN {
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

x <- as.db.data.frame(abalone, conn.id = cid, verbose = FALSE)

key(x) <- "id"
fit <- madlib.rpart(rings < 10 ~ length + diameter + height + whole + shell,
       data=x, parms = list(split='gini'), control = list(cp=0.005))

plot(fit, uniform=TRUE)
text(fit, use.n=TRUE, all=TRUE)

db.disconnect(cid)
# }

Run the code above in your browser using DataLab