lorax 0.3.0
active_predictors(),as.party(),extract_rules(),num_ensemble_members(), andvar_imp()now work with xgboost models that use factor predictors as categorical features (xgboost 3.0.0 and later), such as those from parsnip’s"xgboost3"engine. Previously these failed with an error from xgboost. Models fit with indicator variables are processed as before.extract_rules()for xgboost models gains an optionaldataargument. For models with categorical predictors, the levels of its factor columns are used to convert category codes to factor levels, assuming the codes areas.integer(factor) - 1L; without it, rules use the integer codes. For parsnipmodel_fitand workflowsworkflowobjects, the factor levels saved by parsnip are used automatically.
lorax 0.2.0
CRAN release: 2026-11-05
active_predictors(),as.party(),extract_rules(),num_ensemble_members(), andvar_imp()now have methods for fitted parsnipmodel_fitand workflowsworkflowobjects. These extract the engine model withextract_fit_engine()and pass other arguments to the engine’s method.num_ensemble_members()is a new generic that returns the number of trees (or boosting trials or committees) in an ensemble model.active_predictors(),as.party(),extract_rules(), andvar_imp()now have methods for catboost models (catboost.Model). Symmetric and non-symmetric trees are supported. Categorical splits, both one-hot and those based on target statistics (CTRs), are converted to sets of factor levels, including CTRs on combinations of features.as.party()andextract_rules()now support lightgbm models with categorical predictors. Category codes are mapped to factor levels using the training data, assuming the codes areas.integer(factor) - 1L.extract_rules()for lightgbm models gains an optionaldataargument for this; without it, rules use the integer codes.extract_rules()for lightgbm models now assigns left and right child nodes correctly and compares numeric thresholds as numbers rather than strings.extract_rules()methods now error when given an argument they don’t use, such as a misspelledtrees = 2, instead of silently ignoring it. This includesdatafor C5.0 models, which was accepted but never used.extract_rules()for aorsf (ObliqueForest), BART (bart), catboost, lightgbm, and xgboost models now accepts a vector of tree numbers, as the other ensemble methods do, and reads the model once instead of once per tree. Rules for each tree are also built in a single pass, which makes these methods andextract_rules()for rpart and grf models much faster.extract_rules()is much faster for ranger, randomForest, C5.0, grf, cforest, and partykit models. Rules are now collected in a single pass over the tree instead of searching for each node’s parent, and the ranger and randomForest methods no longer compute fitted node ids for the training data.extract_rules()methods gain anadd_statisticsargument that appends the columnsnum_rule_termsandnum_rule_predictors.active_predictors(),as.party(),extract_rules(), andnum_ensemble_members()now have methods for bagged trees from the baguette package (bagger, fromparsnip::bag_tree()with the “rpart” or “C5.0” engine). Thetreeargument selects ensemble members, andas.party()needs the training data because the bootstrap samples are not saved.extract_rules()for rpart models now uses thexlevelsattribute to label categorical splits with factor levels, so it works for models that no longer have access to their training data.rect_split_to_expr()now accepts numeric vectors for the%in%operator.
