Changelog
Source:NEWS.md
glmtree 0.4.0
CRAN release: 2026-10-11
This release re-submits the package to CRAN, from which it was archived on 2025-10-03: the vignette called library(FactoMineR) unconditionally while FactoMineR is only suggested, and the build failed on a check flavor where it was not installed. The vignette is rewritten and the optional chunk is only evaluated when FactoMineR is available.
Bug fixes
-
testandvalidationnow do what the documentation says. Until now the held out sets were drawn but never used: all regressions, trees and criteria were computed on all the observations. The training set is now the only data used to fit;validationselects the iteration;testis used only to report the performance of the best tree (performance$performance). - The validation versions of the criteria were broken in version 0.3.1:
criterion = "aic"withvalidation = TRUEfailed with “factor x1 has new levels”, the BIC returned-Inf, and the Gini mixed the labels of all validation observations with the predictions of one segment. All are now computed correctly (log-likelihood or Gini on the held out set). - The BIC penalty of a segment used
log(n)of the whole data set because of an operator precedence error; it now uses the size of the segment, as intended. - With fewer than 50 iterations the “best” tree was always the one of iteration 2, drawn from a random segmentation, and
iterations = 1failed with “object ‘best_link’ not found”. The burn-in is now the argumentburn_in(default: the minimum of 50 and a quarter ofiterations) and a tree is always returned. - Integer columns, tibbles, matrices, character and logical columns are accepted in
x; logical and factor responses are accepted fory. Missing values are reported with an error. -
normalizedGini()is computed from ranks (2 AUC - 1): it no longer depends on the order of the observations when predictions are tied, and returnsNAif there is a single class. - The class documentation was filed under
glmdisc-class; it is nowglmtree-class.
New features
-
predict()forglmtreeobjects (probabilities, ortype = "segment"), robust to factor levels unseen in training (they get the rate of positives of their segment);show()/print(). - New arguments
burn_in,patience(stop the chain when the criterion stopped improving) andverbose(the criterion was printed at every iteration; it is now silent by default). -
best.treealso storescoefficients,labels,ratesetc. used to predict; theglmobjects ofbest.tree$glmsare named by segment. -
performance$best_iterationandparameters$sizes(training / validation / test sizes).
Changes
- The SEM loop was rewritten: one
glm.fitper segment on a design matrix built once instead ofglm()+predict()on the whole data frame for each segment and iteration, a single prediction of the tree per iteration instead of two, vectorized sampling of the segments instead ofapply(sample())over the rows. Seeinst/benchmarks/speed.Rfor the timings. - Dependencies reduced to
partykit(dplyr,magrittrandcaretare no longer needed);FactoMineRis only used in an optional vignette chunk. - Defaults as documented:
test = FALSE,validation = FALSE,criterion = "bic". -
generateData()is vectorized (same distributions, different random stream). - CI: standard
r-lib/actionsworkflows (check on Linux, macOS and Windows plus a job without the suggested packages, coverage, styler, pkgdown) replace the previous single workflow;renv, Travis and the committeddocs/were removed. - Added
inst/benchmarks/, a comparison with a logistic regression,ctree, model-based recursive partitioning and a random forest on simulated and real data.