-
Notifications
You must be signed in to change notification settings - Fork 129
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
Dependencies in formula not recognised #525
Comments
Thanks for the reminder on this. I gave up on formulas back when all However, there is a drawback: if your formula's symbols are columns in your data frame, the dependency relationships may be wrong. In the following example, dp <- drake_plan(
cyl = 1234,
x = fit_my_model(mpg ~ cyl, data = mtcars)
) I still think your use case is worth revisiting formulas, but please keep the above in mind. |
Sorry, but I am unlikely to change
|
I just encountered an issue slightly related to this, I have some covariates that are quite complicated to calculate. They are smooths were the position of the knots depends on the data. I encountered the problem that formulas can contain dependencies. This is a minimal example that reproduces the problem:
This is more like the situation I'm encountering where asdf then again depents on other variables require(mgcv)
make(drake_plan(m=gam(y~s(dd, k=asdf),data=d),
d=data.frame(y=rnorm(10), dd=rnorm(10)),
asdf=3))
Error: Target `m` failed. Call `diagnose(m)` for details. Error message:
object 'asdf' not found I guess this might be a work around but is not very elegant: make(drake_plan(m={asdf2<-asdf;gam(y~s(dd, k=asdf2),data=d)},
d=data.frame(y=rnorm(10), dd=rnorm(10)),
asdf=3)) |
Now that's a case where it is not enough to put plan <- drake_plan(
m = {
asdf
gam(y ~ s(dd, k = asdf), data = d)
},
d = data.frame(y = rnorm(10), dd = rnorm(10)),
asdf = 3
) |
Thanks that makes things a bit cleaner. |
Update: in #573, I am trying to move |
Drake is not recognising dependencies in a formula. In many regression models, one shouldn't have dependencies in the formula, but with a CCA and some other regression methods the response will always be a dependency (but the predictors should all be found in the
data
argument). There might be some methods like a PLS regression with a dependency as the predictor.In my case, I can use the non-formula version of
cca
, but that wouldn't always work.The text was updated successfully, but these errors were encountered: