Skip to content

Commit

Permalink
evaluating RFCDE vigniette
Browse files Browse the repository at this point in the history
  • Loading branch information
FridljDa committed Mar 4, 2022
1 parent 656eeef commit d663e64
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
Empty file added R/Icon
Empty file.
Empty file added inst/Icon
Empty file.
24 changes: 19 additions & 5 deletions r/vignettes/RFCDE.Rmd
Expand Up @@ -25,7 +25,7 @@ estimation.
## Example

```{r}
library(RFCDE)
devtools::load_all()
set.seed(42)
generate_data <- function(n) {
Expand All @@ -52,15 +52,29 @@ $$ \int \int (\hat{f}(x \mid z) - f(x \mid z))^{2} dz dP(x) $$
This is efficiently calculated using an orthogonal series
representation of the conditional densities. The resolution of this
representation is controlled by `n_basis`.

```{r}
n_trees <- 1000
n_trees <- 10
mtry <- 4
node_size <- 20
node_size <- 5
n_basis <- 15
```

```{r}
stdout <- vector('character')
con <- textConnection('stdout', 'wr', local = TRUE)
sink(con)
forest <- RFCDE(x_train, z_train, n_trees = n_trees, mtry = mtry,
node_size = node_size, n_basis = n_basis)
node_size = node_size, n_basis = n_basis, basis_system = "cosine",
min_loss_delta = 0)
sink()
close(con)
stdout
```

```{r}
oc0<- stringr::str_count(stdout, "0") #incorrect splits
oc1<- stringr::str_count(stdout, "1") #correct splits
oc1/(oc0+oc1) # we want this number to be high!
```

### Prediction
Expand Down
Empty file added src/Icon
Empty file.
Empty file added tests/Icon
Empty file.

0 comments on commit d663e64

Please sign in to comment.