plot.dt.madlib: Plot the result of madlib.rpart

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

View source: R/madlib-rpart.R

Description

This is a visualization function which plots the result of madlib.rpart. This function internally calls R's plot.rpart function.

Usage

1
2
3
4
5
    ## S3 method for class 'dt.madlib'
plot(x, uniform = FALSE, branch = 1, compress = FALSE,
        nspace, margin = 0, minbranch = 0.3, ...)

    

Arguments

x

The fitted tree from the result of madlib.rpart

uniform

A boolean, if TRUE, uses uniform vertical spacing of the nodes.

branch

A double value, between 0 and 1, to control the shape of the branches from parent to child.

compress

A boolean, if FALSE, the leaf nodes will be at the horizontal plot coordinate of 1:nleaves. Use TRUE for a more compact arrangement.

nspace

A double value, indicating the amount of extra space between a node with children and a leaf. default is branch

margin

A double value, indicating the amount of extra space to leave around the borders of the tree.

minbranch

A double value, specifying the minimum length for a branch.

...

Arguments to be passed to or from other methods.

Value

The coordinates of the nodes are returned as a list, with components x and y.

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io

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. text.dt.madlib, print.dt.madlib are other visualization functions.

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 


## 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)
lk(x, 10)

## decision tree using abalone data, using default values of minsplit,
## maxdepth etc.
key(x)<-"id"
fit <- madlib.rpart(rings < 10 ~ length + diameter + height + whole + shell,
       data=x, parms = list(split='gini'), control = list(cp=0.005))
fit

plot(fit, uniform =TRUE)
text(fit)

db.disconnect(cid)

## End(Not run)

PivotalR documentation built on March 13, 2021, 1:06 a.m.