Currently having problems with (very) imbalanced classes in a dataset that I am trying to run binary classification on. Looking at this UC Berkeley article (, I would like to try using a "Balanced Random Forest" (using h2o flow UI). From the paper:

Random forest inspired us to ensemble trees induced from balanced down-sampled data. The Balanced Random Forest (BRF) algorithm is shown below:

  1. For each iteration in random forest, draw a bootstrap sample from the minority class. Randomly draw the same number of cases, with replacement, from the majority class.
  2. Induce a classification tree from the data to maximum size, without pruning. The tree is induced with the CART algorithm, with the following modification: At each node, instead of searching through all variables for the optimal split, only search through a set of mtry randomly selected variables.
  3. Repeat the two steps above for the number of times desired. Aggregate the predictions of the ensemble and make the final prediction

My question is whether there is a way to implement such a model using the hyperparameters of the existing DRF model in h2o ( My thought is that setting the hyperparameters of the h2o DRF model as:

balance_classes = False
fold_assignment = stratified     (though I wish there were some "unbalanced classes" option)
stopping_rounds = 0              (to force max size (I don't think h2o DRFs have pruning options))
mtries = -1                      (the article did not seem to recommend any ideal "mtry" size)
sample_rate_per_class = 0.5, 0.5
binomial_double_trees = True     (just because, I don't really think it affects the BRF alg.)

would be the thing to do. For many of the other hyperparameters, I'd probably just use whatever h2o flow UI recommends as the default values.

Does this look like it would work at approximating the BRF alg. described? Should I add (or remove) any other specific hyperparameter settings? Advice would be appreciated.

** Note: I have seen the other post on SO with similar questions (, Implementing Balanced Random Forest (BRF) in R using RandomForests), but I believe this is different as it is not a package recommendation question, but rather asking about implementation in a specific framework.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.