AI1 [R]xgboost 코드 (iris) library(xgboost) data(iris) # Convert the Species factor to an integer class starting at 0 # This is picky, but it's a requirement for XGBoost species = iris$Species label = as.integer(iris$Species)-1 iris$Species = NULL n = nrow(iris) train.index = sample(n,floor(0.75*n)) train.data = as.matrix(iris[train.index,]) train.label = label[train.index] test.data = as.matrix(iris[-train.index,]) test... 2020. 6. 18. 이전 1 다음