我运行以下查询,获取每个类别的平均喜好
neo4j-sh (?)$ START n=node:node_auto_index(type = "U") match n-[r:likes]->()-[:mapsTo]->items return AVG(r.count) as AVGLIKES, items.name as CATEGORY;
==> +------------------------------------------------------+
==> | AVGLIKES | CATEGORY |
==> +------------------------------------------------------+
==> | 7.122950819672131 | "Culture" |
==> | 1.3333333333333333 | "Food & Drinks" |
==> | 2.111111111111111 | "Albums" |
==> | 2.581081081081081 | "Movies" |
==> | 2.1 | "Musicians" |
==> | 7.810126582278481 | "Culture Celebs" |
==> | 3.1206896551724137 | "TV Shows" |
==> | 1.0 | "Apps/Games" |
==> | 4.0256410256410255 | "Cars" | 但是AVG是一个内置的函数,如何计算每个类别的标准差和其他统计摘要。我正在寻找类似SQL中的"GROUP“之类的东西,它将对每个类别的所有内容进行分组,然后我可以编写一些代码,或者如果有更好的方法来实现它。
发布于 2013-06-04 19:47:59
去年末,我添加了percentile_disc、percentile_cont聚合函数。我想他们会愿意合并到std开发的函数中。理论上(我认为,我的统计数据是生锈的),你可以根据一些百分位数的样本和平均值来计算标准差。那么,除了标准差,你还在找什么?
更新:我请求stdev/stdevp聚合函数:https://github.com/neo4j/neo4j/pull/859
https://stackoverflow.com/questions/16922560
复制相似问题