Package: bnpy
bnpy: Bayesian nonparametric machine learning for python.AboutProject Website (Read the Docs)Example GalleryQuick StartInstallationTeamAcademic ReferencesNIPS 2015: HDP-HMM paperAISTATS 2015: HDP topic modelsNIPS 2013: DP mixture modelsAboutThis python module provides code for training popular clustering models on large datasets. We focus on Bayesian nonparametric models based on the Dirichlet process, but also provide parametric counterparts.bnpysupports the latest online learning algorithms as well as standard offline methods. Our aim is to provide an inference platform that makes it easy for researchers and practitioners to compare models and algorithms.Supported probabilistic models (aka allocation models)Mixture modelsFiniteMixtureModel: fixed number of clustersDPMixtureModel: infinite number of clusters, via the Dirichlet processTopic models (aka admixtures models)FiniteTopicModel: fixed number of topics. This is Latent Dirichlet allocation.HDPTopicModel: infinite number of topics, via the hierarchical Dirichlet processHidden Markov models (HMMs)FiniteHMM: Markov sequence model with a fixture number of statesHDPHMM: Markov sequence models with an infinite number of statesSupported data observation models (aka likelihoods)Multinomial for bag-of-words dataMultGaussian for real-valued vector dataGauss: Full-covarianceDiagGauss: Diagonal-covarianceZeroMeanGauss: Zero-mean, full-covarianceAuto-regressive GaussianAutoRegGaussSupported learning algorithms:Expectation-maximizationEMFull-dataset variational BayesVBMemoized variational (can process small minibatches per update step)moVBStochastic variational (can process small minibatches per update step)soVBThese are all variants ofvariational inference, a family of optimization algorithms.Example GalleryYou can find many examples ofbnpyin action in our curatedExample Gallery.These same demos are also directly available as Python scrips inside theexamples/ folder of the project Github repository.Quick StartYou can usebnpyfrom a command line/terminal, or from within Python. Both options require specifying a dataset, an allocation model, an observation model (likelihood), and an algorithm. Optional keyword arguments with reasonable defaults allow control of specific model hyperparameters, algorithm parameters, etc.Below, we show how to call bnpy to train a 8 component Gaussian mixture model on a default toy dataset stored in a .csv file on disk. In both cases, log information is printed to stdout, and all learned model parameters are saved to disk.Calling from the terminal/command-line$ python -m bnpy.Run /path/to/my_dataset.csv FiniteMixtureModel Gauss EM --K 8 --output_path /tmp/my_dataset/results/Calling directly from Pythonimport bnpy
bnpy.run('/path/to/dataset.csv',
         'FiniteMixtureModel', 'Gauss', 'EM',
         K=8, output_path='/tmp/my_dataset/results/')Advanced examplesTrain Dirichlet-process Gaussian mixture model (DP-GMM) via full-dataset variational algorithm (aka "VB" for variational Bayes).python -m bnpy.Run /path/to/dataset.csv DPMixtureModel Gauss VB --K 8Train DP-GMM via memoized variational, with birth and merge moves, with data divided into 10 batches.python -m bnpy.Run /path/to/dataset.csv DPMixtureModel Gauss memoVB --K 8 --nBatch 10 --moves birth,mergeQuick help# print help message for required arguments
python -m bnpy.Run --help 

# print help message for specific keyword options for Gaussian mixture models
python -m bnpy.Run /path/to/dataset.csv FiniteMixtureModel Gauss EM --kwhelpInstallationTo usebnpyfor the first time, follow the documentation'sInstallation Instructions.TeamPrimary investigatorsMike HughesAssistant Professor (Aug. 2018 - present)Tufts University, Dept. of Computer ScienceWebsite: <www.michaelchughes.com>Erik Sudderth
ProfessorUniversity of California, IrvineWebsite:https://www.ics.uci.edu/~sudderth/ContributorsSoumya GhoshDae Il KimGeng JiWilliam StephensonSonia PheneGabe HopeLeah WeinerAlexis CookMert TerzihanMengrui NiJincheng LiXi Chen (Tufts)Academic ReferencesConference publications based on BNPyNIPS 2015 HDP-HMM paperOur NIPS 2015 paper describes inference algorithms that can add or remove clusters for the sticky HDP-HMM."Scalable adaptation of state complexity for nonparametric hidden Markov models." Michael C. Hughes, William Stephenson, and Erik B. Sudderth. NIPS 2015.[paper][supplement][scripts to reproduce experiments]AISTATS 2015 HDP topic model paperOur AISTATS 2015 paper describes our algorithms for HDP topic models."Reliable and scalable variational inference for the hierarchical Dirichlet process." Michael C. Hughes, Dae Il Kim, and Erik B. Sudderth. AISTATS 2015.[paper][supplement][bibtex]NIPS 2013 DP mixtures paperOur NIPS 2013 paper introduced memoized variational inference algorithm, and applied it to Dirichlet process mixture models."Memoized online variational inference for Dirichlet process mixture models." Michael C. Hughes and Erik B. Sudderth. NIPS 2013.[paper][supplement][bibtex]Workshop papersOur short paper from a workshop at NIPS 2014 describes the vision forbnpyas a general purpose inference engine."bnpy: Reliable and scalable variational inference for Bayesian nonparametric models."
Michael C. Hughes and Erik B. Sudderth. Probabilistic Programming Workshop at NIPS 2014.[paper]Target AudiencePrimarly, we intendbnpyto be a platform for researchers.
By gathering many learning algorithms and popular models in one convenient, modular repository, we hope to make it easier to compare and contrast approaches. We also hope that the modular organization ofbnpyenables researchers to try out new modeling ideas without reinventing the wheel.