plot.dt.madlib {PivotalR} | R Documentation |
This is a visualization function which plots the result of madlib.rpart
. This
function internally calls R's plot.rpart
function.
## S3 method for class 'dt.madlib' plot(x, uniform = FALSE, branch = 1, compress = FALSE, nspace, margin = 0, minbranch = 0.3, ...)
x |
The fitted tree from the result of |
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 |
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. |
The coordinates of the nodes are returned as a list, with components x and y.
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
[1] Documentation of decision tree in MADlib 1.6, http://doc.madlib.net/latest/
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.
## 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)