Skip to contents

The UBayFS package implements the framework proposed in the article Jenul et al. (2022), together with an interactive Shiny dashboard, which makes UBayFS applicable to R-users with different levels of expertise. UBayFS is an ensemble feature selection technique embedded in a Bayesian statistical framework. The method combines data and user knowledge, where the first is extracted via data-driven ensemble feature selection. The user can control the feature selection by assigning prior weights to features and penalizing specific feature combinations. In particular, the user can define a maximal number of selected features and must-link constraints (features must be selected together) or cannot-link constraints (features must not be selected together). Using relaxed constraints, a parameter ρ regulates the penalty shape. Hence, violation of constraints can be valid but leads to a lower target value of the feature set that is derived from the violated constraints. UBayFS can be used for common feature selection and also for block feature selection.

If you prefer Python, please check out our corresponding Python implementation.

Documentation and Structure

A documentation illustrates how UBayFS can be used for standard feature selection

UBayFS is implemented via a core S3-class ‘UBaymodel’, along with help functions. An overview of the ‘UBaymodel’ class and its main generic functions, is shown in the following diagram:

Requirements and Dependencies

  • R (>= 3.5.0)
  • GA
  • matrixStats
  • shiny
  • mRMRe
  • Rdimtools
  • DirichletReg
  • ggplot2
  • gridExtra
  • utils
  • hyper2
  • methods
  • prettydoc

In addition, some functionality of the package (in particular, the interactive Shiny interface) requires the following depedencies:

  • shinyWidgets
  • shinyalert
  • DT
  • RColorBrewer
  • shinyjs
  • shinyBS
  • testthat (>= 3.0.0)
  • rmarkdown
  • dplyr
  • plyr
  • knitr
  • rpart
  • GSelection
  • caret
  • glmnet

Implementation Details

The original paper defines the following utility function U(δ,θ) for optimization with respect to δ ∈ {0, 1}N: U(δ,θ) = δTθ − λκ(δ), for fixed λ > 0.

For practical reasons, the implementation in the UBayFS package uses a modified utility function (δ,θ) which adds an admissibility term 1 − κ(δ) rather than subtracting an inadmissibility term κ(δ) (δ,θ) = δTθ + λ(1−κ(δ)) = δTθ − λκ(δ) + λ.

Thus, the function values of U(δ,θ) and (δ,θ) deviate by a constant λ; however, the optimal feature set $$\boldsymbol{\delta}^{\star} = \underset{\boldsymbol{\delta}\in\lbrace 0,1\rbrace ^N}{\text{arg max}}~ U(\boldsymbol{\delta},\boldsymbol{\theta}) = \underset{\boldsymbol{\delta}\in\lbrace 0,1\rbrace ^N}{\text{arg max}}~ \tilde{U}(\boldsymbol{\delta},\boldsymbol{\theta})$$ remains unaffected.


The development version of the package can be installed with:

remotes::install_github("annajenul/UBayFS", build_manual = TRUE, build_vignettes = TRUE)

If you use a macOS operator system, make sure you have XQuartz installed.

To build the vignettes, Pandoc is required. It may happen that Pandoc is missing on your computer, or that the version is too old. Then the installation will return the error

Pandoc is required to build R Markdown vignettes but not available. Please make sure it is installed.

An installation guide for Pandoc on different operation systems is provided here.


Your contribution to UBayFS is very welcome!

Contribution to the package requires the agreement of the Contributor Code of Conduct terms.

For the implementation of a new feature or bug-fixing, we encourage you to send a Pull Request to the repository. Please add a detailed and concise description of the invented feature or the bug. In case of fixing a bug, include comments about your solution. To improve UBayFS even more, feel free to send us issues with bugs, you are not sure about. We are thankful for any kind of constructive criticism and suggestions.


If you use UBayFS in a report or scientific publication, we would appreciate citations to the following papers:


Jenul, A. and Schrunner, S., (2023). UBayFS: An R Package for User Guided Feature Selection. Journal of Open Source Software, 8(81), 4848,

Bibtex entry:

  doi = {10.21105/joss.04848},
  url = {},
  year = {2023},
  month = jan,
  publisher = {The Open Journal},
  volume = {8},
  number = {81},
  pages = {4848},
  author = {Anna Jenul and Stefan Schrunner},
  title = {{UBayFS}: An R Package for User Guided Feature
  journal = {Journal of Open Source Software}

Jenul, A., Schrunner, S. et al. A user-guided Bayesian framework for ensemble feature selection in life science applications (UBayFS). Mach Learn (2022).

Bibtex entry:

  doi = {10.1007/s10994-022-06221-9},
  url = {},
  year = {2022},
  month = aug,
  publisher = {Springer Science and Business Media {LLC}},
  volume = {111},
  number = {10},
  pages = {3897--3923},
  author = {Anna Jenul and Stefan Schrunner and J\"{u}rgen Pilz and Oliver Tomic},
  title = {A user-guided Bayesian framework for ensemble feature selection in life science applications ({UBayFS})},
  journal = {Machine Learning}