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

Add OneHotEncoding Transform #19

Merged
merged 2 commits into from
Feb 17, 2021
Merged

Add OneHotEncoding Transform #19

merged 2 commits into from
Feb 17, 2021

Conversation

nicoleepp
Copy link
Contributor

Closes #7

@codecov
Copy link

codecov bot commented Feb 17, 2021

Codecov Report

Merging #19 (b8e8e06) into main (0f49caa) will decrease coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
src/Transforms.jl 100.00% <ø> (ø)
src/one_hot_encoding.jl 100.00% <100.00%> (ø)
src/transformers.jl 95.23% <0.00%> (-0.60%) ⬇️
src/power.jl 100.00% <0.00%> (ø)
src/periodic.jl 100.00% <0.00%> (ø)
src/linear_combination.jl 100.00% <0.00%> (ø)

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 0f49caa...850dd38. Read the comment docs.

src/one_hot_encoding.jl Outdated Show resolved Hide resolved
Copy link
Contributor

@bencottier bencottier left a 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.


function OneHotEncoding(possible_values::AbstractVector)
if length(unique(possible_values)) < length(possible_values)
throw(ArgumentError("Expected an ordered list of all unique possible values"))
Copy link
Contributor

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?

Copy link
Contributor Author

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

test/one_hot_encoding.jl Show resolved Hide resolved
@nicoleepp nicoleepp merged commit 9fd201a into main Feb 17, 2021
@nicoleepp nicoleepp deleted the ne/one-hot branch February 17, 2021 21:13
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.

One hot encoding transform
2 participants