summary_dt {lazy.tree}R Documentation

Calculate Summary Statistics of a Decision Tree

Description

This function calculates various fit statistics given the class DecTree object with or without a new regressor matrix.
Japanese help file: summary_dt_JPH

Usage

summary_dt(
  obj,
  y,
  X = NULL,
  yhat = NULL,
  prob = NULL,
  minp = 1e-04,
  nleaf = 0,
  print = 1,
  outpred = 0,
  title = ""
)

Arguments

obj

The output of DecTree or list of nodes.

y

The criterion

X

The NEW regressor matrix

yhat

predicted value

prob

probability of predicted value

minp

Minimum value of probability

nleaf

# of leaves when obj is not a class DecTree object

print

= 0 to suppress the output

outpred

= 1 to output the predicted values

title

The title string

Details

A set of summary statistics will be calculated using a dataset (y,X). When X is not given, the predicted values of y in obj will be used to calculate the statistics using y. Since y is not included in obj, y must always be given. When X and y are given, the predicted values will be calculated using predict_dt.

When yhat is present, (y,yhat) will be used to calculate summary statistics.

Value

A list of the following:

When \code{y} is categorical
nleaf:  # of leaves
Tab:       cross table: (row=true, col=predicted)
margin :   marginal frequencies
Gini: gini coefficient
mllh: minus log multinomial likelihood
nparam: # of parameters
aic: aic
bic: bic
tprecision: total precision
macroF1: macro F1
weightedF1: # of obs. weighted F1
SCT: a matrix of accuracy, precision, recall, specificity, and F1-score
for each levels of the criterion.

When \code{y} is not categorical
nleaf:  # of leaves
corr:      correlation coefficient

When outpred=1, yhat, prob, Node will be output.

Examples

Xc <- as.data.frame(cbind(square$c1,square$c2))
res1 <- DecTree( square$Class4, Xc, maxdepth=3, print=1 )
# temp and temp2 should be the same since Xc is not a new regressor matrix.
# No X is given.
temp <- summary_dt( res1, square$Class4, title="square" )
# The same X as contained in obj is given.
temp2 <- summary_dt( res1, square$Class4, Xc, title="square" )
# from y and yhat, no prob
temp22 <- summary_dt( yhat=res1$yhat, y=square$Class4)
# new X is given.
temp3 <- summary_dt( res1, square$Class4[1:10], Xc[1:10,], title="square" )


[Package lazy.tree version 0.1.5 ]