You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that one of the main reasons for constructing the KDTree is to have a more efficient way of computing distances but right no all n distances are computed for each node, see
I think the neighborhood size q = ceil(Int, (span * n)) is typically such that this brute force approach is fine.
The brute force approach is O(kn) where k is the number of vertices. We could probably use the kd-tree to lookup for each point which vertices' neighborhoods it resides in. But I think points will be in an average of span*k neighborhoods (where span=0.75 by default). This will end up being something like O(n*(log(k) + span*k)) = O(kn), so it's not an asymptotic improvement as long as neighborhoods are defined proportionally like this. If span is small, it might be practically more efficient though.
This is actually mentioned briefly in the original paper. The purpose of KD-tree is not to help with the nearest neighbor calculation. Maybe it's possible to improve here but I don't think my original thinking here is correct so I'll close.
It seems that one of the main reasons for constructing the KDTree is to have a more efficient way of computing distances but right no all
n
distances are computed for each node, seeLoess.jl/src/Loess.jl
Lines 81 to 84 in 9127229
O(log(n))
instead ofO(n)
.The text was updated successfully, but these errors were encountered: