From 962bbda6efcb350eedebc13452bdf4f7291f4ff0 Mon Sep 17 00:00:00 2001 From: Essam Date: Mon, 5 Aug 2024 21:34:55 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=94=20Further=20ensure=20all=20inputs?= =?UTF-8?q?=20are=20float?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/encoders.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/encoders.jl b/src/encoders.jl index 373724f..6cb3aae 100644 --- a/src/encoders.jl +++ b/src/encoders.jl @@ -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