Skip to content

Commit

Permalink
✅ Enforce columns
Browse files Browse the repository at this point in the history
  • Loading branch information
EssamWisam committed Sep 1, 2024
1 parent 749a247 commit 46577f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/encoders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function ordinal_encoder_fit(X; featinds)

# 2. Use feature mapper to compute the mapping of each level in each column
for i in featinds
feat_col = Tables.getcolumn(X, i)
feat_col = Tables.getcolumn(Tables.columns(X), i)
feat_levels = levels(feat_col)
# Check if feat levels is already ordinal encoded in which case we skip
(Set([float(i) for i in 1:length(feat_levels)]) == Set(feat_levels)) && continue
Expand Down Expand Up @@ -59,7 +59,7 @@ function ordinal_encoder_transform(X, mapping_matrix)
numfeats = length(feat_names)
new_feats = []
for ind in 1:numfeats
col = Tables.getcolumn(X, ind)
col = Tables.getcolumn(Tables.columns(X), ind)

# Create the transformation function for each column
if ind in keys(mapping_matrix)
Expand Down Expand Up @@ -125,7 +125,7 @@ function embedding_transform(X, mapping_matrices)
new_feat_names = Symbol[]
new_cols = []
for feat_name in feat_names
col = Tables.getcolumn(X, feat_name)
col = Tables.getcolumn(Tables.columns(X), feat_name)
# Create the transformation function for each column
if feat_name in keys(mapping_matrices)
level2vector = mapping_matrices[feat_name]
Expand Down
2 changes: 1 addition & 1 deletion src/entity_embedding_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Returns the number of levels in each categorical column in the table `X`.
function get_num_levels(X, cat_inds)
num_levels = []
for i in cat_inds
num_levels = push!(num_levels, length(levels(Tables.getcolumn(X, i))))
num_levels = push!(num_levels, length(levels(Tables.getcolumn(Tables.columns(X), i))))
end
return num_levels
end
Expand Down

0 comments on commit 46577f7

Please sign in to comment.