-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add OneHotEncoding Transform #19
Conversation
Codecov Report
@@ Coverage Diff @@
## main #19 +/- ##
==========================================
- Coverage 93.75% 93.58% -0.17%
==========================================
Files 7 8 +1
Lines 80 78 -2
==========================================
- Hits 75 73 -2
Misses 5 5
Continue to review full report at Codecov.
|
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.
I think we should have a couple more kinds of tests, it looks good otherwise.
src/one_hot_encoding.jl
Outdated
|
||
function OneHotEncoding(possible_values::AbstractVector) | ||
if length(unique(possible_values)) < length(possible_values) | ||
throw(ArgumentError("Expected an ordered list of all unique possible values")) |
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.
Do the elements need to be a consistent order? Or does "ordered list" just refer to the type?
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.
They just need to be in the order of expected column output. so for input of 24 hours they should be ordered from Hour(1) to Hour(24). Then if it is applied on x = [Hour (2), Hour(2), Hour(1)] the result would be
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Closes #7