# Suggestion needed: Tree like structure for adaptive binning of multidim data

**URL:** https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602
**Category:** Statistics
**Created:** [October 1, 2020, 2:59pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602 "2020-10-01T14:59:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)
#### Post date: [October 1, 2020, 2:59pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/1 "2020-10-01T14:59:22Z")

</div>

Hi everyone,

i need to perform adaptive binning of multidimensional data, in an online fashion.  
as far as i understand i need a dynamic kd-tree,

is there something in the julia ecosystem that implements a structure resembling what i need?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [October 1, 2020, 3:37pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/2 "2020-10-01T15:37:40Z")

</div>

Nothing that I’m aware of, but you might find something that suits your needs in

> **[GitHub - joshday/OnlineStats.jl: ⚡ Single-pass algorithms for statistics](https://github.com/joshday/OnlineStats.jl)**
>
> ⚡ Single-pass algorithms for statistics. Contribute to joshday/OnlineStats.jl development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![John\_Gibson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_gibson/32/5321_2.png) [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)
#### Post date: [October 1, 2020, 4:25pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/3 "2020-10-01T16:25:51Z")

</div>

There is KDTree in [GitHub - KristofferC/NearestNeighbors.jl: High performance nearest neighbor data structures and algorithms for Julia.](https://github.com/KristofferC/NearestNeighbors.jl).

---

<div class="post-metadata">

### Author: ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)
#### Post date: [October 1, 2020, 5:55pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/4 "2020-10-01T17:55:31Z")

</div>

Thank you both!  
unfortunately none of the suggestions apply…

OnlineStats offers no multidimensional adaptive tree,  
while NearestNeighbors offers only static trees…

Thank you anyway

---

<div class="post-metadata">

### Author: ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)
#### Post date: [October 1, 2020, 6:48pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/5 "2020-10-01T18:48:45Z")

</div>

How about [RegionTrees](https://github.com/rdeits/RegionTrees.jl)?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [October 1, 2020, 7:33pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/6 "2020-10-01T19:33:33Z")

</div>

I just remembered that I’ve actually implemented something along those lines before  
[https://github.com/baggepinnen/KalmanTree.jl](https://github.com/baggepinnen/KalmanTree.jl)  
I never ended up finishing it, but it could give you some hints if you’re ending up needing to implement something.

It adaptively splits the space into new cells as data arrives, and maintains a quadratic model of the data in each cell.

---

<div class="post-metadata">

### Author: ![francesco.alemanno](https://avatars.discourse-cdn.com/v4/letter/f/e8c25b/32.png) [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)
#### Post date: [October 2, 2020, 9:01pm UTC](https://discourse.julialang.org/t/suggestion-needed-tree-like-structure-for-adaptive-binning-of-multidim-data/47602/7 "2020-10-02T21:01:52Z")

</div>

both packages seem useful, i will look into it 🙂 thank you guys
