Skip to content

Commit

Permalink
🤔 Further ensure all inputs are float
Browse files Browse the repository at this point in the history
  • Loading branch information
EssamWisam committed Aug 6, 2024
1 parent 833b845 commit 962bbda
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/encoders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ function ordinal_encoder_fit(X; featinds)
feat_col = Tables.getcolumn(X, i)
feat_levels = levels(feat_col)
# Check if feat levels is already ordinal encoded in which case we skip
(Set(1:length(feat_levels)) == Set(feat_levels)) && continue
(Set([float(i) for i in 1:length(feat_levels)]) == Set(feat_levels)) && continue
# Compute the dict using the given feature_mapper function
mapping_matrix[i] =
Dict{Any, Integer}(value => float(index) for (index, value) in enumerate(feat_levels))
Dict{Any, AbstractFloat}(
value => float(index) for (index, value) in enumerate(feat_levels)
)
end
return mapping_matrix
end
Expand Down

0 comments on commit 962bbda

Please sign in to comment.