cuttree_dt {lazy.tree}R Documentation

Cut a Tree

Description

This function cuts a tree at the specified depth.
Japanese help file: cuttree_dt_JPH

Usage

cuttree_dt(
  obj,
  depth,
  y = NULL,
  nofimport = 0,
  nosummary = 0,
  print = 0,
  plot = 0,
  title = ""
)

Arguments

obj

A class DecTree object.

depth

The depth of the tree at which the tree is cut.

y

The criterion variable vector.

nofimport

= 1 not to calculate feature importance (to seppe up)

nosummary

=1 not to calculate summary stat (to speed up)

print

= 1 to print the details.

plot

= 1 to plot the details.

title

title string

Details

When y is not given, the resulting tree will not have yhat.

Value

A DecTree object.

Examples

Xc <- data.frame(x1=as.factor(square$x1),x2=as.factor(square$x2))
res1 <- DecTree( square$Class4, Xc, minnobs=1, eps=0, method=4, print=3
                 , plot=0, maxdepth=4, title="square:" )
res2 <- DecTree( square$Class4, Xc, minnobs=1, eps=0, method=4, print=3
                 , plot=0, maxdepth=3, title="square:" )
rescut <- cuttree_dt( res1, 3, y=square$Class4, print=1 )

Print(res1$mllh, res2$mllh, rescut$mllh)
Print(res1$weightedF1, res2$weightedF1, rescut$weightedF1)
Print(res2$SCT, "/", rescut$SCT, fmt="5.3")

# statname <- c("depth","parent","Left","Right","nobs","score","ImpMeasure")
# summary <- get_valLL( rescut$node, statname, simplify=2 )
# Print(summary)
# plot tree
# library(igraph)
# plot_dt( rescut )


[Package lazy.tree version 0.1.5 ]