Closed howardnewyork closed 2 years ago
... also I am using the development version of Greta. If I use the CRAN version I get another error (which from prior posts appear to be a tensorflow 1.12 issue), namely:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Tensor conversion requested dtype int64 for Tensor with dtype int32: 'Tensor("Placeholder_16:0", dtype=int32)'
Thanks!
Seems like another breaking change in TF/TFP. I'll take a look.
Note: In my initial error, python 2.7 was referenced. I uninstalled and reinstalled everything to correctly point to python 3.6, but still get pretty much the same error (using development version of Greta):
Error: greta hit a tensorflow error:
Error in py_call_impl(callable, dots$args, dots$keywords): InvalidArgumentError: Offset dimension 0 in gather op is out of bounds; got 3, but should have been in [0,3).
[[node MultivariateNormalTriL/log_prob/affine_linear_operator/inverse/LinearOperatorLowerTriangular/solve/LinearOperatorLowerTriangular/solve/MatrixTriangularSolve/MatrixTriangularSolve (defined at /home/howard/anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/affine_linear_operator.py:180) = MatrixTriangularSolve[T=DT_DOUBLE, adjoint=false, lower=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](MultivariateNormalTriL/log_prob/affine_linear_operator/inverse/LinearOperatorLowerTriangular/solve/LinearOperatorLowerTriangular/solve/MatrixTriangularSolve/broadcast_matrix_batch_dims/add, MultivariateNormalTriL/log_prob/affine_linear_operator/inverse/LinearOperatorLowerTriangular/solve/LinearOperatorLowerTriangular/solve/Matrix
Yeah, that's gotta be a change to TFP then.
I cannot reproduce this error with Tensorflow 1.12 and Python 3.6.
Instead the model hits a matrix is not invertible error:
Error in py_call_impl(callable, dots$args, dots$keywords): InvalidArgumentError: Input matrix is not invertible.
When I run with one_by_one = TRUE
the sampler runs, albeit it does not seem to explore the sample space well - all parameters stay on the initial values
I basically cannot get any model with multivariate_normal to work. I am also using tensorflow-probability 0.5. Here are more details of my setup:
> tensorflow::tf_version()
[1] ‘1.12’
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bayesplot_1.6.0 coda_0.19-2 bindrcpp_0.2.2 greta_0.3.0.9001
loaded via a namespace (and not attached):
[1] reticulate_1.10.0.9003 progress_1.2.0 tidyselect_0.2.5 Rook_1.1-1 purrr_0.2.5
[6] listenv_0.7.0 lattice_0.20-38 colorspace_1.3-2 viridisLite_0.3.0 htmltools_0.3.6
[11] yaml_2.2.0 base64enc_0.1-3 XML_3.98-1.16 rlang_0.3.0.1 pillar_1.3.0
[16] glue_1.3.0 RColorBrewer_1.1-2 bindr_0.1.1 plyr_1.8.4 stringr_1.3.1
[21] tensorflow_1.9 munsell_0.5.0 gtable_0.2.0 visNetwork_2.0.4 future_1.10.0
[26] htmlwidgets_1.3 codetools_0.2-15 tfruns_1.4 DiagrammeR_1.0.0 parallel_3.5.1
[31] Rcpp_1.0.0 readr_1.1.1 scales_1.0.0 jsonlite_1.5 rgexf_0.15.3
[36] gridExtra_2.3 brew_1.0-6 ggplot2_3.1.0 hms_0.4.2 digest_0.6.18
[41] stringi_1.2.4 dplyr_0.7.8 grid_3.5.1 influenceR_0.1.0 tools_3.5.1
[46] magrittr_1.5 lazyeval_0.2.1 tibble_1.4.2 tidyr_0.8.2 crayon_1.3.4
[51] whisker_0.3-2 pkgconfig_2.0.2 Matrix_1.2-15 downloader_0.4 prettyunits_1.0.2
[56] ggridges_0.5.1 viridis_0.5.1 assertthat_0.2.0 rstudioapi_0.8 R6_2.3.0
[61] globals_0.12.4 igraph_1.2.2 compiler_3.5.1
reticulate::py_config()
python: /home/howard/anaconda3/envs/r-tensorflow/bin/python
libpython: /home/howard/anaconda3/envs/r-tensorflow/lib/libpython3.6m.so
pythonhome: /home/howard/anaconda3/envs/r-tensorflow:/home/howard/anaconda3/envs/r-tensorflow
version: 3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:08:43) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
numpy: /home/howard/anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/numpy
numpy_version: 1.15.4
tensorflow: /home/howard/anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/tensorflow
Likewise, I can't replicate the error on OSX with TF 0.12.0 and TFP 0.5.0. Strange!
@howardnewyork could you please let me know the result of these commands (to get TF and TFP versions):
library(tensorflow)
pkg <- reticulate::import("pkg_resources")
tfp_version <- pkg$get_distribution("tensorflow_probability")$version
tf_version <- tf$`__version__`
tf_version
tfp_version
Just to make sure it's the TF and TFP versions you are expecting!
P.S. @Voltemand were your convergence issues on the example above, with warmup = 5
and n_samples = 10
? If so, I would expect that, since the sampler needs some time to tune parameters.
@goldingn Good point! They were - I hadn't considered that.
> tf_version
[1] "1.12.0"
> tfp_version
[1] "0.5.0"
sorry - did not mean to close the issue. It is still a problem.
@howardnewyork Are you running this on a GPU or CPU?
Gpu
On Wed, Nov 14, 2018 at 6:02 PM Voltemand notifications@github.com wrote:
@howardnewyork https://github.com/howardnewyork Are you running this on a GPU or CPU?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/greta-dev/greta/issues/251#issuecomment-438851752, or mute the thread https://github.com/notifications/unsubscribe-auth/ABunF5ZdJyGsS8-ta6PzMcQZv55W3cWpks5uvKDngaJpZM4YcWaa .
That probably explains why I at least can't reproduce it as I'm using a CPU.
I can confirm that on the CPU version, the error does not occur, but the GPU version it does.
For the CPU version, you have to use the one_by_one = TRUE setting to avoid a matrix inversion problem. This setting makes no difference on the GPU version.
So the GPU version looks broken. I am not sure where to go from here.
Thanks for checking that!
It's curious, since neither greta nor TFP (which appears to be throwing the error message) have any GPU-specific code, and similar code has run fine for me on a GPU previously.
I won't be able to debug this on a GPU-enabled machine this week, but will feed back as soon as I can.
Here's a stopgap solution that may work (and will probably work better anyway), it's generally sensible to use a whitening transformation when doing MCMC on an unobserved multivariate normal. That looks something like this:
library(greta)
m <- 3
n <- 5
mu <- normal(0, 3, dim = c(n, m))
Sigma <- lkj_correlation(5, m)
# # usual multivariate normal
# x <- multivariate_normal(mu, Sigma, n_realisations = n)
# whitened version of multivariate normal, x is the same as above
U <- chol(Sigma)
z <- normal(0, 1, dim = c(n, m))
x <- mu + z %*% U
At some point, I'd like to make this happen automatically, along with other tricks #47
Thanks Nick... Some comments:
1: The problem does not go away. It looks like the issue occurs with the cholesky decomposition on the GPU. I think now this could be the same issue as #246. 2: The error shown (on my own problem using the whitening approach) is:
Error: greta hit a tensorflow error:
Error in py_call_impl(callable, dots$args, dots$keywords): InvalidArgumentError: Offset dimension 1 in gather op is out of bounds; got 3, but should have been in [0,3).
[[node mcmc_sample_chain/mh_bootstrap_results/hmc_kernel_bootstrap_results/maybe_call_fn_and_grads/value_and_gradients/gradients/mcmc_sample_chain/mh_bootstrap_results/hmc_kernel_bootstrap_results/maybe_call_fn_and_grads/value_and_gradients/Cholesky_grad/MatrixTriangularSolve (defined at /home/howard/anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/tensorflow_probability/python/mcmc/util.py:220) = MatrixTriangularSolve[T=DT_DOUBLE, adjoint=false, lower=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](mcmc_sample_chain/mh_bootstrap_results/hmc_kernel_bootstrap_results/maybe_call_fn_and_grads/value_and_gradients/Cholesky, mcmc_sample_chain/mh_bootstrap_results/hmc_kernel_bootstrap_results/maybe_call_fn_and_grads/value_and_gradients/gradients/mcmc_sample_chain/m
With regard to making the whitening approach the default method for multi-variate normal, I have found in models I built in Stan that the benefit of whitening can be quite problem specific. In some small data problems, whitening has had a significant deleterious effect. There is a discussion somewhere on the Stan forum (which I cannot find now) which deals with this in more depth. On other problems, whitening can make a huge positive difference. As such, if you are going to change the multivariate_normal function I would recommend including a parameter to allow the user to choose a whitening vs. non-whitening algorithm.
Also, if x
is the training data, and Sigma can be decomposed into Sigma = K + s*I
, where I
is an identity matrix, (as is usually the case with Gaussian Process models), then I can see the whitening method be programmed as:
U <- chol(K)
z <- normal(0, 1, dim = c(n, m))
f <- mu + z %*% U
distribution(x) = normal(f, s)
But if Sigma cannot be decomposed in such a way, it is not clear to me how the method can be generalized for all multivariate normal distributions.
Thanks again for all your help on this!!!
Hmmmm, that is strange and frustrating. I'll leave this open until I have a chance to debug this and #246 on a GPU
That's interesting, I've not yet run into a case where it doesn't work better. But I'm usually working on Gaussian processes, and I can see that if the posterior correlations in the random variables are very different from those defined in the covariance matrix, then whitening would make things worse. Definitely important to have that switch!
In the case you describe, the multivariate normal variable is observed (it's data, not a parameter), so there's nothing to be gained from whitening in that case anyway. That's the tricky bit of the automatic whitening idea, being able to undo the whitening once the distribution is moved from a variable onto data (the bit I just mentioned in #47, @Voltemand ).
Did y'all ever fix this? I'm having the same error whenever trying to sample a model with the mcmc() command. opt() works fine though.
I wasn't able to replicate the error. Though I haven't had much of a chance to try either.
If you were able to replicate your error in a minimal reproducible example, that would really help.
The most minimal example returns the error for me:
library(greta)
int <- normal(0, 10) coef <- normal(0, 10) sd <- cauchy(0, 3, truncation = c(0, Inf))
n_species <- length(unique(iris$Species)) species_id <- as.numeric(iris$Species)
Z <- model.matrix(~ Species + Sepal.Length * Species - 1, data = iris)
gamma_matrix <- multivariate_normal(matrix(0, 1, 2), diag(2), n_realisations = 3) gamma <- c(gamma_matrix)
wi <- as_data(iris$Sepal.Width) Z <- as_data(Z) mu <- int + coef wi + Z %% gamma
distribution(iris$Sepal.Length) <- normal(mu, sd)
m <- model(int,coef,sd) draws <- mcmc(m)
Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: Tensor conversion requested dtype int64 for Tensor with dtype int32: 'Tensor("Placeholder_16:0", dtype=int32)'
My tensorflow version is 1.13 and I'm running on a dell laptop with Nvidia gpu
On Fri, 21 Jun 2019 at 10:28, Nick Golding notifications@github.com wrote:
I wasn't able to replicate the error. Though I haven't had much of a chance to try either.
If you were able to replicate your error in a minimal reproducible example, that would really help.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/greta-dev/greta/issues/251?email_source=notifications&email_token=ACVNJQQNVFLAWMXSMGT2YB3P3SNKBA5CNFSM4GDRM2NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYH6TII#issuecomment-504359329, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVNJQQPZPZVVUNGJZJEGRDP3SNKBANCNFSM4GDRM2NA .
Can you (re-)install the version of greta from GitHub and run it again? I think that error is an issue with TF probability we managed to work around in the most recent version
I just did but i still get the error. There were some warnings on the installation that might be relevant:
devtools::install_github("greta-dev/greta") Downloading GitHub repo greta-dev/greta@master from URL https://api.github.com/repos/greta-dev/greta/zipball/master Installing greta Installing 1 package: coda Installing package into ‘C:/Users/zool1232/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coda_0.19-2.zip ' Content type 'application/zip' length 201882 bytes (197 KB) downloaded 197 KB
package ‘coda’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\zool1232\AppData\Local\Temp\Rtmp6r5xGq\downloaded_packages Installing 1 package: R6 Installing package into ‘C:/Users/zool1232/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/R6_2.4.0.zip' Content type 'application/zip' length 36837 bytes (35 KB) downloaded 35 KB
package ‘R6’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\zool1232\AppData\Local\Temp\Rtmp6r5xGq\downloaded_packages "C:/PROGRA~1/R/R-34~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0" \ --library="C:/Users/zool1232/Documents/R/win-library/3.4" --install-tests
Attaching package: ‘greta’
The following objects are masked from ‘package:stats’:
binomial, cov2cor, poisson
The following objects are masked from ‘package:base’:
%*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag, eigen,
forwardsolve, gamma, identity, rowMeans, rowSums, sweep, tapply
On Fri, 21 Jun 2019 at 11:44, Nick Golding notifications@github.com wrote:
Can you (re-)install the version of greta from GitHub and run it again? I think that error is an issue with TF probability we managed to work around in the most recent version
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/greta-dev/greta/issues/251?email_source=notifications&email_token=ACVNJQQEUEMGCS3Y7A5VU4LP3SWIRA5CNFSM4GDRM2NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIEBNY#issuecomment-504381623, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVNJQX3B2FO5KURMV7SCD3P3SWIRANCNFSM4GDRM2NA .
and it runs fine if I do Sys.setenv("CUDA_VISIBLE_DEVICES" = -1)
On Fri, 21 Jun 2019 at 11:46, Ewan Cameron dr.ewan.cameron@gmail.com wrote:
I just did but i still get the error. There were some warnings on the installation that might be relevant:
devtools::install_github("greta-dev/greta") Downloading GitHub repo greta-dev/greta@master from URL https://api.github.com/repos/greta-dev/greta/zipball/master Installing greta Installing 1 package: coda Installing package into ‘C:/Users/zool1232/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL ' https://cran.rstudio.com/bin/windows/contrib/3.4/coda_0.19-2.zip' Content type 'application/zip' length 201882 bytes (197 KB) downloaded 197 KB
package ‘coda’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\zool1232\AppData\Local\Temp\Rtmp6r5xGq\downloaded_packages Installing 1 package: R6 Installing package into ‘C:/Users/zool1232/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/R6_2.4.0.zip' Content type 'application/zip' length 36837 bytes (35 KB) downloaded 35 KB
package ‘R6’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\zool1232\AppData\Local\Temp\Rtmp6r5xGq\downloaded_packages "C:/PROGRA~1/R/R-34~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0" \ --library="C:/Users/zool1232/Documents/R/win-library/3.4" --install-tests
- installing source package 'greta' ... R inst tests preparing package for lazy loading help ** installing help indices converting help for package 'greta' finding HTML links ... done as_data html calculate html distribution html distributions html Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:175: missing file link 'dunif' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:176: missing file link 'dnorm' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:177: missing file link 'dlnorm' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:179: missing file link 'dbinom' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:181: missing file link 'dnbinom' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:182: missing file link 'dhyper' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:183: missing file link 'dpois' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:184: missing file link 'dgamma' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:186: missing file link 'dweibull' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:187: missing file link 'dexp' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:191: missing file link 'dbeta' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:192: missing file link 'dcauchy' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:193: missing file link 'dchisq' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:194: missing file link 'dlogis' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:195: missing file link 'df' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:196: missing file link 'dmvnorm' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:197: missing file link 'dmultinom' Rd warning: C:/Users/zool1232/AppData/Local/Temp/Rtmp6r5xGq/devtools19842b28e98/greta-dev-greta-cde31d0/man/distributions.Rd:198: missing file link 'dmultinom' extract-replace-combine html functions html greta html inference html internals html joint html mixture html model html operators html optimisers html overloaded html reexports html samplers html structures html transforms html variable html copying figures building package indices installing vignettes testing if installed package can be loaded ** arch - i386 arch - x64
- DONE (greta) In R CMD INSTALL Reloading installed greta
Attaching package: ‘greta’
The following objects are masked from ‘package:stats’:
binomial, cov2cor, poisson
The following objects are masked from ‘package:base’:
%*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag, eigen,
forwardsolve, gamma, identity, rowMeans, rowSums, sweep, tapply
On Fri, 21 Jun 2019 at 11:44, Nick Golding notifications@github.com wrote:
Can you (re-)install the version of greta from GitHub and run it again? I think that error is an issue with TF probability we managed to work around in the most recent version
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/greta-dev/greta/issues/251?email_source=notifications&email_token=ACVNJQQEUEMGCS3Y7A5VU4LP3SWIRA5CNFSM4GDRM2NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIEBNY#issuecomment-504381623, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVNJQX3B2FO5KURMV7SCD3P3SWIRANCNFSM4GDRM2NA .
Hmmm, strange. Thanks for running that. I suspect this may be a TF probability x GPU interaction, given it optimises fine. I've not had problems like this with GPUs on Google Cloud Compute, so may even be device specific
It's a wild guess, but you could try doing precision = 'single'
in the call to model()
?
Hi there! :wave:
There is a new approach in {greta} to installation, it involves some interactive prompts that arise when you install greta, which help setup a python environment with a specific version of python and other python packages. It should help make everything more reproducible and easier to implement. Are you able to give this a try?
# install.packages("remotes")
remotes::install_github("greta-dev/greta")
library(greta)
library(greta)
This will initialise python and trigger internal checks that make sure packages are installed. Something like this code is short and sweet and should trigger this.
model(normal(0,1))
Then this:
Follow these instructions:
install_greta_deps()
library(greta)
library(greta)
model(normal(0,1))
Let us know if this works! 😄
I could not replicate the errors given above in the latest version of greta (0.4.1)
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
int <- normal(0, 10)
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✓ Initialising python and checking dependencies ... done!
#>
coef <- normal(0, 10)
sd <- cauchy(0, 3, truncation = c(0, Inf))
n_species <- length(unique(iris$Species))
species_id <- as.numeric(iris$Species)
Z <- model.matrix(~ Species + Sepal.Length * Species - 1, data = iris)
gamma_matrix <- multivariate_normal(matrix(0, 1, 2),
diag(2),
n_realisations = 3)
gamma <- c(gamma_matrix)
wi <- as_data(iris$Sepal.Width)
Z <- as_data(Z)
mu <- int + coef * wi + Z %*% gamma
distribution(iris$Sepal.Length) <- normal(mu, sd)
m <- model(int,coef,sd)
draws <- mcmc(m)
#> running 4 chains simultaneously on up to 8 cores
\#\> warmup 0/1000 \| eta: ?s warmup == 50/1000 \| eta: 48s \| 4% bad warmup ==== 100/1000 \| eta: 31s \| 2% bad warmup ====== 150/1000 \| eta: 24s \| 1% bad warmup ======== 200/1000 \| eta: 20s \| \<1% bad warmup ========== 250/1000 \| eta: 18s \| \<1% bad warmup =========== 300/1000 \| eta: 16s \| \<1% bad warmup ============= 350/1000 \| eta: 14s \| \<1% bad warmup =============== 400/1000 \| eta: 13s \| \<1% bad warmup ================= 450/1000 \| eta: 11s \| \<1% bad warmup =================== 500/1000 \| eta: 10s \| \<1% bad warmup ===================== 550/1000 \| eta: 9s \| \<1% bad warmup ======================= 600/1000 \| eta: 8s \| \<1% bad warmup ========================= 650/1000 \| eta: 7s \| \<1% bad warmup =========================== 700/1000 \| eta: 6s \| \<1% bad warmup ============================ 750/1000 \| eta: 5s \| \<1% bad warmup ============================== 800/1000 \| eta: 4s \| \<1% bad warmup ================================ 850/1000 \| eta: 3s \| \<1% bad warmup ================================== 900/1000 \| eta: 2s \| \<1% bad warmup ==================================== 950/1000 \| eta: 1s \| \<1% bad warmup ====================================== 1000/1000 \| eta: 0s \| \<1% bad
\#\> sampling 0/1000 \| eta: ?s sampling == 50/1000 \| eta: 11s sampling ==== 100/1000 \| eta: 12s sampling ====== 150/1000 \| eta: 11s sampling ======== 200/1000 \| eta: 11s sampling ========== 250/1000 \| eta: 10s sampling =========== 300/1000 \| eta: 9s sampling ============= 350/1000 \| eta: 8s sampling =============== 400/1000 \| eta: 8s sampling ================= 450/1000 \| eta: 7s sampling =================== 500/1000 \| eta: 6s sampling ===================== 550/1000 \| eta: 6s sampling ======================= 600/1000 \| eta: 5s sampling ========================= 650/1000 \| eta: 5s sampling =========================== 700/1000 \| eta: 4s sampling ============================ 750/1000 \| eta: 4s sampling ============================== 800/1000 \| eta: 3s sampling ================================ 850/1000 \| eta: 2s sampling ================================== 900/1000 \| eta: 1s sampling ==================================== 950/1000 \| eta: 1s sampling ====================================== 1000/1000 \| eta: 0s
Created on 2022-03-18 by the reprex package (v2.0.1)
Closing this issue as it seems to be related to installation issues, which are hopefully solved in the latest release of greta. Happy to reopen this to explore further!
I am getting an error when I run models that previously worked when I use multivariate_normal.
I have tensorflow 1.12 installed (but not sure how to downgrade)
The error is:
Here is an example that causes the problem. The example is taken straight from the greta website with the last two lines added