Skip to content

Commit

Permalink
fix "Encountering NaN when fitting Vectors with CCIPCA" joshday#291
Browse files Browse the repository at this point in the history
  • Loading branch information
hv10 committed Nov 22, 2024
1 parent 629b108 commit b2ddaf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stats/pca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ function _fit!(o::CCIPCA, x::AbstractVector{<:Real})
@inbounds for i in 1:outdim(o)
if i == n
o.lambda[i] = norm(o.xi)
o.U[:, i] = o.xi / o.lambda[i]
o.U[:, i] = o.xi / (o.lambda[i]+OnlineStats.ϵ)
break
end
o.v = (1-f) * o.lambda[i] * o.U[:, i] + f * dot(o.U[:, i], o.xi) * o.xi
o.lambda[i] = norm(o.v)
o.U[:, i] = o.v/o.lambda[i]
o.U[:, i] = o.v/(o.lambda[i]+OnlineStats.ϵ)
o.xi = o.xi .- (dot(o.U[:, i], o.xi) * o.U[:, i])
end
o.n = n
Expand Down

0 comments on commit b2ddaf3

Please sign in to comment.