- Notifications
You must be signed in to change notification settings - Fork10
R-package for Bayesian preference learning with the Mallows rank model.
License
ocbe-uio/BayesMallows
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package provides a general framework for analyzing rank andpreference data based on the Bayesian Mallows model.
To install the current release, use
install.packages("BayesMallows")To install the current development version, use
# install.packages("remotes")remotes::install_github("ocbe-uio/BayesMallows")
To get started, load the package with
library(BayesMallows)set.seed(123)
The package comes with several example datasets. The simplest onecontains 12 persons’ assessments of the weights of 20 potatoes, eitherby visual inspection (potato_visual) or by lifting the potatoes andcomparing their relative weights by hand (potato_weighing).
To fit a Bayesian Mallows model on thepotato_visual dataset using theMetropolis-Hastings algorithm first described in Vitelli et al.(2018), we do
potato_data<- setup_rank_data(potato_visual)fit<- compute_mallows(data=potato_data)
Next, we can see a diagnostic plot for the Metropolis-Hastings algorithmwithassess_convergence(). The plot below is for the scale parameter,which measures the variation between the individual rankings.
assess_convergence(fit)Setting the burnin to 500, we obtain a plot of the posteriordistribution of the scale parameter with:
burnin(fit)<-500plot(fit)
For more examples, please see ourthe introductoryvignette,and the function documentation. The use of parallel chains are describedinthisvignette.
The package also supports updating a Bayesian Mallows model usingsequential Monte Carlo, with the algorithm described in Stein(2023). For example, inorder to update the model fitted above with the potato ranks based oncomparing their relative weights by hand, we do
new_data<- setup_rank_data(rankings=potato_weighing)updated_fit<- update_mallows(model=fit,new_data=new_data)
We can go on to plot the posterior distribution of the scale parameterfor this updated model.
plot(updated_fit)Sequential Monte Carlo can typically be useful when new data arrives inbatches, as it does not require the Metropolis-Hastings algorithm to bererun. Seethisvignettefor more information.
The BayesMallows package currently implements the complete modeldescribed in Vitelli et al. (2018), which includes alarge number of distance metrics, handling of missing ranks and pairwisecomparisons, and clustering of users with similar preferences. Theextension to non-transitive pairwise comparisons by Crispino et al.(2019) is also implemented. In addition, thepartition function of the Mallows model can be estimated using theimportance sampling algorithm of Vitelli et al.(2018) and the asymptotic approximation of Mukherjee(2016). For a review of ranking models in general,see Liu, Crispino, et al. (2019). Crispino andAntoniano-Villalobos (2022) outlines howinformative priors can be used within the model.
Updating of the posterior distribution based on new data, usingsequential Monte Carlo methods, is implemented and described inaseparatevignette.The computational algorithms are described in further detail in Stein(2023).
Among the current applications, Liu, Reiner, et al.(2019) applied the Bayesian Mallows model for providingpersonalized recommendations based on clicking data, and Barrett andCrispino (2018) used the model of Crispino et al.(2019) to analyze listeners’ understanding ofmusic. Eliseussen, Fleischer, and Vitelli(2022) presented anextended model for variable selection in genome-wide transcriptomicanalyses.
Plans for future extensions of the package include implementation of avariational Bayes algorithm for approximation the posteriordistribution. The sequential Monte Carlo algorithms will also beextended to cover a larger part of the model framework, and we will addmore options for specifications of prior distributions.
Parts of the underlying C++ code can be easily parallelized. We havesupport for this throughoneAPI Threading BuildingBlocks. If you want to make useof this, build the package from source with the-ltbb argument. On anM1 Mac this can be achieved by first installing TBB throughbrew install tbb and then adding the following line to~/.R/Makevars:
CXX17=g++-13 -I/opt/homebrew/include -L/opt/homebrew/lib -ltbb
The arguments on other platforms should be similar. If TBB is notavailable, the package will fall back on sequential processing.
If using the BayesMallows package in academic work, please cite Sørensenet al. (2020), in addition to the relevantmethodological papers.
citation("BayesMallows")#> To cite package 'BayesMallows' in publications use:#>#> Sørensen Ø, Crispino M, Liu Q, Vitelli V (2020). "BayesMallows: An R#> Package for the Bayesian Mallows Model." _The R Journal_, *12*(1),#> 324-342. doi:10.32614/RJ-2020-026#> <https://doi.org/10.32614/RJ-2020-026>.#>#> A BibTeX entry for LaTeX users is#>#> @Article{,#> author = {{\O}ystein S{\o}rensen and Marta Crispino and Qinghua Liu and Valeria Vitelli},#> doi = {10.32614/RJ-2020-026},#> title = {BayesMallows: An R Package for the Bayesian Mallows Model},#> journal = {The R Journal},#> number = {1},#> pages = {324--342},#> volume = {12},#> year = {2020},#> }
This is an open source project, and all contributions are welcome. Feelfree to open anIssue, aPullRequest, or to e-mailus.
Barrett, N., and Marta Crispino. 2018. “The Impact of 3-d SoundSpatialisation on Listeners’ Understanding of Human Agency in AcousmaticMusic.”Journal of New Music Research 47 (5): 399–415.https://doi.org/10.1080/09298215.2018.1437187.
Crispino, Marta, and Isadora Antoniano-Villalobos. 2022. “InformativePriors for the Consensus Ranking in the Bayesian Mallows Model.”Bayesian Analysis, January, 1–24.https://doi.org/10.1214/22-BA1307.
Crispino, Marta, E. Arjas, V. Vitelli, N. Barrett, and A. Frigessi.2019. “A Bayesian Mallows Approach to Nontransitive Pair ComparisonData: How Human Are Sounds?”The Annals of Applied Statistics 13 (1):492–519.https://doi.org/10.1214/18-aoas1203.
Eliseussen, Emilie, Thomas Fleischer, and Valeria Vitelli. 2022.“Rank-Based Bayesian Variable Selection for Genome-Wide TranscriptomicAnalyses.”Statistics in Medicine 41 (23): 4532–53.https://doi.org/10.1002/sim.9524.
Liu, Q., Marta Crispino, I. Scheel, V. Vitelli, and A. Frigessi. 2019.“Model-Based Learning from Preference Data.”Annual Review ofStatistics and Its Application 6 (1).https://doi.org/10.1146/annurev-statistics-031017-100213.
Liu, Q., A. H. Reiner, A. Frigessi, and I. Scheel. 2019. “DiversePersonalized Recommendations with Uncertainty from Implicit PreferenceData with the Bayesian Mallows Model.”Knowledge-Based Systems 186(December): 104960.https://doi.org/10.1016/j.knosys.2019.104960.
Mukherjee, S. 2016. “Estimation in Exponential Families onPermutations.”The Annals of Statistics 44 (2): 853–75.https://doi.org/10.1214/15-aos1389.
Sørensen, Øystein, Marta Crispino, Qinghua Liu, and Valeria Vitelli.2020. “BayesMallows: An R Package for the Bayesian Mallows Model.”TheR Journal 12 (1): 324–42.https://doi.org/10.32614/RJ-2020-026.
Stein, Anja. 2023. “Sequential Inference with the Mallows Model.” PhDthesis, Lancaster University.
Vitelli, V., Ø. Sørensen, M. Crispino, E. Arjas, and A. Frigessi. 2018.“Probabilistic Preference Learning with the Mallows Rank Model.”Journal of Machine Learning Research 18 (1): 1–49.https://jmlr.org/papers/v18/15-481.html.
About
R-package for Bayesian preference learning with the Mallows rank model.
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.


