Git Product home page Git Product logo

hdp's Introduction

hdp

R pkg for Hierarchical Dirichlet Process

Build Status

To install, first ensure devtools package is installed and the BioConductor repositories are available (run setRepositories()). It might take a few minutes to download any missing dependencies and build the vignettes.

devtools::install_github("nicolaroberts/hdp", build_vignettes = TRUE)

For tutorials, see browseVignettes("hdp").

Works on MacOS and Linux, but may not install on Windows.

R package to model categorical count data with a hierarchical Dirichlet Process. Includes functions to initialise a HDP of any shape, perform Gibbs sampling of the posterior distribution, and analyse the output. The underlying theory is described by Teh et al. (Hierarchical Dirichlet Processes, Journal of the American Statistical Association, 2006, 101:476). This R package was adapted from open source MATLAB and C code written by Yee Whye Teh and available here http://www.stats.ox.ac.uk/~teh/research/npbayes/npbayes-r21.tgz

Copyright (c) 2015 Genome Research Ltd. 
Author: Nicola Roberts <[email protected]> 
 
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 MATLAC 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

hdp's People

Contributors

nicolaroberts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hdp's Issues

Tutorials in web or pdf form?

Hi. I've failed to install hdp with ' build_vignettes = TRUE' on Windows. So I cannot get access to the tutorials with browseVignettes("hdp"). I dont know if there is any other versions of the tutorials.

Installation on Windows

I'm having trouble installing this package on a Windows 8 machine. The devtools::install_github("nicolaroberts/hdp", build_vignettes = TRUE) instruction produces the following error:

creating vignettes ...Warning: running command '"C:/PROGRA1/R/R-331.1/bin/x64/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 3
ERROR

I cloned the repository to try and investigate it further and found that the problem was in building the vignette, in particular the call in general.Rmd to hdp_posterior, which in turns calls a native C function.

Removing the vignette still doesn't work, as it seems to have a problem compiling the DLL. The error message output from running devtools::install from within my local repository is

** testing if installed package can be loaded
*** arch - i386
*** arch - x64
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'H:/RLibrary/hdp/libs/x64/hdp.dll':
LoadLibrary failure: %1 is not a valid Win32 application.

I'm running 64-bit R, with both the 64-bit and 32-bit gcc versions that come with Rtools in my PATH, with the 64-bit version first, I've also tried 32-bit R with 32-bit gcc first in my PATH but no combinations seem to work.

Install error on Ubuntu 22.04

Trying to install the package but didn't work :

─ installing source package ‘hdp’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-base.c -o R-base.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-conparam.c -o R-conparam.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-dp.c -o R-dp.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-hdp.c -o R-hdp.o
R-hdp.c:n function ‘hdp_randclassnt
R-hdp.c:345:17:warning: riable ‘numdp but not used [-Wunused-but-set-variable
345 | int numclass, numdp
| ^~~~~
R-hdp.c:344:13:warning: riable ‘conparam but not used [-Wunused-but-set-variable
344 | CONPARAM *conparam
| ^~~~~~~~
R-hdp.c:n function ‘hdp_randdatacc
R-hdp.c:415:18:warning: riable ‘classnt but not used [-Wunused-but-set-variable
415 | int *classnd, *classnt
| ^~~~~~~
R-hdp.c:413:26:warning: riable ‘numdp but not used [-Wunused-but-set-variable
413 | int numclass, *datacc, numdpdata, pp;
| ^~~~~
R-hdp.c:n function ‘hdp_iterate
R-hdp.c:482:7:warning: riable ‘alldp but not used [-Wunused-but-set-variable
482 | DP *alldp
| ^~~~~
R-hdp.c:n function ‘hdp_dpholdout
R-hdp.c:588:39:warning: riable ‘classnd but not used [-Wunused-but-set-variable
588 | int numclass, numdata, pp, cp, tt, *classndassnt, *pclassnd, *datacc,
| ^~~~~~~
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-hdpMultinomial_iterate.c -o R-hdpMultinomial_iterate.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-multinomial.c -o R-multinomial.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c R-utils.c -o R-utils.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-aeZVAy/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -pedantic -fdiagnostics-color=always -c randutils.c -o randutils.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o hdp.so R-base.o R-conparam.o R-dp.o R-hdp.o R-hdpMultinomial_iterate.o R-multinomial.o R-utils.o randutils.o -L/usr/lib/R/lib -lR
/usr/bin/ld: R-conparam.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here /usr/bin/ld: R-dp.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here
/usr/bin/ld: R-hdp.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here /usr/bin/ld: R-hdpMultinomial_iterate.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here
/usr/bin/ld: R-multinomial.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here /usr/bin/ld: R-utils.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here
/usr/bin/ld: randutils.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: multiple definition of `DEBUG'; R-base.o:/tmp/RtmpUo1Kwk/Rbuild20e8421a45da01/hdp/src/R-utils.h:20: first defined here
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: hdp.so] Error 1
ERROR: compilation failed for package ‘hdp’
─ removing ‘/tmp/RtmpUo1Kwk/Rinst20e8427c45b4a0/hdp’
-----------------------------------
ERROR: package installation failed
Error: Failed to install 'hdp' from GitHub:
! System command 'R' failed

Compilation failed: "ld: 7 duplicate symbols for architecture x86_64"

I am using R 4.2.2, on x86_64-apple-darwin17.0 (64-bit). Tried installing hdp but got an error similar to the issue mentioned here: https://stackoverflow.com/questions/62077330/ld-error-when-installing-hdp-package-in-r

Thanks in advance for any help!

log:

> devtools::install_github("nicolaroberts/hdp", build_vignettes = TRUE)
Downloading GitHub repo nicolaroberts/hdp@HEAD
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/l9/hht5tb6n65b1471sycxbs7w00000gn/T/Rtmpqp7GHF/remotes5ac53e47d675/nicolaroberts-hdp-c78989b/DESCRIPTION’ ...
─  preparing ‘hdp’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to build vignettes
         -----------------------------------
─  installing *source* package ‘hdp’ ...
   ** using staged installation
   ** libs
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-base.c -o R-base.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-conparam.c -o R-conparam.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-dp.c -o R-dp.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-hdp.c -o R-hdp.o
   R-hdp.c:n function ‘hdp_randclassnt
   R-hdp.c:345:17:warning: riable ‘numdp but not used [-Wunused-but-set-variable
     345 |   int numclass, numdp
         |                 ^~~~~
   R-hdp.c:344:13:warning: riable ‘conparam but not used [-Wunused-but-set-variable
     344 |   CONPARAM *conparam
         |             ^~~~~~~~
   R-hdp.c:n function ‘hdp_randdatacc
   R-hdp.c:415:18:warning: riable ‘classnt but not used [-Wunused-but-set-variable
     415 |   int *classnd, *classnt
         |                  ^~~~~~~
   R-hdp.c:413:26:warning: riable ‘numdp but not used [-Wunused-but-set-variable
     413 |   int numclass, *datacc, numdpdata, pp;
         |                          ^~~~~
   R-hdp.c:n function ‘hdp_iterate
   R-hdp.c:482:7:warning: riable ‘alldp but not used [-Wunused-but-set-variable
     482 |   DP *alldp
         |       ^~~~~
   R-hdp.c:n function ‘hdp_dpholdout
   R-hdp.c:588:39:warning: riable ‘classnd but not used [-Wunused-but-set-variable
     588 |   int numclass, numdata, pp, cp, tt, *classndassnt, *pclassnd, *datacc,
         |                                       ^~~~~~~
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-hdpMultinomial_iterate.c -o R-hdpMultinomial_iterate.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-multinomial.c -o R-multinomial.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c R-utils.c -o R-utils.o
   gcc -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c randutils.c -o randutils.o
   gcc -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o hdp.so R-base.o R-conparam.o R-dp.o R-hdp.o R-hdpMultinomial_iterate.o R-multinomial.o R-utils.o randutils.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-conparam.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-dp.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-hdp.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-hdpMultinomial_iterate.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-utils.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       R-multinomial.o
   duplicate symbol '_DEBUG' in:
       R-base.o
       randutils.o
   ld: 7 duplicate symbols for architecture x86_64
   collect2: error: ld returned 1 exit status
   make: *** [hdp.so] Error 1
   ERROR: compilation failed for package ‘hdp’
─  removing ‘/private/var/folders/l9/hht5tb6n65b1471sycxbs7w00000gn/T/RtmpmJE6p4/Rinst5b79108aec89/hdp’
         -----------------------------------
   ERROR: package installation failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.