-
Notifications
You must be signed in to change notification settings - Fork 25
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
Arbitrary Objects in Parameters #293
Comments
Jordan - I think the ability to have arbitrary objects as parameters would be useful, particularly for the data set as you mention. Currently survival fits and partitioned survival objects are stored in tibbles. Does that solve any part of the problem? |
I don't think so. I think your work solves separate problems. |
Thanks a lot @jrdnmdhl. I see another benefit of keeping track of objects that are not vector parameters: it would allow us to fix #211 by providing an easy way to import those objects in the cluster nodes. Furthermore allowing for re-sampling of fitted models has always been on my mind, so I'm interested in anything that goes in that direction. I need some time to look at your proposition and think about ways to extend it to evaluation on new parameter values (the basis of PSA, DSA and heterogeneity analysis). You propositions are very welcome! |
I've completed a proof of concept implementation which can be viewed here: @pierucci @MattWiener @zkabat Please let me know if you think this is moving in the right direction. Summary of changes so far:
What remains to be done:
Other problems:
|
Apologies, this is another one of my essays in which I suggest a potential course of action, request feedback, and ask whether I should develop this into a pull request.
Motivation
One of the current limitations of the parameters functionality is that it only works for atomic vectors. If this restriction could be relaxed, then it would open up a great deal of additional functionality. I can see a few advantages for this:
My understanding of what is available when evaluating parameters
As I understand it, parameters essentially have access to two namespaces when they are evaluated:
How arbitrary objects could be supported
I think the key to implementing this is identify which objects belong in the environment or the tibble. In particular, I think time-dependent* atomic vectors belong in the tibble whereas all other values belong in the environment. The function to evaluate parameters can be modified to evaluate the parameters on their own, determine what type of object it is, and then assign them to the environment or tibble accordingly.
An partially working implementation and demonstration
In the example below, I define a data.frame as a parameter, pass it and another parameter to estimate a parametric survival model, define another survival distribution using apply_hr (using another parameter as the hr), and then calculate survival probabilities for those two distributions.
Result:
Note that the parameters written to the environment don't show up when the result of the parameters get printed, but those values are still "there" and accessible when any of these lazy express are evaluated.
Where it gets complicated
While this implementation is fairly trivial in a simple case, it does get a bit more complex with state expansion and in DSAs and PSAs. I'm not entirely sure how to extend this kind of implementation to those cases just yet.
The text was updated successfully, but these errors were encountered: