Comments (2)
I think you have quite a few issues here. It isn't a furrr bug, it is just how you set it up.
First, note that the beta
column you create just contains the same data recycled 100 times. So there shouldn't be any difference in the results with it set up this way.
library(tibble)
df <- tibble(idx = seq(1, 100), beta = list(rnorm(4000, 0.5, 3)))
identical(df$beta[[1]], df$beta[[2]])
#> [1] TRUE
Next, I don't think you need future_pmap_dbl()
here, you can just use map_dbl()
if you don't wrap beta
in a list()
. Then you don't need to unlist()
it either. So something like this is probably what you wanted.
library(tidyverse)
library(furrr)
#> Loading required package: future
set.seed(123)
df <- tibble(idx = seq(1, 100))
df$beta <- replicate(nrow(df), expr = rnorm(4000, 0.5, 3), simplify = FALSE)
prior <- rnorm(1e4, 0, 10)
plan(multisession, workers = 2)
df %>%
mutate(
BF = future_map_dbl(
.x = beta,
.f = function(x, prior) {
bayestestR::bayesfactor_parameters(
posterior = x,
prior = prior,
direction = "two-sided",
null = c(-1, 1)
)$log_BF
},
prior = prior
)
)
#> # A tibble: 100 × 3
#> idx beta BF
#> <int> <list> <dbl>
#> 1 1 <dbl [4,000]> -1.42
#> 2 2 <dbl [4,000]> -1.38
#> 3 3 <dbl [4,000]> -1.38
#> 4 4 <dbl [4,000]> -1.41
#> 5 5 <dbl [4,000]> -1.43
#> 6 6 <dbl [4,000]> -1.39
#> 7 7 <dbl [4,000]> -1.36
#> 8 8 <dbl [4,000]> -1.40
#> 9 9 <dbl [4,000]> -1.40
#> 10 10 <dbl [4,000]> -1.39
#> # … with 90 more rows
Created on 2022-06-02 by the reprex package (v2.0.1)
from furrr.
@DavisVaughan Oh yes, thank you very much. No wonder why the same computation worked with my real data, but when I created this toy example to test code it did not. I didn't notice I created a same beta in the tibble, so silly :)
from furrr.
Related Issues (20)
- Error indices from purrr() are misleading in furrr()
- Getting the same random result across `purrr::map()` and `furrr::future_map()` HOT 3
- `furrr` much slower than `purrr` (on Windows) HOT 2
- Export a wrapper around purrr `map()` to workers rather than `map()` itself
- Setting `seed = TRUE` / `.progress=TRUE` globally in the R session HOT 1
- Carrier HOT 2
- mgcv::gam(~s(pc = object not found)) when future::plan(multisession, workers > 1) HOT 1
- when large matrix or df split into list, does furrr workers only access list element? HOT 1
- error: external pointer is not valid is not a particularly user actionable message HOT 5
- terra::rast() doesn't return a variable with workers > 1 HOT 3
- Understanding memory usage and performance of `furrr::future_apply` HOT 5
- Implement map_vec
- Use of variables in glue() inside furrr loops HOT 1
- Progress bar showing 100% even if not completed
- Error when plotting a {sf} object
- Identical RNG state for each task, despite setting different seeds in different tasks HOT 10
- How to pass to .f, character vectors in .x that reference global values?
- `future_map` not obviously faster than `map` in simple linear regression setting HOT 1
- Multiple calls of future_map() within a single plan() or script result in massive slowdown.
- furrr_options documentation doesn't say what to do with it
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from furrr.