-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
if q turns out to be zero here, then there is an uncaught exception here. a simple MWE is when length(xs) * span < 1. is it worth throwing an informative error?
julia> using Loess
julia> loess([1,2,3], [4,5,6], span=0.1)
ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
[1] mapreduce_empty(#unused#::typeof(identity), op::Function, T::Type)
@ Base ./reduce.jl:367
[2] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, #unused#::Type{Float64})
@ Base ./reduce.jl:356
[3] reduce_empty_iter
@ ./reduce.jl:379 [inlined]
[4] mapreduce_empty_iter(f::Function, op::Function, itr::Vector{Float64}, ItrEltype::Base.HasEltype)
@ Base ./reduce.jl:375
[5] _mapreduce(f::typeof(identity), op::typeof(max), #unused#::IndexLinear, A::Vector{Float64})
@ Base ./reduce.jl:427
[6] _mapreduce_dim
@ ./reducedim.jl:365 [inlined]
[7] #mapreduce#800
@ ./reducedim.jl:357 [inlined]
[8] mapreduce
@ ./reducedim.jl:357 [inlined]
[9] #_maximum#818
@ ./reducedim.jl:999 [inlined]
[10] _maximum
@ ./reducedim.jl:999 [inlined]
[11] #_maximum#817
@ ./reducedim.jl:998 [inlined]
[12] _maximum
@ ./reducedim.jl:998 [inlined]
[13] #maximum#815
@ ./reducedim.jl:994 [inlined]
[14] maximum
@ ./reducedim.jl:994 [inlined]
[15] loess(xs::Matrix{Float64}, ys::Vector{Float64}; normalize::Bool, span::Float64, degree::Int64, cell::Float64)
@ Loess ~/.julia/packages/Loess/p2rXa/src/Loess.jl:97
[16] loess
@ ~/.julia/packages/Loess/p2rXa/src/Loess.jl:39 [inlined]
[17] #loess#12
@ ~/.julia/packages/Loess/p2rXa/src/Loess.jl:142 [inlined]
[18] loess
@ ~/.julia/packages/Loess/p2rXa/src/Loess.jl:142 [inlined]
[19] #loess#13
@ ~/.julia/packages/Loess/p2rXa/src/Loess.jl:147 [inlined]
[20] top-level scope
@ REPL[5]:1
julia> VERSION
v"1.9.2"
(jl_Wt4s1c) pkg> st
Status `/private/var/folders/s5/8d629n5d7nsf37f60_91wzr40000gq/T/jl_Wt4s1c/Project.toml`
[4345ca2d] Loess v0.6.1
julia> Sys.MACHINE
"arm64-apple-darwin22.4.0"
Metadata
Metadata
Assignees
Labels
No labels