Skip to content

0.6.5 no longer robust to NaN inputs #107

@bjarthur

Description

@bjarthur

not sure this is worth fixing, but thought i should file an issue in case 0.6.5 broke other people's code too. it used to be the case that you didn't have to be careful about filtering NaN out of the input to loess. now you do:

% julia --project=@temp
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.2 (2025-11-20)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org release
|__/                   |

(jl_O8aifR) pkg> add Loess@0.6.5
   Resolving package versions...
    Updating `~/.tmp/jl_O8aifR/Project.toml`
  [4345ca2d] + Loess v0.6.5
    Updating `~/.tmp/jl_O8aifR/Manifest.toml`
  [b4f34e82] + Distances v0.10.12
  [ffbed154] + DocStringExtensions v0.9.5
  [34004b35] + HypergeometricFunctions v0.3.28
  [92d709cd] + IrrationalConstants v0.2.6
  [692b3bcd] + JLLWrappers v1.7.1
  [4345ca2d] + Loess v0.6.5
  [2ab3a3ac] + LogExpFunctions v0.3.29
  [21216c6a] + Preferences v1.5.0
  [189a3867] + Reexport v1.2.2
  [79098fc4] + Rmath v0.9.0
  [276daf66] + SpecialFunctions v2.6.1
  [10745b16] + Statistics v1.11.1
  [82ae8749] + StatsAPI v1.7.1
  [4c63d2b9] + StatsFuns v1.5.2
  [efe28fd5] + OpenSpecFun_jll v0.5.6+0
  [f50d1b31] + Rmath_jll v0.5.1+0
  [56f22d72] + Artifacts v1.11.0
  [ade2ca70] + Dates v1.11.0
  [8f399da3] + Libdl v1.11.0
  [37e2e46d] + LinearAlgebra v1.12.0
  [de0858da] + Printf v1.11.0
  [9a3f8284] + Random v1.11.0
  [ea8e919c] + SHA v0.7.0
  [fa267f1f] + TOML v1.0.3
  [4ec0a83e] + Unicode v1.11.0
  [e66e0078] + CompilerSupportLibraries_jll v1.3.0+1
  [4536629a] + OpenBLAS_jll v0.3.29+0
  [05823500] + OpenLibm_jll v0.8.7+0
  [8e850b90] + libblastrampoline_jll v5.15.0+0

julia> using Loess

julia> loess([NaN32, NaN32], [NaN32, NaN32], span=1.0)
ERROR: ArgumentError: invalid argument #4 to LAPACK call
Stacktrace:
  [1] chklapackerror
    @ ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:38 [inlined]
  [2] gesdd!(job::Char, A::Matrix{Float32})
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/lapack.jl:1714
  [3] _svd!
    @ ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/svd.jl:125 [inlined]
  [4] svd!(A::Matrix{Float32}; full::Bool, alg::LinearAlgebra.DivideAndConquer)
    @ LinearAlgebra ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/svd.jl:105
  [5] svd!
    @ ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/svd.jl:100 [inlined]
  [6] svd(A::Matrix{Float32}; full::Bool, alg::LinearAlgebra.DivideAndConquer)
    @ LinearAlgebra ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/svd.jl:180
  [7] svd
    @ ~/.julia/juliaup/julia-1.12.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.12/LinearAlgebra/src/svd.jl:179 [inlined]
  [8] _loess(xs::Matrix{Float32}, ys::Vector{Float32}; normalize::Bool, span::Float64, degree::Int64, cell::Float64)
    @ Loess ~/.julia/packages/Loess/bO0BM/src/Loess.jl:124
  [9] _loess
    @ ~/.julia/packages/Loess/bO0BM/src/Loess.jl:34 [inlined]
 [10] #loess#13
    @ ~/.julia/packages/Loess/bO0BM/src/Loess.jl:178 [inlined]
 [11] loess
    @ ~/.julia/packages/Loess/bO0BM/src/Loess.jl:170 [inlined]
 [12] #loess#14
    @ ~/.julia/packages/Loess/bO0BM/src/Loess.jl:181 [inlined]
 [13] top-level scope
    @ REPL[3]:1

julia> versioninfo()
Julia Version 1.12.2
Commit ca9b6662be4 (2025-11-20 16:25 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 12 × Apple M2 Max
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m2)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_PROJECT = @.
  JULIA_EDITOR = vi
% julia --project=@temp                              
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.2 (2025-11-20)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org release
|__/                   |

(jl_OUVWyD) pkg> add Loess@0.6.4
   Resolving package versions...
j    Updating `~/.tmp/jl_OUVWyD/Project.toml`
⌃ [4345ca2d] + Loess v0.6.4
    Updating `~/.tmp/jl_OUVWyD/Manifest.toml`
  [b4f34e82] + Distances v0.10.12
⌃ [4345ca2d] + Loess v0.6.4
  [10745b16] + Statistics v1.11.1
  [82ae8749] + StatsAPI v1.7.1
  [56f22d72] + Artifacts v1.11.0
  [8f399da3] + Libdl v1.11.0
  [37e2e46d] + LinearAlgebra v1.12.0
  [e66e0078] + CompilerSupportLibraries_jll v1.3.0+1
  [4536629a] + OpenBLAS_jll v0.3.29+0
  [8e850b90] + libblastrampoline_jll v5.15.0+0
        Info Packages marked with ⌃ have new versions available and may be upgradable.
^R

julia> using Loess

julia> loess([NaN32, NaN32], [NaN32, NaN32], span=1.0)
Loess.LoessModel{Float32}(Float32[NaN; NaN;;], Float32[NaN, NaN], Dict{Vector{Float32}, Vector{Float32}}([NaN] => [NaN, NaN]), Loess.KDTree{Float32}(Float32[NaN; NaN;;], [1, 2], Loess.KDNode{Float32}(1, NaN32, Loess.KDNode{Float32}(1, NaN32, nothing, nothing), Loess.KDNode{Float32}(1, NaN32, nothing, nothing)), Set(Vector{Float32}[[NaN]]), Float32[NaN; NaN;;]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions