crossval_rf: Cross Validate Random Forests to get Categorical Accuracy

Description Usage Arguments Examples

View source: R/crossval_rf.R

Description

Funtion to cross-validate categorical prediction accuracy from resultant chl a. A Random forest of forests... Used to get categorical accuracy. Also returns a cross-validated accuracy of

Usage

1
crossval_rf(y, x, breaks, cat = NULL, split, n, ntree)

Arguments

y

response a vector

x

predictors a data.frame

breaks

numeric vector of cut points

cat

categories of response

split

proportion to include in training datset. test set to inverse.

n

number of iterations

Examples

1
2
3
4
5
6
7
8
data(LakeTrophicModelling)
predictors_all <- predictors_all[predictors_all!="DATE_COL"]
all_cf_dat <- data.frame(ltmData[predictors_all],LogCHLA=log10(ltmData$CHLA))
all_cf_dat <- all_cf_dat[complete.cases(all_cf_dat),]
ts_brks <- c(min(all_cf_dat$LogCHLA),log10(2),log10(7),log10(30),max(all_cf_dat$LogCHLA))
ts_cats <- c("oligo","meso","eu","hyper")
x<-crossval_rf(all_cf_dat$LogCHLA,all_cf_dat[,names(all_cf_dat)!="LogCHLA"],
            ts_brks,ts_cats,0.8,1000,1000)

USEPA/LakeTrophicModelling documentation built on Oct. 15, 2020, 4:13 p.m.