# DAL ToolBox # version 1.0.777 source("https://raw.githubusercontent.com/cefet-rj-dal/daltoolbox/main/jupyter.R") #loading DAL load_library("daltoolbox") iris <- datasets::iris head(iris) table(iris$Species) #using random sampling tt <- train_test(sample_stratified("Species"), iris) # distribution of train print(table(tt$train$Species)) # distribution of test print(table(tt$test$Species)) #using stratified sampling # preparing dataset into four folds sample <- sample_stratified("Species") folds <- k_fold(sample, iris, 4) # distribution of folds tbl <- NULL for (f in folds) { tbl <- rbind(tbl, table(f$Species)) } print(tbl)