Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One element case not handled correctly #82

Closed
pkofod opened this issue Sep 13, 2023 · 0 comments · Fixed by #83
Closed

One element case not handled correctly #82

pkofod opened this issue Sep 13, 2023 · 0 comments · Fixed by #83

Comments

@pkofod
Copy link

pkofod commented Sep 13, 2023

julia> xs = 10 .* rand(1)
1-element Vector{Float64}:
 7.534245260532203

julia> ys = sin.(xs) .+ 0.5 * rand(1)
1-element Vector{Float64}:
 1.32373419087167

julia> model = loess(xs, ys, span=0.5)
ERROR: MethodError: no method matching Loess.KDTree(::Matrix{Float64}, ::Vector{Int64}, ::Nothing, ::Set{Vector{Float64}}, ::Matrix{Float64})

Closest candidates are:
  Loess.KDTree(::Matrix{T}, ::Vector{Int64}, ::Loess.KDNode{T}, ::Set{Vector{T}}, ::Matrix{T}) where T<:AbstractFloat
   @ Loess ~/.julia/packages/Loess/YyInn/src/kd.jl:12
  Loess.KDTree(::AbstractMatrix{T}, ::Real, ::Real) where T<:AbstractFloat
   @ Loess ~/.julia/packages/Loess/YyInn/src/kd.jl:37

Stacktrace:
 [1] Loess.KDTree(xs::Matrix{Float64}, leaf_size_factor::Float64, leaf_diameter_factor::Int64)
   @ Loess ~/.julia/packages/Loess/YyInn/src/kd.jl:68
 [2] loess(xs::Matrix{Float64}, ys::Vector{Float64}; normalize::Bool, span::Float64, degree::Int64, cell::Float64)
   @ Loess ~/.julia/packages/Loess/YyInn/src/Loess.jl:70
 [3] loess
   @ ~/.julia/packages/Loess/YyInn/src/Loess.jl:43 [inlined]
 [4] #loess#10
   @ ~/.julia/packages/Loess/YyInn/src/Loess.jl:146 [inlined]
 [5] top-level scope
   @ REPL[26]:1

The loess estimate should just be the number itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant