-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use KeyTypeAttribute from Schema in CreateTextLoader #5082
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5082 +/- ##
==========================================
- Coverage 75.66% 75.65% -0.02%
==========================================
Files 993 993
Lines 178157 178180 +23
Branches 19125 19126 +1
==========================================
- Hits 134800 134795 -5
- Misses 38136 38158 +22
- Partials 5221 5227 +6
|
|
|
||
| var data = mlContext.Data.CreateTextLoader<BreastCancerInputModelWithKeyType>(separatorChar: ',').Load(breastCancerPath); | ||
|
|
||
| Assert.True(data.Schema[1].Type.GetKeyCount() == 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Assert.True(something == expected), it is better to use Assert.Equal(expected, actual). The reason is when it fails, xunit will print what the expected and actual values are, which helps figure out the issue, without having to re-run the test and debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point @eerhardt, thanks for the review. Pushed the recommended change.
eerhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Nice work on the fix and thanks for the contribution, @aslotte!
|
@aslotte Thank you for the contribution. I have merged your PR. |
|
Thanks all! |
Fixes #2642
This PR reads the KeyTypeAttribute from the schema of the incoming type and sets that on the corresponding column when loading a text file using the CreateTextLoader.