#ff requires that the partition of the covariates be previously determined.
#ff is handy if the user wants to test out multiple settings of WGCNA
#prior to running fuzzy forests.
library(WGCNA)
library(randomForest)
library(fuzzyforest)
data(ctg)
y <- ctg$NSP
X <- ctg[, 2:22]
#set tuning parameters for WGCNA
net = blockwiseModules(X, power = 6, minModuleSize = 1, nThreads = 1)
#extract module membership for each covariate
module_membership <- net$colors
#set tuning parameters
mtry_factor <- 1; min_ntree <- 500; drop_fraction <- .5; ntree_factor <- 1
screen_params <- screen_control(drop_fraction = drop_fraction,
keep_fraction = .25, min_ntree = min_ntree,
ntree_factor = ntree_factor,
mtry_factor = mtry_factor)
select_params <- select_control(drop_fraction = drop_fraction,
number_selected = 5,
min_ntree = min_ntree,
ntree_factor = ntree_factor,
mtry_factor = mtry_factor)
#fit fuzzy forests
ff_fit <- ff(X, y, module_membership = module_membership,
screen_params = screen_params,
select_params = select_params,
final_ntree = 500)
#extract variable importance rankings
vims <- ff_fit$feature_list
#plot results
modplot(ff_fit)Run the code above in your browser using DataLab