Skip to content

SMOTENC requires at least one continuous feature #110

Description

@ablaom

"SMOTENC" does not work unless there is at least one continuous feature. At least, that's reported for this python implementation and here we do get a fail for all categoricals:

SMOTENC = @load SMOTENC pkg=Imbalance verbosity=0
balanced_pipe = BalancedModel(pipe, balancer=SMOTENC())

mach = machine(SMOTENC())
transform(mach, X, y)
# ERROR: MethodError: no method matching smotenc(::Matrix{…}, ::CategoricalArrays.CategoricalVector{…}, ::Vector{…}; k::Int64, ratios::Float64, knn_tree::String, rng::Random.TaskLocalRNG)
# The function `smotenc` exists, but no method is defined for this combination of argument types.

# Closest candidates are:
#   smotenc(::Any, ::AbstractVector; k, ratios, knn_tree, rng, try_preserve_type)
#    @ Imbalance ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/smotenc.jl:315                                                                              
#   smotenc(::AbstractMatrix{<:AbstractFloat}, ::AbstractVector, ::AbstractVector{<:Int64}; k, ratios, knn_tree, rng, try_preserve_type) 
#    @ Imbalance ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/smotenc.jl:296                                                                              
#   smotenc(::Any, ::Integer; k, ratios, knn_tree, rng, try_preserve_type)
#    @ Imbalance ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/smotenc.jl:340                                                                              

# Stacktrace:
#  [1] tablify(matrix_func::typeof(Imbalance.smotenc), X::@NamedTuple{…}, y::CategoricalArrays.CategoricalVector{…}; try_preserve_type::Bool, encode_func::typeof(Imbalance.smotenc_encoder), decode_func::typeof(Imbalance.smotenc_decoder), kwargs::@Kwargs{…})
#    @ Imbalance ~/.julia/packages/Imbalance/LFVkH/src/table_wrappers.jl:73
#  [2] tablify
#    @ ~/.julia/packages/Imbalance/LFVkH/src/table_wrappers.jl:57 [inlined]
#  [3] #smotenc#94
#    @ ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/smotenc.jl:324 [inlined]                                                                                  
#  [4] smotenc
#    @ ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/smotenc.jl:315 [inlined]                                                                                  
#  [5] transform(s::Imbalance.MLJ.SMOTENC{…}, ::Nothing, X::@NamedTuple{…}, y::CategoricalArrays.CategoricalVector{…})                                                     
#    @ Imbalance.MLJ ~/.julia/packages/Imbalance/LFVkH/src/oversampling_methods/smotenc/interface_mlj.jl:46                                                                         
#  [6] transform(mach::Machine{…}, Xraw::@NamedTuple{…}, Xraw_more::CategoricalArrays.CategoricalVector{…})                                                     
#    @ MLJBase ~/.julia/packages/MLJBase/yVJvJ/src/operations.jl:143
#  [7] top-level scope
#    @ REPL[106]:1
#     Some type information was truncated. Use `show(err)` to see complete types.

@EssamWisam Can you confirm. If so, we should amend the document string.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions