Skip to content

Commit

Permalink
fix installation bug and pandas based future warning issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Fleischhacker committed Feb 25, 2024
1 parent 1d97e80 commit c700059
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# causact (development version)
# causact 0.5.4
* patch release to fix installation issues. The default installation workflow now uses `numpyro==0.13.2` to avoid `ModuleNotFoundError: No module named 'jax.linear_util'`.

# causact 0.5.3
* Fixed bug where beta distribution was being treated as Laplace distribution.
Expand Down
8 changes: 4 additions & 4 deletions R/dag_numpyro.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ from jax.numpy import (exp, log, log1p, expm1, abs, mean,
plateDataStatements = paste(paste0(
abbrevLabelPad(paste0(plateDimDF$indexLabel)),# four spaces to have invis _dim
" = ",
"pd.factorize(r.",
"pd.factorize(np.array(r.",
gsub("\\$", ".", plateDimDF$dataPy),
",use_na_sentinel=True)[0] #DIM"),
"),use_na_sentinel=True)[0] #DIM"),
sep = "\n")
###make labels for dim variables = to label_dim
dimStatements = paste(
Expand All @@ -240,9 +240,9 @@ from jax.numpy import (exp, log, log1p, expm1, abs, mean,
coordLabelsStatements = paste(paste0(
abbrevLabelPad(paste0(plateDimDF$indexLabel,"_crd")),# four spaces to have invis _dim
" = ",
"pd.factorize(r.",
"pd.factorize(np.array(r.",
gsub("\\$", ".", plateDimDF$dataPy),
",use_na_sentinel=True)[1] #DIM"),
"),use_na_sentinel=True)[1] #DIM"),
sep = "\n")
functionArguments = paste(c(functionArguments,
plateDimDF$indexLabel),
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#' \item{CPI2017}{The Corruption Perceptions Index score for 2017: A country/territory’s score indicates the perceived level of public sector corruption on a scale of 0-100, where 0 means that a country is perceived as highly corrupt and a 100 means that a country is perceived as very clean. }
#' \item{HDI2017}{The human development index score for 2017: the Human Development Index (HDI) is a measure of achievement in the basic dimensions of human development across countries. It is an index made from a simple unweighted average of a nation’s longevity, education and income and is widely accepted in development discourse.}
#' }
#' @source <https://www.transparency.org/cpi> CPI data available from www.transparency.org/cpi. Accessed Oct 1, 2018. Consumer Perception Index 2017 by Transparency International is licensed under CC-BY- ND 4.0.
#' @source <https://www.transparency.org/en/cpi/2017> CPI data available from https://www.transparency.org/en/cpi/2017. Accessed Feb 24, 2024. Consumer Perception Index 2017 by Transparency International is licensed under CC-BY- ND 4.0.
#' @source <https://hdr.undp.org/data-center/human-development-index#/indicies/HDI> HDA data accessed on Oct 1, 2018.
#' @source <https://data.worldbank.org/> Population data accessed on Oct 1, 2018.
"corruptDF"
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ drawsDF ### see top of data frame
#> # A tibble: 4,000 × 4
#> theta_Toyota.Corolla theta_Subaru.Outback theta_Kia.Forte theta_Jeep.Wrangler
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0.192 0.633 0.210 0.794
#> 2 0.215 0.602 0.282 0.892
#> 3 0.200 0.621 0.299 0.890
#> 4 0.223 0.621 0.213 0.778
#> 5 0.220 0.611 0.261 0.788
#> 6 0.228 0.619 0.247 0.811
#> 7 0.228 0.619 0.247 0.811
#> 8 0.227 0.635 0.231 0.810
#> 9 0.222 0.600 0.291 0.888
#> 10 0.205 0.605 0.236 0.841
#> 1 0.214 0.609 0.199 0.844
#> 2 0.228 0.563 0.232 0.818
#> 3 0.217 0.611 0.255 0.848
#> 4 0.206 0.648 0.261 0.876
#> 5 0.187 0.624 0.313 0.819
#> 6 0.166 0.606 0.229 0.848
#> 7 0.213 0.622 0.234 0.839
#> 8 0.206 0.588 0.253 0.855
#> 9 0.211 0.646 0.219 0.855
#> 10 0.196 0.590 0.271 0.840
#> # ℹ 3,990 more rows
```

Expand Down Expand Up @@ -237,9 +237,9 @@ numpyroCode = graph %>% dag_numpyro(mcmc = FALSE)
#> ## note that above is from JAX numpy package, not numpy.
#>
#> y = np.array(r.carModelDF.getCard) #DATA
#> x = pd.factorize(r.carModelDF.carModel,use_na_sentinel=True)[0] #DIM
#> x = pd.factorize(np.array(r.carModelDF.carModel),use_na_sentinel=True)[0] #DIM
#> x_dim = len(np.unique(x)) #DIM
#> x_crd = pd.factorize(r.carModelDF.carModel,use_na_sentinel=True)[1] #DIM
#> x_crd = pd.factorize(np.array(r.carModelDF.carModel),use_na_sentinel=True)[1] #DIM
#> def graph_model(y,x):
#> ## Define random variables and their relationships
#> with npo.plate('x_dim',x_dim):
Expand All @@ -250,7 +250,7 @@ numpyroCode = graph %>% dag_numpyro(mcmc = FALSE)
#>
#> # computationally get posterior
#> mcmc = MCMC(NUTS(graph_model), num_warmup = 1000, num_samples = 4000)
#> rng_key = random.PRNGKey(seed = 111)
#> rng_key = random.PRNGKey(seed = 1234567)
#> mcmc.run(rng_key,y,x)
#> drawsDS = az.from_numpyro(mcmc,
#> coords = {'x_dim': x_crd},
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This is a patch release to fix two small bugs.
This is a patch release to fix a bug with installing python dependencies.

## Test environments
* local R installation, R 4.3.1
* local R installation, R 4.3.2
* ubuntu 16.04 (on travis-ci), R 4.3.1
* win-builder (devel)

Expand Down
2 changes: 1 addition & 1 deletion man/corruptDF.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/chimpsGraphPost-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/gretaPost-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c700059

Please sign in to comment.