JuliaML / MLDataUtils.jl

Utility package for generating, loading, splitting, and processing Machine Learning datasets
http://mldatautilsjl.readthedocs.io/
Other
102 stars 20 forks source link

Feature Scaler only works with AbstractFloat #20

Closed asbisen closed 7 years ago

asbisen commented 7 years ago

Is there a reason why rescale! is defined to work only with AbstractFloat https://github.com/JuliaML/MLDataUtils.jl/blob/master/src/feature_scaling.jl#L32:L53

x = rand(1:9, 10,5)
clf=fit(FeatureNormalizer, x)
predict(clf, x)
ERROR: MethodError: no method matching rescale!(::Array{Int64,2}, ::Array{Float64,1}, ::Array{Float64,1})
Closest candidates are:
  rescale!{T<:AbstractFloat}(::AbstractArray{T<:AbstractFloat,2}, ::AbstractArray{T,1}, ::AbstractArray{T,1}) at REPL[4]:9
  rescale!{T<:AbstractFloat}(::AbstractArray{T<:AbstractFloat,2}, ::AbstractArray{T,1}) at REPL[4]:9
 in predict!(::FeatureNormalizer, ::Array{Int64,2}) at ./REPL[9]:3
 in predict(::FeatureNormalizer, ::Array{Int64,2}) at ./REPL[10]:3

where as the following works

x = rand(10,5)
clf=fit(FeatureNormalizer, x)
predict(clf, x)
Evizero commented 7 years ago

good point. no not really. That's some quite old code that should be adapted