Comments (4)
I think we can export the generic and thus the methods actually. However, then we would have to add all kinds of validity checks, which we currently don't have in place there. I like the idea of adding an exclude
option to subset_draws.
This could internally call remove_variables then.
BTW: the fact that the remove_variables methods are exported just ensures that they are registered as S3 methods to the generic. They won't actually be exported this way.
from posterior.
Yes, that looks sensible to me. Thank you!
from posterior.
I think an exclude
option for subset_draws
could be implemented with setdiff like this. If this seems ok, I can make a PR
subset_draws.draws_array <- function(x, variable = NULL, iteration = NULL,
chain = NULL, draw = NULL, regex = FALSE,
unique = TRUE, exclude = FALSE, ...) {
if (all_null(variable, iteration, chain, draw)) {
return(x)
}
x <- repair_draws(x)
variable <- check_existing_variables(variable, x, regex = regex)
iteration <- check_iteration_ids(iteration, x, unique = unique)
chain <- check_chain_ids(chain, x, unique = unique)
draw <- check_draw_ids(draw, x, unique = unique)
########## code for exclude option
if (exclude) {
if (!is.null(variable)) {
variable <- setdiff(variables(x), variable)
}
if (!is.null(iteration)) {
iteration <- setdiff(iteration_ids(x), iteration)
}
if (!is.null(chain)) {
chain <- setdiff(chain_ids(x), chain)
}
if (!is.null(draw)) {
draw <- setdiff(draw_ids(x), draw)
}
}
#############
x <- prepare_subsetting(x, iteration, chain, draw)
if (!is.null(draw)) {
iteration <- draw
}
x <- .subset_draws(x, iteration, chain, variable, reserved = TRUE)
if (!is.null(chain) || !is.null(iteration)) {
x <- repair_draws(x, order = FALSE)
}
x
}
from posterior.
Closed by #336
from posterior.
Related Issues (20)
- Dealing with chains of different length HOT 1
- rvar strange behavior HOT 2
- Add functions for PIT and LOO-PIT HOT 6
- Add a function to extract single draw of multidimensional variable HOT 4
- .args in summarise draws incompatible with summary functions without ellipses HOT 10
- `pareto_khat(..., tail="both")` returns NA if just one tail is constant
- pareto diagnostics return named values, preventing renaming
- validate_weights allows NaN and NA weights
- [FR] Allow as_draws_dt for data.table HOT 9
- New draws_tensor format? HOT 4
- Applying a function to each chain HOT 1
- In summarise draws, a function that returns a character changes all columns to character HOT 4
- export ps_khat_threshold HOT 4
- pareto_khat should always return the same data structure
- `ps_khat_threshold` can return values greater than 0.7 HOT 2
- Errors when `rvar` is made from a data frame HOT 3
- subset_draws duplicates variables if `variables` argument contains `NA` HOT 3
- New CRAN release? HOT 6
- default for `r_eff` in `pareto_smooth()` and `pareto_khat()` differ
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 posterior.