-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
julia> d = (; a=rand(10), b=rand(10));
julia> f = @formula(0 ~ protect(unprotect(a + b + protect(a * b))))
FormulaTerm
Response:
0
Predictors:
(a,b)->protect(unprotect(a + b + protect(a * b)))
julia> apply_schema(f, schema(f, d))
FormulaTerm
Response:
0
Predictors:
a(continuous)
b(continuous)
a(continuous) & b(continuous)
vs.
julia> f = @formula(0 ~ a + b + protect(a * b))
FormulaTerm
Response:
0
Predictors:
a(unknown)
b(unknown)
(a,b)->protect(a * b)
julia> apply_schema(f, schema(f, d))
FormulaTerm
Response:
0
Predictors:
a(continuous)
b(continuous)
(a,b)->a * b
The real place this comes up in practice is when trying to add special syntax like in kleinschmidt/RegressionFormulae.jl#13 that correctly respects protect
inside it. The protect(unprotect(...
dance is mimicking how apply_schema
gets triggered.