Attempts to prepare a clean dataset to prepare to put in a lgb.Dataset. Factors and characters are converted to numeric (specifically: integer). In addition, keeps rules created so you can convert other datasets using this converter. This is useful if you have a specific need for integer dataset instead of numeric dataset. Note that there are programs which do not support integer-only input. Consider this as a half memory technique which is dangerous, especially for LightGBM.

lgb.prepare_rules2(data, rules = NULL)



A data.frame or data.table to prepare.


A set of rules from the data preparator, if already used.


A list with the cleaned dataset (data) and the rules (rules). The data must be converted to a matrix format (as.matrix) for input in lgb.Dataset.