Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwright committed Feb 15, 2024
2 parents af2e691 + 0bb3329 commit f123bad
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 93 deletions.
15 changes: 12 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: arf
Title: Adversarial Random Forests
Version: 0.1.3
Date: 2023-02-06
Version: 0.2.0
Date: 2024-01-24
Authors@R:
c(person(given = "Marvin N.",
family = "Wright",
Expand All @@ -12,7 +12,15 @@ Authors@R:
family = "Watson",
role = c("aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-9632-2159")))
comment = c(ORCID = "0000-0001-9632-2159")),
person(given = "Kristin",
family = "Blesch",
role = c("aut"),
comment = c(ORCID = "0000-0001-6241-3079")),
person(given = "Jan",
family = "Kapar",
role = c("aut"),
comment = c(ORCID = "0009-0000-6408-2840")))
Maintainer: Marvin N. Wright <[email protected]>
Description: Adversarial random forests (ARFs) recursively partition data into
fully factorized leaves, where features are jointly independent. The
Expand Down Expand Up @@ -45,6 +53,7 @@ Suggests:
mlbench,
knitr,
rmarkdown,
tibble,
testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

# arf 0.2.0
* Vectorized adversarial resampling
* Speed boost for compiling into a probabilistic circuit
* Conditional densities and sampling
* Bayesian solution for invariant continuous data within leaf nodes
* New function for computing (conditional) expectations
* Options for missing data

# arf 0.1.3
* Speed boost for the adversarial resampling step
* Early stopping option for adversarial training
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ To generate 100 synthetic samples:
forge(psi, 100)
```

### MAP estimation
To estimate the most likely values for variables conditional on some evidence, say, `Species = "setosa"`:
### Conditional expectations
To estimate the mean of some variable(s), optionally conditioned on some event(s):
```R
evi <- data.frame(Species = "setosa")
map(psi, evidence = evi)
expct(psi, query = "Sepal.Length", evidence = evi)
```

For more detailed examples, see the package [vignette](https://bips-hb.github.io/arf/articles/vignette.html).
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-arguments.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test_that("FORDE works with alpha>0", {
arf <- adversarial_rf(iris, parallel = FALSE)
expect_silent(forde(arf, iris, parallel = FALSE, alpha = 0.01))
})
4 changes: 2 additions & 2 deletions tests/testthat/test-return_types.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_that("FORDE categories sum to unity", {
arf <- adversarial_rf(iris, num_trees = 2, verbose = FALSE, parallel = FALSE)
psi <- forde(arf, iris, parallel = FALSE)
tmp <- psi$cat[, sum(prob), by = f_idx]
expect_true(all.equal(tmp$V1, rep(1, times = tmp[, .N])))
expect_equal(tmp$V1, rep(1, times = tmp[, .N]))
})

test_that("Likelihood calculation returns vector of log-likelihoods", {
Expand All @@ -30,7 +30,7 @@ test_that("Likelihood calculation returns vector of log-likelihoods", {
expect_type(loglik, "double")
expect_length(loglik, nrow(iris))
expect_true(all(!is.na(loglik)))
expect_true(all.equal(loglik, loglik2))
expect_equal(loglik, loglik2)
})

test_that("FORGE returns data frame when called with data frame", {
Expand Down
Loading

0 comments on commit f123bad

Please sign in to comment.