Use KeyTypeAttribute from Schema in CreateTextLoader#5082
Merged
harishsk merged 2 commits intodotnet:masterfrom May 5, 2020
Merged
Use KeyTypeAttribute from Schema in CreateTextLoader#5082harishsk merged 2 commits intodotnet:masterfrom
harishsk merged 2 commits intodotnet:masterfrom
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
|
eerhardt
reviewed
May 2, 2020
|
|
||
| var data = mlContext.Data.CreateTextLoader<BreastCancerInputModelWithKeyType>(separatorChar: ',').Load(breastCancerPath); | ||
|
|
||
| Assert.True(data.Schema[1].Type.GetKeyCount() == 10); |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Great point @eerhardt, thanks for the review. Pushed the recommended change.
Contributor
|
@aslotte Thank you for the contribution. I have merged your PR. |
Contributor
Author
|
Thanks all! |
This was referenced May 5, 2020
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.