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

don't create schema for terms that already have them #103

Merged
merged 14 commits into from
Jun 24, 2019

Conversation

kleinschmidt
Copy link
Member

@kleinschmidt kleinschmidt commented May 20, 2019

possible fix for #97: don't generate schema entries for terms that don't need schema setting (so categorical, continuous, intercept).

The alternative is to specify concrete_term method like concrete_term(t, d, hint) = t that just passes anything through that's not a Term. I'm pretty sure these are functionally basically equivalent, but maybe not.

@oxinabox

EDIT: I also added a reproducer and fix for #95, which required a wrapper type Schema in order to avoid method ambiguities in apply_schema.

@codecov-io
Copy link

Codecov Report

Merging #103 into master will decrease coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.49%   84.31%   -0.19%     
==========================================
  Files           8        8              
  Lines         458      459       +1     
==========================================
  Hits          387      387              
- Misses         71       72       +1
Impacted Files Coverage Δ
src/schema.jl 82.65% <0%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861a222...ac912d9. Read the comment docs.

4 similar comments
@codecov-io
Copy link

Codecov Report

Merging #103 into master will decrease coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.49%   84.31%   -0.19%     
==========================================
  Files           8        8              
  Lines         458      459       +1     
==========================================
  Hits          387      387              
- Misses         71       72       +1
Impacted Files Coverage Δ
src/schema.jl 82.65% <0%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861a222...ac912d9. Read the comment docs.

@codecov-io
Copy link

Codecov Report

Merging #103 into master will decrease coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.49%   84.31%   -0.19%     
==========================================
  Files           8        8              
  Lines         458      459       +1     
==========================================
  Hits          387      387              
- Misses         71       72       +1
Impacted Files Coverage Δ
src/schema.jl 82.65% <0%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861a222...ac912d9. Read the comment docs.

@codecov-io
Copy link

codecov-io commented May 20, 2019

Codecov Report

Merging #103 into master will decrease coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.49%   84.31%   -0.19%     
==========================================
  Files           8        8              
  Lines         458      459       +1     
==========================================
  Hits          387      387              
- Misses         71       72       +1
Impacted Files Coverage Δ
src/schema.jl 82.65% <0%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861a222...ac912d9. Read the comment docs.

@codecov-io
Copy link

Codecov Report

Merging #103 into master will decrease coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.49%   84.31%   -0.19%     
==========================================
  Files           8        8              
  Lines         458      459       +1     
==========================================
  Hits          387      387              
- Misses         71       72       +1
Impacted Files Coverage Δ
src/schema.jl 82.65% <0%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 861a222...ac912d9. Read the comment docs.

@codecov-io
Copy link

codecov-io commented May 20, 2019

Codecov Report

Merging #103 into master will decrease coverage by 0.63%.
The diff coverage is 73.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   84.71%   84.07%   -0.64%     
==========================================
  Files           8        8              
  Lines         458      471      +13     
==========================================
+ Hits          388      396       +8     
- Misses         70       75       +5
Impacted Files Coverage Δ
src/schema.jl 80.9% <73.68%> (-2.6%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1558072...a1e0344. Read the comment docs.

@nalimilan
Copy link
Member

Is there a reason why we can't just use Dict instead of defining a custom Schema type?

@kleinschmidt
Copy link
Member Author

Not really, although having a wrapper type allows for more convenience constructors (e.g., if you use symbols as keys in your constructor instead of Terms). But really I just added it for dispatch so any type would work for that.

@nalimilan
Copy link
Member

Not really, although having a wrapper type allows for more convenience constructors (e.g., if you use symbols as keys in your constructor instead of Terms).

But aren't symbols accepted already in dicts? That can be handled when applying the schema.

@kleinschmidt
Copy link
Member Author

At the moment you can pass a dict with symbol keys and it'll choke since apply_schema tries to use Terms to index. So the way that happens will have to be changed in every single apply_schema method (and worse, anyone who writes their own method will have to be careful to include whatever support code is necessary). That sounds like too much boilerplate to me, which can be avoided by using a wrapper type that provides a single place for enforcing a particular standard and accessing the elements.

Anyway, I'm not really wedded to using a wrapper type (and in fact I tried to avoid it originally, using a vanilla dict), but having something concrete that's easy to dispatch on makes it much easier to avoid method ambiguities which were becoming a big headache for apply_schema.

@nalimilan
Copy link
Member

OK. One solution would be to have terms and symbols compare and hash equal (so that they can be used interchangeably in dicts), but I guess you wouldn't want that.

src/schema.jl Show resolved Hide resolved
src/schema.jl Outdated Show resolved Hide resolved
Co-Authored-By: Milan Bouchet-Valat <nalimilan@club.fr>
@kleinschmidt kleinschmidt merged commit aafdcaf into master Jun 24, 2019
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

Successfully merging this pull request may close these issues.

3 participants