Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Parameters #297

Open
jrdnmdhl opened this issue May 27, 2017 · 2 comments
Open

Global Parameters #297

jrdnmdhl opened this issue May 27, 2017 · 2 comments

Comments

@jrdnmdhl
Copy link
Contributor

As currently implemented, parameters are evaluated separately by comparator. This presents a problem for #293. At best, this means such computations will take multiple times longer. At worst, it means each comparator will get different results for the same model (if the estimation is non-deterministic).

Perhaps we need to separate global and comparator-specific parameters?

@MattWiener
Copy link
Contributor

I think we already have the tools to do this. tabular_input.R uses one method, which is to load things into and pass around an environment. That's what's being done for create_df_from_tabular (currently in my version line 111 - 117) and sourcing in functions (lines 119-134). Objects and functions get incorporated into an environment that is then passed to create_parameters_from_tabular and incorporated into the environment used for all evaluations (including parameters), so you can just refer to those objects when you want them. The data frames used as the first argument to look_up, for example, are loaded this way.

look_up is deterministic, of course, so there would need to be something extra for stochastic computations. For bootstrapping, for example, you could load in the base data set as a global parameter, and then define a function that takes in the base set and a seed. Setting the seed would allow the same set to be selected for each strategy. In fact, maybe we would want a general wrapper function that could be applied to other functions that would take in a seed and other arguments, set the seed, and pass the rest of the arguments through to the "base" function. Something like (untested):

function(seed, fn, ...){
  set_seed(seed)
  do.call(fn, list(...))
}

That's just one idea. There may be better ways to use it, but the environment that's already being passed around seems like it is part of the solution.

@jrdnmdhl
Copy link
Contributor Author

The idea here is to come up with a solution that also works for #293, which is intended to replace some of the mechanics that you are describing by allowing anything to be a parameter. I think your points can be read as a challenge to whether #293 is actually necessary.

I think it makes sense to come at the problem from both angles:

  • Try to make the existing workarounds sufficiently good that we don't need arbitrary objects in parameters
  • Try to develop a seamless solution to arbitrary objects in parameters, including how to handle parameters that are global

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants