R 배깅

Jmnote (토론 | 기여)님의 2020년 5월 8일 (금) 23:31 판 (→‎개요)

1 개요

R bagging
R 배깅
set.seed(42) # 랜덤값 고정
df = iris
library(adabag, quietly=T)
model = bagging(Species ~ ., df, mfinal=10 )

options(echo=T)
# 모델 정보
model$importance

# 시각화
par(mai=c(.5,.5,.5,.5), cex=0.8)
plot(model$trees[[10]])
text(model$trees[[10]])

# 자가 테스트
pred = predict(model, df)
# 분류표
table(pred$class, df$Species)
# 정분류율
sum(pred$class==df$Species)/nrow(df)

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}