RFC: add an additional apply_context stage
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- julia
- Domain
- backend-api-design
Research direction
Start with the apply_schema(term, schema, context), concrete_term, and proposed apply_context(term, context) entry points described in the issue. Determine the API and dispatch behavior for a pre-schema stage, then verify that MixedModels.jl can transform FunctionTerm{typeof(|)} before schema and concrete_term handling.
Written by the indexing model from the issue text.
Description
There are some situations where you want to transform terms before the schema is available, in part because this may affect how the schema itself is computed. For instance, for MixedModels.jl, we often have categorical "grouping variables" with a very large number of levels, for which the contrasts matrix is expensive to compute and store but which is never actually used. These are specified as the second argument in expressions like (1 + x + y | group), which gets initially parsed as FunctionTerm{typeof(|)}. It would, of course, be possible for MixedModels to add an additional method to concrete_term that says to treat the :group variable as categorical but not to compute the contrasts matrix (e.g., by using some other hypothetical GroupingTerm struct), but that's type piracy because another package might want to use calls to | in a different way.
So the proposal is to add a stage that's similar to apply_schema(term, schema, context) but which doesn't have the schema, something like apply_context(term, context) and runs before schema. Then in the case of MixedModels.jl, you could define apply_context(::FunctionTerm{typeof(|)}, ::Type{<:MixedModel}) = RanefTerm(...), and then dispatch on RanefTerm for schema/concrete_term.
cc. @dmbates, @palday
- Dominant language
- Julia
- Stars
- 252
- Forks
- 36
- Avg merge
- 3h 14m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaStats/StatsModels.jl
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
JuliaStats/StatsModels.jl#328 · 1 comment ·
-
Cell mean coding?Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
JuliaStats/StatsModels.jl#351 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
JuliaStats/StatsModels.jl#329 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
JuliaStats/StatsModels.jl#318 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
JuliaStats/StatsModels.jl#316 ·
All issues in JuliaStats/StatsModels.jl
Similar issues
-
Affine transformations of `JohnsonSU` could return a `JohnsonSU`Possibly taken @devmotion claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaStats/Distributions.jl#2117 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
TomerAberbach/profiler-md#970 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
grame-cncm/faust#1409 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
SciML/PETScDiffEq.jl#521 ·
Maintainers usually reply within 1 day