topipa / iwmm Goto Github PK
View Code? Open in Web Editor NEWiwmm: an R package for adaptive importance sampling
iwmm: an R package for adaptive importance sampling
Currently loo::psis
is used to calculate the pareto-k diagnostics, but there is work to have a pareto_khat
diagnostic function in posterior. Using this instead would remove the dependency on loo
and allow for loo
to suggest iwmm
(as discussed here).
I can make a branch implementing this change and create a PR once the corresponding functions are merged into posterior
Now that we've changed over to posterior rather than loo for the psis code, we could think about submitting to CRAN so that other packages could use the iwmm functionality. Specifically I'm thinking of priorsense and potentially loo itself. I think that iwmm could be used to fix stan-dev/loo/issues/209
I'm opening this issue mainly to keep track of the tasks we would need to do to get iwmm on CRAN.
Currently tests are run regardless of cmdstan
being installed, which leads to a failure in a case it is not. The test should be instead skipped, I think.
---> Testing R-iwmm
Executing: cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-iwmm/R-iwmm/work/iwmm-b40fdc398f4d8ffe5e32aa2a8367cb3d3db6607c" && /opt/local/bin/R CMD check ./iwmm_0.0.1.tar.gz --no-manual --no-build-vignettes
* using log directory ‘/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-iwmm/R-iwmm/work/iwmm-b40fdc398f4d8ffe5e32aa2a8367cb3d3db6607c/iwmm.Rcheck’
* using R version 4.4.1 (2024-06-14)
* using platform: powerpc-apple-darwin10.0.0d2 (32-bit)
* R was compiled by
gcc-mp-13 (MacPorts gcc13 13.3.0_0+stdlib_flag) 13.3.0
GNU Fortran (MacPorts gcc13 13.3.0_0+stdlib_flag) 13.3.0
* running under: OS X Snow Leopard 10.6
* using session charset: UTF-8
* using options ‘--no-manual --no-build-vignettes’
* checking for file ‘iwmm/DESCRIPTION’ ... OK
* this is package ‘iwmm’ version ‘0.0.1’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
.lintr
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘iwmm’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking files in ‘vignettes’ ... WARNING
Files in the 'vignettes' directory but no files in 'inst/doc':
‘importance_sampling_bootstrap.Rmd’ ‘iwmm.Rmd’
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
Running ‘testthat.R’
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 58 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-moment-match-cmdstan-analytical.R:35:3'): (code run outside of `test_that()`) ──
Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
Backtrace:
▆
1. └─cmdstanr::cmdstan_model(...) at test-moment-match-cmdstan-analytical.R:35:3
2. └─cmdstanr::cmdstan_version()
3. └─cmdstanr:::stop_no_path()
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 58 ]
Error: Test failures
There's a PR to change the output of unconstrain_draws
to a draws object (stan-dev/cmdstanr/pull/886) so we can simplify the code below when that gets merged
Lines 601 to 608 in 38bdd3b
I think it would be good to have a moment_match.brmsfit
method. It should probably return a modified brmsfit
object with the draws replaced with the moment matched draws, so that further functions from brms would work (e.g. posterior_predict
, see n-kall/priorsense#18). I'm not sure where the weights would be stored though. At some stage I think brms will store the posterior in draws
format (rather than the current stanfit
object), so that would help, but that will likely only happen in the next major release.
I think it would be a good idea to have an option to just return the transformation computed by moment_match
.
This would make it more memory efficient when doing many moment matches (e.g. for loo-cv, or power-scaling).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.