node_info_dt_JPH {lazy.tree}R Documentation

ノードの定義の表示

Description

指定されたノードがどのような規則で生成されているかを表示する.
English help file: node_info_dt

Usage

node_info_dt( obj, depth=1, node=NULL
    , title="", simplify=1, print=1 )

Arguments

obj

DecTree DecTree クラスのオブジェクト

depth

深度の指定

node

ノード番号の指定 (depth の指定よりこちらが優先する。)

nohist

= 1 の場合は NodeInfo のみを出力する.

simplify

= 0 結果の単純化をしない場合に指定する.
(結果が何かおかしいと思われる場合に指定されたし.)

title

タイトル文字列

print

= 1 print_leaf_dt と同様の結果のみを印刷
= 2 終端ノードの定義を印刷する

debug

= 1 中間結果の出力

Value

以下のものからなるリスト

NodeInfo 終端ノードの情報のデータフレーム

Node ノードの番号 (\code{DecTree} の出力に対応している。)
PA   終端ノードの親ノードの番号
N    終端ノードに含まれる個体数
Score ノードに含まれる個体数で重みづけた不純度の指標名
ImpMeasure Score を個体数で割ったもの
Splitting ノードの分割に使われた変数番号
LR  ノードが左ノードであれば "L"、右ノードであれば "R"
Leaf 終端ノードか否か
Yhat 予測値
Prob 各カテゴリの予測値

NodeHist 各終端ノードの作成過程を示すリスト

Depth  深度
Parent 深度ごとの親ノードの番号
J      親ノードの分割に使われた説明変数の番号
Jn     親ノードの分割に使われた説明変数の名称
Ncx    親ノードの分割に使われた説明変数のカテゴリ数 or 0
TH     親ノードの分割に使われた数値的説明変数の閾値の値
LR     = "L" 親ノードが Left に分類された場合
SW     = 1 Left と Right が交換された場合
Valxj._v_1, Valxj._v_2, ...  ノードを構成するカテゴリカルな説明変数の値

NodeDef 各終端ノードの定義からなるリストで Cnum は 数値的説明変数の範囲を Ccat はカテゴリカルな変数の範囲を示す。

# @keywords internal

Examples

# categorical y, continuous X1 and categorical X2
SQ2 <- matrix(square$class4, 4,, byrow=1)
heatmap( SQ2, Rowv=NA, Colv=NA, reorderfun=NA, symm=1
         , col=c("darkred","darkgreen","orange","lightblue")
         , labRow=LETTERS[1:4], labCol=1:4 )
legend( "left", legend=1:4, pch=1,cex=2, pt.lwd=2, box.lwd=2
        , col=c("darkred","darkgreen","orange","lightblue") )
Xc <- data.frame(x1=square$x1,x2=square$c2)
yc <- as.factor(square$class4)

# specify plot=1 or use plot_dt if the package igraph is installed.
res0 <- DecTree( yc, Xc, maxdepth=4, method=4, print=1, impfuncname="gini"
                 , plot=0, title="square: categorical y, categorical X" )
# plot_dt(res0, col_leaf=c("darkred","darkgreen","orange","lightblue","red"))

# nodes at depth 2
temp <- node_info_dt( res0, depth=2, title="depth" )
# nodes 4, 15, and 24
temp <- node_info_dt( res0, node=c(8,19,21), title="node" )

# leaf node info of the above tree
info0 <- node_info_dt( res0, depth=99, print=2, title="num X1 and cat X2" )

res1 <- DecTree( yc, data.frame(x1=square$x1,x2=square$x2)
                 , maxdepth=4, method=4, print=1, impfuncname="gini"
                 , plot=0, title="square: numeric X1 and X2" )
# plot_dt(res1, col_leaf=c("darkred","darkgreen","orange","lightblue","red"))
info1 <- node_info_dt( res1, depth=99, print=2, title="num X1 and num X2" )

res2 <- DecTree( yc, data.frame(x1=square$c1,x2=square$c2)
                 , maxdepth=4, method=4, print=1, impfuncname="gini"
                 , plot=0, title="square: categorical X1 and X2" )
# plot_dt(res2, col_leaf=c("darkred","darkgreen","orange","lightblue","red"))
info2 <- node_info_dt( res2, depth=99, print=2, title="cat X1 and cat X2" )




[Package lazy.tree version 0.1.5 ]