Skip to content
steverozenPublic
forked from nicolaroberts/hdp

About

R pkg for Hierarchical Dirichlet Process

Resources

Stars

1 star

Watchers

1 watching

Forks

 
 

Repository files navigation

hdpx

R pkg for hierarchical Dirichlet process mixture modeling

This package in only supported on Linux systems. To install, first ensure that the remotes package is installed and the BioConductor repositories are available (run setRepositories() and choose the BioC items). It might take a few minutes to download any missing dependencies.

To instal the latest version that fixes the compile-time problem with the previous Rcpp Free function (problem compiling hdpx.so) and the problem that generated Error in lower.to.upper.tri.inds(n) : 'n' must be >= 2 use:

remotes::install_github(repo = "steverozen/hdpx", ref="v1.0.6-branch")

This has not been extensively tested yet.

To install the latest stable version:

remotes::install_github(repo = "steverozen/hdpx")

If you want to install from the .tar.gz, you can get it here: https://github.com/steverozen/hdpx/raw/refs/heads/v1.0.6-branch/inst/hdpx_1.0.6.tar.gz, then

install.packages("hdpx_1.0.6.tar.gz", repos = NULL, type = "source")

To test the installed package:

library(hdpx)
hdp_init(ppindex=0, cpindex=1, hh=rep(1, 6), alphaa=rep(1, 3), alphab=rep(2, 3))

If you want to use this package for mutational signature discovery, you probably want to start with https://github.com/steverozen/mSigHdp, which calls this package.

Model categorical count data with a hierarchical Dirichlet process mixture models. Includes functions to initialize a HDP with a custom tree structure, perform Gibbs sampling of the posterior distribution, and analyse the output. The underlying mathematical theory is described by Teh et al. "Hierarchical Dirichlet Processes", Journal of the American Statistical Association 2006;101(476):1566-1581 (https://doi.org/10.1198/016214506000000302).

This R package is based on code forked from Nicola Roberts, https://github.com/nicolaroberts/hdp. Roberts adapted the R code from Teh and colleagues' open source MATLAB code and incorporated Teh's C code, as does this package (please see details below). Robert's thesis is at https://www.repository.cam.ac.uk/bitstream/handle/1810/275454/Roberts-2018-PhD.pdf.

Subsequent changes by Rozen and Liu are confined to the R code. These include

  1. Corrections to garbage collection in the interface to the C code

  2. A new function for computing unsigned Stirling numbers of the first kind. See functions xmake.s in xmake.s.R and function .onLoad in zzz.R.

  3. A complete re-working of the process by which "raw clusters" sampled in posterior chains are combined into "components" (sets of mutations generated by one mutational process)

  4. New functions for plotting to visualize and evaluate components extracted by the new procedures

There are also revised suggestions for burnin procedures and for setting hyperparameters for the concentration parameters; see https://github.com/steverozen/mSigHdp.


This program is free software: you can redistribute it and/or 
modify it under the terms of the GNU General Public License version 3 
as published by the Free Software Foundation. 

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
General Public License for more details <http://www.gnu.org/licenses/>. 

Copyright statement on original MATLAB and C code written by Yee Whye Teh, downloaded from http://www.stats.ox.ac.uk/~teh/research/npbayes/npbayes-r21.tgz

(C) Copyright 2004, Yee Whye Teh (ywteh -at- eecs -dot- berkeley -dot- edu)
http://www.cs.berkeley.edu/~ywteh

Permission is granted for anyone to copy, use, or modify these
programs and accompanying documents for purposes of research or
education, provided this copyright notice is retained, and note is
made of any changes that have been made.
 
These programs and documents are distributed without any warranty,
express or implied.  As the programs were written for research
purposes only, they have not been tested to the degree that would be
advisable in any important application.  All use of these programs is

About

R pkg for Hierarchical Dirichlet Process

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages