ccs-lab / hbayesdm Goto Github PK
View Code? Open in Web Editor NEWHierarchical Bayesian modeling of RLDM tasks, using R & Python
Home Page: https://ccs-lab.github.io/hBayesDM
License: GNU General Public License v3.0
Hierarchical Bayesian modeling of RLDM tasks, using R & Python
Home Page: https://ccs-lab.github.io/hBayesDM
License: GNU General Public License v3.0
In version 2.18.0 of Stan, stan developers it possible to use multi-threads, which possibly "produce tremendous speed improvements on the right hardware." To use this feature, we should change our Stan models a little as in this tutorial page and modify the compiler configuration (which should be handled by users). However, the current version of rstan
does not support this feature yet, so we should wait for now.
It would be even easier to contribute to hBayesDM if there was a simple GUI (like Google Form or simple Javascript or Django Applet) to take user input and automatically create the JSON file for the specified model.
Also, then the Schema checking (of the JSON file) could also be done simultaneously as the contributor fills out the Form.
https://cran.r-project.org/web/packages/rstantools/vignettes/developer-guidelines.html
e.g., Use pre-compiled Stan programs so that models will run immediately.
The choiceRT_lba
model is the only (non-"single"-type) model that does not make use of Matt trick in R and Stan codes.
Currently, it’s not possible to use hBayesDM_model
to rewrite choiceRT_lba.R
, because of this fact.
choiceRT_lba.stan
should be edited to employ Matt trick.
+) Also, it should be re-written to employ a fixed number of parameters.
Currently, the R package has separate plot functions for each model. This introduces the inefficiency in needing a plot function to be implemented separately every time a new model is added, although their function bodies are largely the same.
It would be better to create a single generic plot function that works correctly with all current and future models.
Add more tests to Python/tests/
As opposed to each function having its one file, common themes should be identified and the functions should be placed into each file per the theme....
e.g. plotting functions should go into a plot.R
rile, modeling functions should go into a model.R
file, etc.
Daw, N. D., Gershman, S. J., Seymour, B., Dayan, P., & Dolan, R. J. (2011). Model-based influences on humans' choices and striatal prediction errors. Neuron, 69(6), 1204-1215.
It would be useful to include an n-armed bandit model in the package—this way, we could have different versions of bandit tasks (4par, 3par, simple RW), but we would not need separate stan files for varying numbers of choices.
Make it optional to use variational inference (e.g., rstan::vb
instead of rstan::sampling
).
e.g.,
# fit the bandit2arm_delta model with variational inference (vb=TRUE)
output_vb = bandit2arm_delta("example", 1000, 500, 2, 2, vb=TRUE)
rhat(output_vb)
** Approximated posterior sampling using variational inference, so Rhat values are unavailable. **
The model base function (now called "hBayesDM_model") requires that the parameter primes (used for Matt trick) are named with the following rule:
[parameter-name]_p
Currently, some of the Stan files do not follow this rule (and suffix their primes with a _pr
instead of _p
).
This needs to be changed before the refactoring of all models can be completed.
The model implemented in the following reference:
Models for general description-based tasks with a probability weighting function (e.g., Erev et al., 2010; Hertwig et al., 2004; Jessup et al., 2008)
I have been trying the tutorial of the package, and when using this line:
output1 = gng_m1(data="example", niter=2000, nwarmup=1000, nchain=4, ncore=4)
I get
trying deprecated constructor; please alert package maintainer
, as well as a series of
[1] "Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done
trying deprecated constructor; please alert package maintainer
The model runs in the end.
Finally, we're going to provide a Python version of hBayesDM as of version 1.0! There already exists a Python package for Stan, PyStan, so using our Stan models in Python codes won't be difficult. Though there can be unavoidable differences between R and Python codes for hBayesDM, we are going to develop it as similar as in the R version to avoid confusion.
TODOs (in release/
branch):
hBayesDM-py
repohBayesDM-models
repohBayesDM-models
repo private, and possibly archive it. (Please do not delete the repo!)hBayesDM-py
repo. (Please do not delete the repo!)pkgdown
)sphynx
)release/
branchR/docs/
(doc files generated from R) to root directoryThree new models have recently been added to hBayesDM: bandit4arm_2par_lapse
, bandit4arm_lapse_decay
, bandit4arm_singleA_lapse
.
The JSON files for these 3 new models should also be added to man-roxygen/data/
folder.
Write an auto R code generator, taking JSON file of model as input, and writing the corresponding model R file as output.
Already implemented for the python package.
loo::extract_log_lik
stacks all Markov chains on top of each other, so the chain_id
should be 1, 1, 1, 1, ..., 2, 2, 2, 2, ..., N, N, N, N. Yet the chain id is defined using rep
, which by default uses the times
argument. This leads to the result rep(1:n_chains, nrow(lik)/n_chains)
= 1, 2, ..., N, 1, 2, ..., N
The rep call should therefore be changed to rep(1:n_chains, each = nrow(lik)/n_chains)
You might also consider updating the function code since loo::extract_log_lik
implements the merge_chains
argument which allows to separate chains automatically.
I am not an expert of the loo
package, but I am afraid that this could be a serious source of miscalculation for model comparison...
I realized that when we remove cases (i.e. rows) which contain NA values before processing the raw data, we include unnecessary columns. We should change this so that only cases with NA in the columns necessary for modeling are removed.
In the R code, the identifier "sigma" is being used for the vector that holds the group parameter sigma values.
In the case of a model which has a model parameter called sigma, this will need to be adjusted.
(Although, so far no models have model parameters called sigma.)
Hierarchical Bayesian version of drift diffusion models
When ncore
is set to greater than 1 and run a model in RStudio or baseline R, users get the following messages. If users run the same code in a (Mac) terminal, it runs fine even with multiple cores being used.
e.g.,
# Install the latest hBayesDM package
if (packageVersion("devtools") < 1.6) {
install.packages("devtools")
}
devtools::install_github("CCS-Lab/hBayesDM")
library(hBayesDM) # version 0.3.0
# Run the hyperbolic delay discounting model
# with a total # MCMC samples=2000, burnin samples=1000, # of chains=4, # of cores=4
output= dd_hyperbolic("example", 2000, 1000, 4, 4)
Model name = dd_hyperbolic
Data file = /Library/Frameworks/R.framework/Versions/3.3/Resources/library/hBayesDM/extdata/dd_exampleData.txt
Details:
# of chains = 4
# of cores used = 4
# of MCMC samples (per chain) = 2000
# of burn-in samples = 1000
# of subjects = 20
# of (max) trials per subject = 108
***********************************
** Loading a precompiled model **
***********************************
starting worker pid=85478 on localhost:11782 at 15:55:48.326
starting worker pid=85486 on localhost:11782 at 15:55:48.670
starting worker pid=85494 on localhost:11782 at 15:55:49.043
starting worker pid=85502 on localhost:11782 at 15:55:49.337
This is package 'modeest' written by P. PONCET.
For a complete list of functions, use 'library(help = "modeest")' or 'help.start()'.
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
This is package 'modeest' written by P. PONCET.
For a complete list of functions, use 'library(help = "modeest")' or 'help.start()'.
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
This is package 'modeest' written by P. PONCET.
For a complete list of functions, use 'library(help = "modeest")' or 'help.start()'.
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
This is package 'modeest' written by P. PONCET.
For a complete list of functions, use 'library(help = "modeest")' or 'help.start()'.
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
Warning: namespace ‘hBayesDM’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
SAMPLING FOR MODEL 'dd_hyperbolic' NOW (CHAIN 1).
...
I found some related posts from the Stan mailing list:
https://groups.google.com/forum/#!topic/stan-users/JlYv7Rt6-zM
Thanks for these useful models. When we fit K across subjects (using various methods), we find that the distribution of K is better described by log-normal than a normal distribution.
From my reading of stan documentation, models do better if they are parameterized as unimodal gaussian.
Have you considered fitting log(k) instead of k?
The GNG task models each have two Stan files: one where regressor data is generated in the generated quantities
block and one where regressor data is not generated.
There is a need to unify this across all models.
Either all models have two separate Stan files (w/ and w/o generating regressors); or all models have one (unified) Stan file that always generates regressor data in the generated quatities
block.
Current hBayesDM package structure follows the skeleton provided by rstantools
of Jan 2017.
Since then, the Stan dev team has updated the package structure offered by rstantools
.
A quick list of changes include:
exec/
-> src/stan_files/
inst/chunks/
-> src/stan_files/chunks/
make_cpp.R
-> make_cc.R
models.hpp
-> individual files in src/stan_files/
Modules.cpp
-> individual files in src/stan_files/
Makevars{.win}
cleanup{.win}
-> removedR/stanmodels.R
R/zzz.R
hBayesDM.R
-> hBayesDM-package.R
inst/extdata/
-> data/
*.cpp
/*.cc
/*.hpp
/*.o
files in repo source, but instead builds them from scratch every time R CMD build
is executed.Updating the package structure will solve the warning message regarding:
Using deprecated constructor; please alert package manager
(To pinpoint the exact cause of this message, it comes from the constructor
argument in function call to exposeClass()
in stanmodels.R
.)
rstantools
is 1.5.1, an update to version 1.5.2 is likely to be released soon. So we will postpone the package structure update, to wait for the rstantools
update.https://discourse.mc-stan.org/t/developing-a-package-that-uses-rstan-pre-translated-c-files/6251
Branch: release/v0.7.0-update-package-structure
File (path from root) | Type of change | Done |
---|---|---|
R/zzz.R |
edit | o |
R/stanmodels.R |
edit | o |
exec/ → src/stan_files/ |
relocate | o |
inst/chunks/license.stan → src/stan_files/pre/license.stan |
relocate; edit | o |
.gitignore |
edit | o |
tools/make_cpp.R → tools/make_cc.R |
rename; edit | o |
inst/include/meta_header.hpp |
create | o |
src/Makevars |
edit | o |
src/Makevars.win |
edit | o |
cleanup |
delete | o |
cleanup.win |
delete | o |
The model implemented in the following reference:
Daw, N. D., O'Doherty, J. P., Dayan, P., Seymour, B., & Dolan, R. J. (2006). Cortical substrates for exploratory decisions in humans. Nature, 441(7095), 876-879.
As Ben Goodrich mentioned a year back, it may be worth refactoring the Stan files into smaller chunks that can be shared across multiple Stan files.
I think the main thing is that you need to consolidate your 10 Stan programs into a smaller number of Stan programs that have branch logic. The rstanarm package technically only has 6 .stan files, although you can estimate many more types of models.
It works like this:
https://github.com/stan-dev/rstanarm/blob/master/src/stan_files/count.stan
Where you use the #include
notation to include a .stan
file,
and while it behaves as an inline replacement, compilation is only done once even if this code chunk is used multiple times,
thus increasing the efficiency in the compilation process.
Although, for our package, it is true that models of different tasks do not have many overlapping lines of code to go through a major refactoring.
Thus, good places to start would be:
data
block for handling the general_infos (e.g. N
, T
, Tsubj
)gng
task models (where the next model incorporates the previous one's parameters)dd
task modelsprl
task models (where, for instance, ficticious_rp
incorporates ficticious
and rp
)gng
, prl
)generated quantities
block (which seem to contain replicas of the same lines of code that have appeared earlier in the file)Currently a lot of the Stan files make use of the following type of notation:
where a left-hand-side variable (log_lik
) occurs on the right-hand-side.
In rstan 2.18.x, this causes the translated c++ file to deep copy the object (which is obviously inefficient).
This is where the Parser warning messages (that began to occur since rstan 2.18.x) are coming from.
The devs at 'rstanarm' seem to have changed their code to use the '+=' notation in all of their Stan files, as you can see in the following picture:
Currently prl_rp
and prl_fictitious_rp
codes work as intended if the outcome
in the data file is either 0 or 1 (thanks, Marieke Jepma for pointing it out!).
Note that in the sample data for the probabilistic reversal learning (PRL) task, outcome
is either 1 or -1. So, we need to either fix the code or change the data file.
e.g.,
output = gng_m1("example", email="[email protected]")
I'm supposed to receive a notification email but don't.
I'm trying to run the drift diffusion model on the example data:
m <- choiceRT_ddm("example", niter = 2000, nwarmup = 1000, nchain = 2, ncore = 2)
This does not work and gives the following error:
> [1] "Error in sampler$call_sampler(args_list[[i]]) : "
> [2] " c++ exception (unknown reason)"
> error occurred during calling the sampler; sampling not done
All other models in hBayesDM run (on the "example" data). Occasionally one of the chains in choiceRT_lba run on the "example" data gives the same issue.
Reinstalling hBayesDM, restarting R and the computer does not help.
I am using hBayesDM 0.6, rstan 2.17.3, R 3.5.1, RStudio 1.1.456, on a Mac OS 10.13.6.
Full output of the function below
> Model name = choiceRT_ddm
> Data file = /Library/Frameworks/R.framework/Versions/3.5/Resources/library/hBayesDM/extdata/choiceRT_exampleData.txt
>
> Details:
> n of chains = 2
> n of cores used = 2
> n of MCMC samples (per chain) = 2000
> n of burn-in samples = 1000
> n of subjects = 5
> n of (max) trials of this subject = 1000
>
> ***********************************
> ** Loading a precompiled model **
> ***********************************
> trying deprecated constructor; please alert package maintainer
> starting worker pid=1573 on localhost:11760 at 15:57:42.969
> starting worker pid=1583 on localhost:11760 at 15:57:43.148
> trying deprecated constructor; please alert package maintainer
>
> SAMPLING FOR MODEL 'choiceRT_ddm' NOW (CHAIN 1).
>
> Gradient evaluation took 0.011388 seconds
> 1000 transitions using 10 leapfrog steps per transition would take 113.88 seconds.
> Adjust your expectations accordingly!
>
>
> [1] "Error in sampler$call_sampler(args_list[[i]]) : "
> [2] " c++ exception (unknown reason)"
> error occurred during calling the sampler; sampling not done
> trying deprecated constructor; please alert package maintainer
>
> SAMPLING FOR MODEL 'choiceRT_ddm' NOW (CHAIN 2).
>
> Gradient evaluation took 0.014098 seconds
> 1000 transitions using 10 leapfrog steps per transition would take 140.98 seconds.
> Adjust your expectations accordingly!
>
>
> [1] "Error in sampler$call_sampler(args_list[[i]]) : "
> [2] " c++ exception (unknown reason)"
> error occurred during calling the sampler; sampling not done
> here are whatever error messages were returned
> [[1]]
> Stan model 'choiceRT_ddm' does not contain samples.
>
> [[2]]
> Stan model 'choiceRT_ddm' does not contain samples.
>
> Stan model 'choiceRT_ddm' does not contain samples.
>
> ************************************
> **** Model fitting is complete! ****
> ************************************
> There were 21 warnings (use warnings() to see them)
Warnings are:
> Warning messages:
> 1: In .local(object, ...) :
> some chains had errors; consider specifying chains = 1 to debug
> 2: In mean.default(alpha[, i]) : argument is not numeric or logical: returning NA
> 3: In mean.default(beta[, i]) : argument is not numeric or logical: returning NA
> 4: In mean.default(delta[, i]) : argument is not numeric or logical: returning NA
> 5: In mean.default(tau[, i]) : argument is not numeric or logical: returning NA
> 6: In mean.default(alpha[, i]) : argument is not numeric or logical: returning NA
> 7: In mean.default(beta[, i]) : argument is not numeric or logical: returning NA
> 8: In mean.default(delta[, i]) : argument is not numeric or logical: returning NA
> 9: In mean.default(tau[, i]) : argument is not numeric or logical: returning NA
> 10: In mean.default(alpha[, i]) :
> argument is not numeric or logical: returning NA
> 11: In mean.default(beta[, i]) : argument is not numeric or logical: returning NA
> 12: In mean.default(delta[, i]) :
> argument is not numeric or logical: returning NA
> 13: In mean.default(tau[, i]) : argument is not numeric or logical: returning NA
> 14: In mean.default(alpha[, i]) :
> argument is not numeric or logical: returning NA
> 15: In mean.default(beta[, i]) : argument is not numeric or logical: returning NA
> 16: In mean.default(delta[, i]) :
> argument is not numeric or logical: returning NA
> 17: In mean.default(tau[, i]) : argument is not numeric or logical: returning NA
> 18: In mean.default(alpha[, i]) :
> argument is not numeric or logical: returning NA
> 19: In mean.default(beta[, i]) : argument is not numeric or logical: returning NA
> 20: In mean.default(delta[, i]) :
> argument is not numeric or logical: returning NA
> 21: In mean.default(tau[, i]) : argument is not numeric or logical: returning NA
The (two) choiceRT_lba
models are written in a different way from the rest of the models. (Hence they do not make use of hBayesDM_model
base function in R package.) Therefore, these models also cannot make use of base.py
in the Python package.
Must either refactor the choiceRT_lba
models to make use of the base function/class, or maintain these two models separately from all the other models of hBayesDM.
Currently, (while the two are included in the R package), choiceRT_lba
& choiceRT_lba_single
are not included in the Python package.
In current choiceRT_ddm_single.stan
(link),
uniform priors (for parameters alpha
, beta
, tau
) are declared like the following:
However, according to the Stan User's Manual, it's better if the variable constraints match the bounds of the prior uniform distribution.
All other Stan files in exec/
have been checked to see if uniform distribution priors match the parameters' declared constraints. (And they all do.)
Since the current version of hBayesDM has so many common codes between different functions, it seems inefficient to contains redundant codes and hard to find out which parts we should change for new models. Thus, we are going to make some subfunctions to combine the common codes on the current functions into several core subfunctions.
In the choiceRT_ddm model on line 46 of the stan code:
tau[i] = Phi_approx(mu_p[4] + sigma[4] * tau_pr[i]) * (minRT[N]-RTbound) + RTbound;
The bolded term should instead be:
tau[i] = Phi_approx(mu_p[4] + sigma[4] * tau_pr[i]) * (minRT[i]-RTbound) + RTbound;
Otherwise, tau is not being constrained by the lowest RT for each subject. This will not affect other model parameters or how well the model fits, but it should be modified to constrain tau appropriately.
A paper with working Stan codes: http://link.springer.com/article/10.3758/s13428-016-0746-9
Git Hooks allow git repositories to automatically run custom scripts before making a commit/merge/push/etc.
It would be a good idea to set up a Git Hook to check that the 'example datas' and 'stan files' are always in the same state for both R/
and Python/
subdirectories.
As a suggestion, a pre-commit
hook may be set like the following:
diff --recursive hBayesDM/R/inst/extdata/ hBayesDM/Python/hbayesdm/common/extdata
diff --recursive hBayesDM/R/inst/stan_files/ hBayesDM/Python/hbayesdm/common/stan_files
to check that the common files (example data & stan files) are the same for R/
and Python/
subdirectories, every time someone tries to make a commit.
Or possibly the git hook may be set as a pre-push
as a last resort measure to check before a push is made.
In the current hBayesDM_model
function, the stanmodel
object m
that is to be passed to rstan::sampling()
is designated automatically as:
if (FLAG_CRAN_VERSION) {
m <- rstan::stan_model(system.file("stan", paste0(model, ".stan"), package = "hBayesDM"))
} else {
m <- stanmodels[[model]]
}
As per the suggestion of @JaeyeongYang, it would be useful to make it so that it's possible to pass a user designated stanmodel
object (which is a result of rstan::stan_model()
) to the hBayesDM_model
function.
This would especially speed up the development of new models, since it would free developers from having to touch the exec/ folder, or rewrite part of the hBayesDM_model
code, or from having to clean and re-build everytime there's a change.
From some point in the history of the package, travis CI began failing the builds.
It would be best if we could figure out the root of the problem and get it to work!
I've got .travis.yml
to work correctly for both R & Python.
It would be a good idea to refactor and update the file however.
For now, the matrix consists of 3 builds: R (without BUILD_ALL)
, R (with BUILD_ALL)
, and Python
Currently, the two R builds only differ by a single ENV variable: BUILD_ALL="true"
.
Currently, the Python build uses python=3.5
.
Here are some todo`s for refactoring:
python=3.6
, and python=3.7
to the builds
pipenv --python 3.7
travis.yml
travis.yml
. I've got the Travis CI to work correctly, but I'm not sure exactly which lines are helping and which are not. Some testing and cleaning out the code is advised.travis.yml
travis.yml
is very long. It'd be better to move all the action into Makefile
's, and just call make
from travis.yml
. This is a good reference for how to do that: https://github.com/CCS-Lab/easyml/blob/master/.travis.ymlMakefile
for hbayesdm-py repo is in directory Python/
. (Although, it is currently not being called to from travis.yml.
)pipenv run flake8 adopy --format=pylint --statistics --exit-zero
pipenv run pylint adopy --rcfile=setup.cfg --exit-zero
pipenv run travis-sphinx build
pipenv run travis-sphinx deploy
travis.yml
in the first place.)Sync test
, R test
, R test (BUILD_ALL)
, Python test (3.5)
, Python test (3.6)
, Python test (3.7)
This removes mutable state from each function
In the (normal) case of StanModel.sampling()
, a StanFit4Model
obj is returned, which has a .extract()
function that can be used to extract the parameter values. (This is the usual case for running hBayesDM models, with vb=False
.)
However, when running with vb=True
, the pystan function that is used - StanModel.vb()
- returns a Dict
obj (not the StanFit4Model
obj as in the usual case of using StanModel.sampling()
).
Therefore, a different process of proper code needs to be written to handle the case for when the variational Bayesian method is requested by the user, for the Python hbayesdm
package.
(I.e. Currently, the variational Bayesian analysis functionality is not supported in the Python package.)
cra_exp
tries to extract model regressors "sv" & "p_var".
However, these variables are not defined in the Stan file.
So running cra_exp(modelRegressor = TRUE)
gives the following error.
cra_linear
also does not have modelRegressors support.
👉 Disabling modelRegressor for cra_exp
(& cra_linear
) for now.
I created this issue per request of @JaeyeongYang, as a reminder to add regressor feature to cra_exp
& cra_linear
in the near future.
It's possible to implement the extract_ic
function using ArviZ library functions:
arviz.loo()
& arviz.waic()
See here for ArviZ API.
(FYI, extract_ic
is already implemented for the R package)
niter
= 4000nwarmup
= 1000nchain
= 4ncore
= 1inits
= "random"# | model_function | json | R | doc | test | Notes |
---|---|---|---|---|---|---|
1 | ra_prospect | o | o | o | o | |
2 | igt_pvl_decay | o | o | o | o | |
3 | bandit4arm2_kalman_filter | o | o | o | o | issue resolved |
4 | dbdm_prob_weight | o | o | o | o | |
5 | bandit2arm_delta | o | o | o | o | |
6 | bandit4arm_4par | o | o | o | o | issue resolved |
7 | bandit4arm_lapse | o | o | o | o | issue resolved |
8 | bart_par4 | o | o | o | o | issue resolved |
9 | choiceRT_ddm | o | o | o | o | issue resolved |
10 | choiceRT_ddm_single | o | o | o | o | |
o | ||||||
13 | cra_exp | o | o | o | o | issue resolved |
14 | cra_linear | o | o | o | o | issue resolved |
15 | dd_cs | o | o | o | o | |
16 | dd_cs_single | o | o | o | o | |
17 | dd_exp | o | o | o | o | |
18 | dd_hyperbolic | o | o | o | o | |
19 | dd_hyperbolic_single | o | o | o | o | |
20 | gng_m1 | o | o | o | o | |
21 | gng_m2 | o | o | o | o | |
22 | gng_m3 | o | o | o | o | issue resolved |
23 | gng_m4 | o | o | o | o | |
24 | igt_orl | o | o | o | o | issue resolved |
25 | igt_pvl_delta | o | o | o | o | |
26 | igt_vpp | o | o | o | o | |
27 | peer_ocu | o | o | o | o | |
28 | prl_ewa | o | o | o | o | issue resolved |
29 | prl_fictitious | o | o | o | o | |
30 | prl_fictitious_multipleB | o | o | o | o | |
31 | prl_fictitious_rp | o | o | o | o | |
32 | prl_fictitious_rp_woa | o | o | o | o | |
33 | prl_fictitious_woa | o | o | o | o | |
34 | prl_rp | o | o | o | o | |
35 | prl_rp_multipleB | o | o | o | o | |
36 | pst_gainloss_Q | o | o | o | o | |
37 | ra_noLA | o | o | o | o | |
38 | ra_noRA | o | o | o | o | |
39 | rdt_happiness | o | o | o | o | |
40 | ts_par4 | o | o | o | o | |
41 | ts_par6 | o | o | o | o | |
42 | ts_par7 | o | o | o | o | |
43 | ug_bayes | o | o | o | o | |
44 | ug_delta | o | o | o | o | issue resolved |
45 | wcs_sql | o | o | o | o | issue resolved |
choiceRT_lba
models are not refactored because these 2 models are currently written so that total number of parameters change dynamically. This is too much a significant diversion from the current hBayesDM_model
base function.See the appropriate comment for the Note.
After handling the issue, please check-mark the box to indicate that the issue was resolved.
If the issue is not a problem and can be left as it is, just check-mark the box.
When you check-mark the box, please edit the comment to include a message about how the issue was handled.
(However, please refrain from editing this main article, so that there are no conflicts created from simultaneous edits, as I will be continuously updating this table as I progress on with the refactorization.)
On Mac and Ubuntu machines, the latest hBayesDM (v0.3.1) with precompiled models can be installed without a problem.
However, on Windows computers, even after installing Rtools, it seems hBayesDM v0.3.0 & v0.3.1 can't be installed. It's strange to me. Why only on Windows computers.
Found a relevant post. I wonder if it is related to UTF-8 coding: http://stackoverflow.com/questions/29194247/how-to-diagnose-g-error-cc1plus-exe-out-of-memory-allocating-838860800-bytes
Here is an error report - installing hBayesDM v0.3.0 from CRAN.
> install.packages("hBayesDM", dependencies = T)
Installing package into ëC:/Users/ahn.280/Documents/R/win-library/3.3í
(as ëlibí is unspecified)
also installing the dependencies ëmailí, ëmodeestí
There is a binary version available but the source version is later:
binary source needs_compilation
hBayesDM 0.2.3.3 0.3.0 FALSE
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/mail_1.0.zip'
Content type 'application/zip' length 12007 bytes (11 KB)
downloaded 11 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/modeest_2.1.zip'
Content type 'application/zip' length 246421 bytes (240 KB)
downloaded 240 KB
package ëmailí successfully unpacked and MD5 sums checked
package ëmodeestí successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\ahn.280\AppData\Local\Temp\RtmpwjIZBL\downloaded_packages
installing the source package ëhBayesDMí
trying URL 'https://cran.rstudio.com/src/contrib/hBayesDM_0.3.0.tar.gz'
Content type 'application/x-gzip' length 217072 bytes (211 KB)
downloaded 211 KB
* installing *source* package 'hBayesDM' ...
** package 'hBayesDM' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/g++ -std=c++0x -I"C:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I"`"C:/PROGRA~1/R/R-33~1.2/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -I"`"C:/PROGRA~1/R/R-33~1.2/bin/i386/Rscript" --vanilla -e "cat(system.file('include', 'boost_not_in_BH', package = 'rstan'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_NO_CXX11_RVALUE_REFERENCES -I"C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include" -I"C:/Users/ahn.280/Documents/R/win-library/3.3/rstan/include" -I"C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include" -I"C:/Users/ahn.280/Documents/R/win-library/3.3/Rcpp/include" -I"C:/Users/ahn.280/Documents/R/win-library/3.3/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c Modules.cpp -o Modules.o
In file included from C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/base.hpp:28:0,
from C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array.hpp:21,
from C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/numeric/odeint/util/multi_array_adaption.hpp:29,
from C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/numeric/odeint.hpp:61,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:13,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/stan/math/prim/arr.hpp:36,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/stan/math/prim/mat.hpp:299,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/stan/math/rev/mat.hpp:11,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
from C:/Users/ahn.280/Documents/R/win-library/3.3/StanHeaders/include/src/stan/model/test_gradients.hpp:6,
from C:/Users/ahn.280/Documents/R/win-library/3.3/rstan/include/rstan/stan_fit.hpp:18,
from C:/Users/ahn.280/Documents/R/win-library/3.3/rstan/include/rstan/rstaninc.hpp:3,
from include/models.hpp:9,
from Modules.cpp:3:
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp: In static member function 'static void boost::multi_array_concepts::detail::idgen_helper<N>::call(Array&, const IdxGen&, Call_Type)':
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp:42:43: warning: typedef 'index_range' locally defined but not used [-Wunused-local-typedefs]
typedef typename Array::index_range index_range;
^
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp:43:37: warning: typedef 'index' locally defined but not used [-Wunused-local-typedefs]
typedef typename Array::index index;
^
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp: In static member function 'static void boost::multi_array_concepts::detail::idgen_helper<0u>::call(Array&, const IdxGen&, Call_Type)':
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp:53:43: warning: typedef 'index_range' locally defined but not used [-Wunused-local-typedefs]
typedef typename Array::index_range index_range;
^
C:/Users/ahn.280/Documents/R/win-library/3.3/BH/include/boost/multi_array/concept_checks.hpp:54:37: warning: typedef 'index' locally defined but not used [-Wunused-local-typedefs]
typedef typename Array::index index;
^
cc1plus.exe: out of memory allocating 8392703 bytes
make: *** [Modules.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-33~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.2/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="hBayesDM.dll" OBJECTS="Modules.o"' had status 2
ERROR: compilation failed for package 'hBayesDM'
* removing 'C:/Users/ahn.280/Documents/R/win-library/3.3/hBayesDM'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\ahn.280\Documents\R\win-library\3.3" C:\Users\ahn.280\AppData\Local\Temp\RtmpwjIZBL/downloaded_packages/hBayesDM_0.3.0.tar.gz' had status 1
Warning in install.packages :
installation of package ëhBayesDMí had non-zero exit status
Flavor: r-devel-windows-ix86+x86_64
Check: R code for possible problems, Result: NOTE
bandit2arm_delta: no visible binding for global variable
'..insensitive_data_columns'
bandit2arm_delta: no visible binding for global variable '.N'
bandit2arm_delta: no visible binding for global variable 'subjid'
bandit4arm2_kalman_filter: no visible binding for global variable
'..insensitive_data_columns'
bandit4arm2_kalman_filter: no visible binding for global variable '.N'
bandit4arm2_kalman_filter: no visible binding for global variable
'subjid'
bandit4arm_4par: no visible binding for global variable
'..insensitive_data_columns'
bandit4arm_4par: no visible binding for global variable '.N'
bandit4arm_4par: no visible binding for global variable 'subjid'
bandit4arm_lapse: no visible binding for global variable
'..insensitive_data_columns'
bandit4arm_lapse: no visible binding for global variable '.N'
bandit4arm_lapse: no visible binding for global variable 'subjid'
bart_par4: no visible binding for global variable
'..insensitive_data_columns'
bart_par4: no visible binding for global variable '.N'
bart_par4: no visible binding for global variable 'subjid'
choiceRT_ddm: no visible binding for global variable
'..insensitive_data_columns'
choiceRT_ddm: no visible binding for global variable '.N'
choiceRT_ddm: no visible binding for global variable 'subjid'
choiceRT_ddm_single: no visible binding for global variable
'..insensitive_data_columns'
choiceRT_ddm_single: no visible binding for global variable '.N'
choiceRT_ddm_single: no visible binding for global variable 'subjid'
cra_exp: no visible binding for global variable
'..insensitive_data_columns'
cra_exp: no visible binding for global variable '.N'
cra_exp: no visible binding for global variable 'subjid'
cra_linear: no visible binding for global variable
'..insensitive_data_columns'
cra_linear: no visible binding for global variable '.N'
cra_linear: no visible binding for global variable 'subjid'
dbdm_prob_weight: no visible binding for global variable
'..insensitive_data_columns'
dbdm_prob_weight: no visible binding for global variable '.N'
dbdm_prob_weight: no visible binding for global variable 'subjid'
dd_cs: no visible binding for global variable
'..insensitive_data_columns'
dd_cs: no visible binding for global variable '.N'
dd_cs: no visible binding for global variable 'subjid'
dd_cs_single: no visible binding for global variable
'..insensitive_data_columns'
dd_cs_single: no visible binding for global variable '.N'
dd_cs_single: no visible binding for global variable 'subjid'
dd_exp: no visible binding for global variable
'..insensitive_data_columns'
dd_exp: no visible binding for global variable '.N'
dd_exp: no visible binding for global variable 'subjid'
dd_hyperbolic: no visible binding for global variable
'..insensitive_data_columns'
dd_hyperbolic: no visible binding for global variable '.N'
dd_hyperbolic: no visible binding for global variable 'subjid'
dd_hyperbolic_single: no visible binding for global variable
'..insensitive_data_columns'
dd_hyperbolic_single: no visible binding for global variable '.N'
dd_hyperbolic_single: no visible binding for global variable 'subjid'
gng_m1: no visible binding for global variable
'..insensitive_data_columns'
gng_m1: no visible binding for global variable '.N'
gng_m1: no visible binding for global variable 'subjid'
gng_m2: no visible binding for global variable
'..insensitive_data_columns'
gng_m2: no visible binding for global variable '.N'
gng_m2: no visible binding for global variable 'subjid'
gng_m3: no visible binding for global variable
'..insensitive_data_columns'
gng_m3: no visible binding for global variable '.N'
gng_m3: no visible binding for global variable 'subjid'
gng_m4: no visible binding for global variable
'..insensitive_data_columns'
gng_m4: no visible binding for global variable '.N'
gng_m4: no visible binding for global variable 'subjid'
hBayesDM_model : : no visible binding for global variable
'..insensitive_data_columns'
hBayesDM_model : : no visible binding for global variable
'.N'
hBayesDM_model : : no visible binding for global variable
'subjid'
igt_orl: no visible binding for global variable
'..insensitive_data_columns'
igt_orl: no visible binding for global variable '.N'
igt_orl: no visible binding for global variable 'subjid'
igt_pvl_decay: no visible binding for global variable
'..insensitive_data_columns'
igt_pvl_decay: no visible binding for global variable '.N'
igt_pvl_decay: no visible binding for global variable 'subjid'
igt_pvl_delta: no visible binding for global variable
'..insensitive_data_columns'
igt_pvl_delta: no visible binding for global variable '.N'
igt_pvl_delta: no visible binding for global variable 'subjid'
igt_vpp: no visible binding for global variable
'..insensitive_data_columns'
igt_vpp: no visible binding for global variable '.N'
igt_vpp: no visible binding for global variable 'subjid'
peer_ocu: no visible binding for global variable
'..insensitive_data_columns'
peer_ocu: no visible binding for global variable '.N'
peer_ocu: no visible binding for global variable 'subjid'
prl_ewa: no visible binding for global variable
'..insensitive_data_columns'
prl_ewa: no visible binding for global variable '.N'
prl_ewa: no visible binding for global variable 'subjid'
prl_fictitious: no visible binding for global variable
'..insensitive_data_columns'
prl_fictitious: no visible binding for global variable '.N'
prl_fictitious: no visible binding for global variable 'subjid'
prl_fictitious_multipleB: no visible binding for global variable
'..insensitive_data_columns'
prl_fictitious_multipleB: no visible binding for global variable '.N'
prl_fictitious_multipleB: no visible binding for global variable
'subjid'
prl_fictitious_rp: no visible binding for global variable
'..insensitive_data_columns'
prl_fictitious_rp: no visible binding for global variable '.N'
prl_fictitious_rp: no visible binding for global variable 'subjid'
prl_fictitious_rp_woa: no visible binding for global variable
'..insensitive_data_columns'
prl_fictitious_rp_woa: no visible binding for global variable '.N'
prl_fictitious_rp_woa: no visible binding for global variable 'subjid'
prl_fictitious_woa: no visible binding for global variable
'..insensitive_data_columns'
prl_fictitious_woa: no visible binding for global variable '.N'
prl_fictitious_woa: no visible binding for global variable 'subjid'
prl_rp: no visible binding for global variable
'..insensitive_data_columns'
prl_rp: no visible binding for global variable '.N'
prl_rp: no visible binding for global variable 'subjid'
prl_rp_multipleB: no visible binding for global variable
'..insensitive_data_columns'
prl_rp_multipleB: no visible binding for global variable '.N'
prl_rp_multipleB: no visible binding for global variable 'subjid'
pst_gainloss_Q: no visible binding for global variable
'..insensitive_data_columns'
pst_gainloss_Q: no visible binding for global variable '.N'
pst_gainloss_Q: no visible binding for global variable 'subjid'
ra_noLA: no visible binding for global variable
'..insensitive_data_columns'
ra_noLA: no visible binding for global variable '.N'
ra_noLA: no visible binding for global variable 'subjid'
ra_noRA: no visible binding for global variable
'..insensitive_data_columns'
ra_noRA: no visible binding for global variable '.N'
ra_noRA: no visible binding for global variable 'subjid'
ra_prospect: no visible binding for global variable
'..insensitive_data_columns'
ra_prospect: no visible binding for global variable '.N'
ra_prospect: no visible binding for global variable 'subjid'
rdt_happiness: no visible binding for global variable
'..insensitive_data_columns'
rdt_happiness: no visible binding for global variable '.N'
rdt_happiness: no visible binding for global variable 'subjid'
ts_par4: no visible binding for global variable
'..insensitive_data_columns'
ts_par4: no visible binding for global variable '.N'
ts_par4: no visible binding for global variable 'subjid'
ts_par6: no visible binding for global variable
'..insensitive_data_columns'
ts_par6: no visible binding for global variable '.N'
ts_par6: no visible binding for global variable 'subjid'
ts_par7: no visible binding for global variable
'..insensitive_data_columns'
ts_par7: no visible binding for global variable '.N'
ts_par7: no visible binding for global variable 'subjid'
ug_bayes: no visible binding for global variable
'..insensitive_data_columns'
ug_bayes: no visible binding for global variable '.N'
ug_bayes: no visible binding for global variable 'subjid'
ug_delta: no visible binding for global variable
'..insensitive_data_columns'
ug_delta: no visible binding for global variable '.N'
ug_delta: no visible binding for global variable 'subjid'
wcs_sql: no visible binding for global variable
'..insensitive_data_columns'
wcs_sql: no visible binding for global variable '.N'
wcs_sql: no visible binding for global variable 'subjid'
Undefined global functions or variables:
..insensitive_data_columns .N subjid
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.