-
Notifications
You must be signed in to change notification settings - Fork 34
Overload == and isequal for checking equality of Terms and Schemas #174
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
Open
ghost
wants to merge
7
commits into
JuliaStats:master
Choose a base branch
from
amCap1712:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0a6d78d
Overload == and isequal to check schema equality
amCap1712 1ca55c0
Remove unneccessary changes.
amCap1712 e6f8b87
Consistent formatting style and add more tests.
amCap1712 2f03a7c
Update src/terms.jl
ef367d7
Add more tests.
amCap1712 993829b
Fix broken tests.
amCap1712 ee16796
Fix broken tests.
amCap1712 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
@testset "schemas" begin | ||
|
||
import Base | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
using StatsModels: schema, apply_schema, FullRank | ||
|
||
f = @formula(y ~ 1 + a + b + c + b&c) | ||
df = (y = rand(9), a = 1:9, b = rand(9), c = repeat(["d","e","f"], 3)) | ||
f = @formula(y ~ 1 + a + b + c + b & c) | ||
y = rand(9) | ||
b = rand(9) | ||
|
||
df = (y = y, a = 1:9, b = b, c = repeat(["d", "e", "f"], 3)) | ||
f = apply_schema(f, schema(f, df)) | ||
@test f == apply_schema(f, schema(f, df)) | ||
|
||
df2 = (y = y, a = 1:9, b = b, c = [df.c; df.c]) | ||
df3 = (y = y, a = 1:9, b = b, c = repeat(["a", "b", "c"], 3)) | ||
df4 = (y = [df.y; df.y], a = [1:9; 1:9], b = [b; b], c = [df.c; df.c]) | ||
df5 = (z = y, a = 1:9, b = b, c = repeat(["d", "e", "f"], 3)) | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
|
||
sch = schema(df, Dict(:c => DummyCoding(base="e"))) | ||
sch2 = schema(df, Dict(:c => EffectsCoding(base="e"))) | ||
|
||
@test schema(df) == schema(df2) | ||
@test schema(df) != schema(df3) | ||
@test schema(df) != schema(df4) | ||
@test schema(df) != schema(df5) | ||
@test sch != sch2 | ||
|
||
@test isequal(schema(df), schema(df2)) | ||
kleinschmidt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@test !isequal(schema(df), schema(df3)) | ||
@test !isequal(schema(df), schema(df4)) | ||
@test !isequal(schema(df), schema(df5)) | ||
@test !isequal(sch, sch2) | ||
|
||
# @test schema(df) == schema(df3) | ||
# @test isequal(schema(df), schema(df3)) | ||
#@test schema(df) != schema(df4) | ||
#@test isequal(schema(df), schema(df4)) | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.