#title Sampling ==== Sampling ==== training 데이터는 30%, test 데이터를 70% {{{ library(caret) partition_idx <- createDataPartition (x$이탈여부, p=0.3)$Resample1 training <- x[partition_idx, ] test <- x[-partition_idx, ] }}} {{{ library(caret) tmp <- downSample(subset(x, select = -이탈여부), factor(dataset$이탈여부)) tmp <- upSample(subset(x, select = -이탈여부), factor(dataset$이탈여부)) }}} * downSample: 데이터가 적은 쪽에 맞춘다. 예를 들어, 생존=1000명, 이탈=100명이면 downSample은 생존=100명, 이탈=100명으로 맞춘다. * upSample: 데이터가 많은 쪽에 맞춘다.