简体   繁体   中英

How to apply undersampling data balancing, setting a parameter?

Im using H2O library and i want to apply undersampling data balancing, setting parameter 0.8. How can i do this? I wrote this command:

from h2o.estimators.gbm import H2OGradientBoostingEstimator
cov_gbm = H2OGradientBoostingEstimator(balance_classes = True)

but balance_classes = True use a random parameter. I want to make this parameter 0.8.

I will appreciate any help. Thanks.

You need to provide one more argument: class_sampling_factors . Assuming there are 2 classes and You want to undersample the first class then use:

cov_gbm = H2OGradientBoostingEstimator(balance_classes = True, class_sampling_factors = [0.8, 1])

class_sampling_factors must be a list of floats. Each element of list determines factor of sampling per class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM