Skip to content

Instantly share code, notes, and snippets.

@njtierney
Created February 5, 2024 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njtierney/5c0e7d9f8be79cb30c7131e0d2cfbdfb to your computer and use it in GitHub Desktop.
Save njtierney/5c0e7d9f8be79cb30c7131e0d2cfbdfb to your computer and use it in GitHub Desktop.
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
normal(0,1)
#> ℹ Initialising python and checking dependencies, this may take a moment.
#> ✔ Initialising python and checking dependencies ... done!
#> 
#> greta array (variable following a normal distribution)
#> 
#>      [,1]
#> [1,]  ?
m <- model(normal(0,1))
plot(m)

draws <- mcmc(m)
#> running 4 chains simultaneously on up to 8 CPU cores
#> 
#>     warmup                                           0/1000 | eta:  ?s              warmup ==                                       50/1000 | eta: 11s              warmup ====                                    100/1000 | eta:  6s              warmup ======                                  150/1000 | eta:  5s              warmup ========                                200/1000 | eta:  4s              warmup ==========                              250/1000 | eta:  3s              warmup ===========                             300/1000 | eta:  3s              warmup =============                           350/1000 | eta:  2s              warmup ===============                         400/1000 | eta:  2s              warmup =================                       450/1000 | eta:  2s              warmup ===================                     500/1000 | eta:  2s              warmup =====================                   550/1000 | eta:  1s              warmup =======================                 600/1000 | eta:  1s              warmup =========================               650/1000 | eta:  1s              warmup ===========================             700/1000 | eta:  1s              warmup ============================            750/1000 | eta:  1s              warmup ==============================          800/1000 | eta:  1s              warmup ================================        850/1000 | eta:  0s              warmup ==================================      900/1000 | eta:  0s              warmup ====================================    950/1000 | eta:  0s              warmup ====================================== 1000/1000 | eta:  0s          
#>   sampling                                           0/1000 | eta:  ?s            sampling ==                                       50/1000 | eta:  1s            sampling ====                                    100/1000 | eta:  1s            sampling ======                                  150/1000 | eta:  1s            sampling ========                                200/1000 | eta:  1s            sampling ==========                              250/1000 | eta:  1s            sampling ===========                             300/1000 | eta:  1s            sampling =============                           350/1000 | eta:  0s            sampling ===============                         400/1000 | eta:  0s            sampling =================                       450/1000 | eta:  0s            sampling ===================                     500/1000 | eta:  0s            sampling =====================                   550/1000 | eta:  0s            sampling =======================                 600/1000 | eta:  0s            sampling =========================               650/1000 | eta:  0s            sampling ===========================             700/1000 | eta:  0s            sampling ============================            750/1000 | eta:  0s            sampling ==============================          800/1000 | eta:  0s            sampling ================================        850/1000 | eta:  0s            sampling ==================================      900/1000 | eta:  0s            sampling ====================================    950/1000 | eta:  0s            sampling ====================================== 1000/1000 | eta:  0s
plot(draws)

Created on 2024-02-05 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.3.2 (2023-10-31)
#>  os       macOS Sonoma 14.0
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Australia/Sydney
#>  date     2024-02-05
#>  pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date (UTC) lib source
#>  abind           1.4-5      2016-07-21 [1] CRAN (R 4.3.0)
#>  backports       1.4.1      2021-12-13 [1] CRAN (R 4.3.0)
#>  base64enc       0.1-3      2015-07-28 [1] CRAN (R 4.3.0)
#>  callr           3.7.3      2022-11-02 [1] CRAN (R 4.3.0)
#>  chromote        0.1.2      2023-08-11 [1] CRAN (R 4.3.0)
#>  cli             3.6.2      2023-12-11 [1] CRAN (R 4.3.1)
#>  coda            0.19-4     2020-09-30 [1] CRAN (R 4.3.0)
#>  codetools       0.2-19     2023-02-01 [1] CRAN (R 4.3.2)
#>  crayon          1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
#>  curl            5.2.0      2023-12-08 [1] CRAN (R 4.3.1)
#>  DiagrammeR      1.0.10     2023-05-18 [1] CRAN (R 4.3.0)
#>  DiagrammeRsvg   0.1        2016-02-04 [1] CRAN (R 4.3.0)
#>  digest          0.6.34     2024-01-11 [1] CRAN (R 4.3.1)
#>  dplyr           1.1.4      2023-11-17 [1] CRAN (R 4.3.1)
#>  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.3.0)
#>  evaluate        0.23       2023-11-01 [1] CRAN (R 4.3.1)
#>  fansi           1.0.6      2023-12-08 [1] CRAN (R 4.3.1)
#>  fastmap         1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
#>  fs              1.6.3      2023-07-20 [1] CRAN (R 4.3.0)
#>  future          1.33.1     2023-12-22 [1] CRAN (R 4.3.1)
#>  generics        0.1.3      2022-07-05 [1] CRAN (R 4.3.0)
#>  globals         0.16.2     2022-11-21 [1] CRAN (R 4.3.0)
#>  glue            1.7.0      2024-01-09 [1] CRAN (R 4.3.1)
#>  greta         * 0.4.3.9000 2024-01-29 [1] local
#>  highr           0.10       2022-12-22 [1] CRAN (R 4.3.0)
#>  hms             1.1.3      2023-03-21 [1] CRAN (R 4.3.0)
#>  htmltools       0.5.7      2023-11-03 [1] CRAN (R 4.3.1)
#>  htmlwidgets     1.6.4      2023-12-06 [1] CRAN (R 4.3.1)
#>  igraph          1.5.1      2023-08-10 [1] CRAN (R 4.3.0)
#>  jsonlite        1.8.8      2023-12-04 [1] CRAN (R 4.3.1)
#>  knitr           1.45       2023-10-30 [1] CRAN (R 4.3.1)
#>  later           1.3.2      2023-12-06 [1] CRAN (R 4.3.1)
#>  lattice         0.21-9     2023-10-01 [1] CRAN (R 4.3.2)
#>  lifecycle       1.0.4      2023-11-07 [1] CRAN (R 4.3.1)
#>  listenv         0.9.0      2022-12-16 [1] CRAN (R 4.3.0)
#>  magrittr        2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
#>  Matrix          1.6-1.1    2023-09-18 [1] CRAN (R 4.3.2)
#>  parallelly      1.36.0     2023-05-26 [1] CRAN (R 4.3.0)
#>  pillar          1.9.0      2023-03-22 [1] CRAN (R 4.3.0)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.3.0)
#>  png             0.1-8      2022-11-29 [1] CRAN (R 4.3.0)
#>  prettyunits     1.2.0      2023-09-24 [1] CRAN (R 4.3.1)
#>  processx        3.8.3      2023-12-10 [1] CRAN (R 4.3.1)
#>  progress        1.2.3      2023-12-06 [1] CRAN (R 4.3.1)
#>  promises        1.2.1      2023-08-10 [1] CRAN (R 4.3.0)
#>  ps              1.7.6      2024-01-18 [1] CRAN (R 4.3.1)
#>  purrr           1.0.2      2023-08-10 [1] CRAN (R 4.3.0)
#>  R.cache         0.16.0     2022-07-21 [1] CRAN (R 4.3.0)
#>  R.methodsS3     1.8.2      2022-06-13 [1] CRAN (R 4.3.0)
#>  R.oo            1.25.0     2022-06-12 [1] CRAN (R 4.3.0)
#>  R.utils         2.12.2     2022-11-11 [1] CRAN (R 4.3.0)
#>  R6              2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
#>  RColorBrewer    1.1-3      2022-04-03 [1] CRAN (R 4.3.0)
#>  Rcpp            1.0.12     2024-01-09 [1] CRAN (R 4.3.1)
#>  reprex          2.0.2      2022-08-17 [1] CRAN (R 4.3.0)
#>  reticulate      1.34.0     2023-10-12 [1] CRAN (R 4.3.1)
#>  rlang           1.1.3      2024-01-10 [1] CRAN (R 4.3.1)
#>  rmarkdown       2.25       2023-09-18 [1] CRAN (R 4.3.1)
#>  rstudioapi      0.15.0     2023-07-07 [1] CRAN (R 4.3.0)
#>  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
#>  stringi         1.8.3      2023-12-11 [1] CRAN (R 4.3.1)
#>  stringr         1.5.1      2023-11-14 [1] CRAN (R 4.3.1)
#>  styler          1.9.1      2023-03-04 [1] CRAN (R 4.3.0)
#>  tensorflow      2.14.0     2023-09-28 [1] CRAN (R 4.3.1)
#>  tfautograph     0.3.2      2021-09-17 [1] CRAN (R 4.3.0)
#>  tfruns          1.5.1      2022-09-05 [1] CRAN (R 4.3.0)
#>  tibble          3.2.1      2023-03-20 [1] CRAN (R 4.3.0)
#>  tidyr           1.3.1      2024-01-24 [1] CRAN (R 4.3.1)
#>  tidyselect      1.2.0      2022-10-10 [1] CRAN (R 4.3.0)
#>  utf8            1.2.4      2023-10-22 [1] CRAN (R 4.3.1)
#>  V8              4.4.0      2023-10-09 [1] CRAN (R 4.3.1)
#>  vctrs           0.6.5      2023-12-01 [1] CRAN (R 4.3.1)
#>  visNetwork      2.1.2      2022-09-29 [1] CRAN (R 4.3.0)
#>  webshot2        0.1.1      2023-08-11 [1] CRAN (R 4.3.0)
#>  websocket       1.4.1      2021-08-18 [1] CRAN (R 4.3.0)
#>  whisker         0.4.1      2022-12-05 [1] CRAN (R 4.3.0)
#>  withr           3.0.0      2024-01-16 [1] CRAN (R 4.3.1)
#>  xfun            0.41       2023-11-01 [1] CRAN (R 4.3.1)
#>  xml2            1.3.6      2023-12-04 [1] CRAN (R 4.3.1)
#>  yaml            2.3.8      2023-12-11 [1] CRAN (R 4.3.1)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
#> 
#> ─ Python configuration ───────────────────────────────────────────────────────
#>  python:         /Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2/bin/python
#>  libpython:      /Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2/lib/libpython3.8.dylib
#>  pythonhome:     /Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2:/Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2
#>  version:        3.8.15 | packaged by conda-forge | (default, Nov 22 2022, 08:49:06)  [Clang 14.0.6 ]
#>  numpy:          /Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2/lib/python3.8/site-packages/numpy
#>  numpy_version:  1.23.2
#>  tensorflow:     /Users/nick/Library/r-miniconda-arm64/envs/greta-env-tf2/lib/python3.8/site-packages/tensorflow
#>  
#>  NOTE: Python version was forced by use_python() function
#> 
#> ──────────────────────────────────────────────────────────────────────────────
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment