# Aggregate(/"vertical") stats?

**URL:** https://discourse.flucoma.org/t/aggregate-vertical-stats/237
**Category:** Usage Questions
**Created:** [June 29, 2019, 2:40pm UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237 "2019-06-29T14:40:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)
#### Post date: [June 29, 2019, 2:40pm UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237/1 "2019-06-29T14:40:35Z")

</div>

Are there any plans to expand the `fluid.bufstats~` paradigm to work with stats of stats?

As in, for the [database](https://discourse.flucoma.org/t/memory-hole-problem/226/21)/[querying](https://discourse.flucoma.org/t/descriptors-comparison-oldschool-vs-newschool/205/74) thing I’m building I have computed a whole load of stats for each sample, and then have them all jammed together in a single coll/text/json file.

I would like to then have some statistics on all of the _loudness_-es across the corpus (min/mean/max for normalization for example), and same goes for most other statistics.

For now this is mainly for input-\>corpus normalization, but I could see this being useful in general to know what’s “in there”.

At the moment I can `uzi` through all of the entries and `fluid.bufcompose~` them into a single buffer, then run some stats on that, but that can start to get real fiddly if I have to do this with loads of different statistics (my current corpus has 22 data points per sample).

I don’t know how this would work in the current `fluid.bufstats~` paradigm as it takes a single buffer as input. I guess being able to refer it to a named `polybuffer~` would be good, but that brings complications that have been mentioned elsewhere.

At the moment I’m using @a.harker’s alpha/beta `entrymatcher~` update which computes statistics for columns of data. This works well but doesn’t cover all the desired stats. Plus it means moving from buffer-\>list-\>buffer to get back to the `fluid.`-verse.

Is there an approach on the roadmap for something like this?  
Or better ideas on how to go about it?

---

<div class="post-metadata">

### Author: ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)
#### Post date: [June 30, 2019, 10:42am UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237/2 "2019-06-30T10:42:02Z")

</div>

i’m sure @weefuzzy will have some wisdom here, and there are definitely (for toolbox2) ways of dealing with this. It is actually the raison d’être of the whole project 😉

---

<div class="post-metadata">

### Author: ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)
#### Post date: [June 30, 2019, 1:56pm UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237/3 "2019-06-30T13:56:28Z")

</div>

It will be slightly fiddly at the moment, yes.

If you have `N` entries in your corpus, each of which has 22 data points that you wish to summarise, then you’ll need to compose a buffer `N` frames long, with 22 channels. I think what adds to the fiddleyness is that, if you’re starting from outside `buffer~` land, getting data in channel-wise rather than time-wise is harder (or at least feels harder). We can’t use jitter tricks so easily, because `jit.buffer~` uses planes for channels, rather than an extra dimension.  
Fundamentally: patcher languages make iteration a bit of a drag, and `buffer~` isn’t _really_ a 2D data structure as far as Max is concerned.

So, in this case I’d jump into `js`. The attached marshalls some data out of a `coll` and into a `buffer~` for further stats-y goodness.

[collbufcorral.zip](https://discourse.flucoma.org/uploads/default/original/1X/8a63a4ce08f54d55fb329fd08d5d67347b808cf1.zip) (161.1 KB)

---

<div class="post-metadata">

### Author: ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)
#### Post date: [June 30, 2019, 5:13pm UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237/4 "2019-06-30T17:13:20Z")

</div>

Cool, I’ll have a play with this and see if I can generalize it a bit more. (I don’t think I need all 22 stats-of-stats (nor am I sure which stats-of-stats I want (is there a name for stats of stats? (are they derivatives? (can you have a derivative of a derivative (without it being a 2nd order derivative?)))))).

---

<div class="post-metadata">

### Author: ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)
#### Post date: [June 30, 2019, 5:47pm UTC](https://discourse.flucoma.org/t/aggregate-vertical-stats/237/5 "2019-06-30T17:47:37Z")

</div>

> [@rodrigo.constanzo](#):
>
> Cool, I’ll have a play with this and see if I can generalize it a bit more.

Hope it’s useful. I think there’s a mistake, in that it runs `bufstats~` too many times (once per  
`coll` entry ), but that’s simple enough to fix.

```

----------begin_max5_patcher----------
1782.3ocyZszaiaCD9ryuBBidnEHMUjh5g6o1a8RQOziaWXPIQ6vrRjBRTYy
tK182d4CIEIGKGZY4ra.hEzPRwY9lgyLbH+xMqVmHdhVuF76f2AVs5K2rZkg
jlvp12Wstf7TZNo1zs0Ez5Zxd55assIoOIMzSyojpNp7lBFOmJMCA0RrV9ob
pouccikYdUj7vuFNXnhFY2XgsTKIxz6Y78aqnoRK6BiP24cKHNP+qej9WjhB
38sCw9UjepjZ6+50f2qa4q2bi9macTd4zOp3uWHtBNMgv2OeAFdbAFMs.irx
H1HvvvfWWhsbX6yYI8ohhBJW9BwuVRj0+yt+U+.TeunIOCjPUrCH8dBmSyqA
hcfHvtJhxfoa34LNMUzvkCkzQPGzEnKZywwNuowt.C14i1XwtPya9ZraFfRR
iTJ3qmO+Ge1F6VcuO12ZBz86qn5WRC9c4Mrr6RZ1YT8eC7G0hlpTJntonfT8
I06VagAFFGUs6OeXyatKYhL5aHxrjAuwkkLKJ1oPsczpucTv47wgvMy.GLF9
Heq8OzAuk6xED4k47XBzHUjmCxRt..XhfE3oA.eDzH4XijG3cWvqFs31A+22
sZxizrsJlP8k2RjxJlxYfM.5pdTX0ZZQB0vudFBFbagPOIHqonDjS46k2eAX
Xv4aDAMqehL+F6+5lPZFUCes75hF.5unUY.FWJ5c.YWj8e7e9ffPPODtMNzu
rvAhBwmcfHDN13IO7Gg.QgnyOPj0Hvx+W2.QSo5+axGTgcDETPFQRTJbiFVw
hohpLiJWYA7HIuYJE97CAE5M6LOL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iLQmE2UgKBbjIBuh7Pni7v0zh3rbyBOJSzRrqZmtdrmmUQn1mKRH
4skXpuDkmphTOW1pE+TUGU4jYb3IX7LqdNLBaKW7c95+PuoGfR+8RvdDpy+v
C7m+URncKEdvumWIgGpA5akfBOREUUj76TDtXPAMWahNLI.cNGohiqQ0GwR+
psCE59kZkD8AlKoUasEi9BuKCW5AUuYtWXJuua2WpK9VtfN6K4RqGEbaEqCu
ai9Oz2sa5h4aMdGDV.8vHZsv5oilNUJEi5ygYDFC0IABaKEcX+KSnockwvXW
3rA6fX1yT.xgYJH9Tf.J1jVLDac3N3skf2vuBuEFtDnPrCnf+lEXlBcAuCCV
hYJX3FelRyhVfYJxyAYJJdAloMtXrBWfIB4xBvkXhft.cdKgDo9F9NHPvI80
oBvg6b364aKTqYmvl2VBq0KxWLRweWCewAP24rKVC8ZyCFuPSDzkIBNZhrga
O3pxnmiCthLGb8Xd4UiY5qEygWIF0L+0a9evLpydH
-----------end_max5_patcher-----------

```

> is there a name for stats of stats?

maybe pooled statistics, not sure, for my stats know-how is pretty bad

> are they derivatives?

Not in the usual mathematical sense. A derivative is an expression of how one thing changes with respect to another

> can you have a derivative of a derivative (without it being a 2nd order derivative?)

That’s what a higher order derivative is (glossing over the whole messy business of derivatives in multiple dimensions)
