mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
implement merging for top-k.
I am not (entirely) sure that this is mathematically correct, but I am (more and more) getting the feeling that it... might be. In any case - this was the last step and now it should work in cluster settings.
This commit is contained in:
parent
6f863d2259
commit
2f48008c42
7 changed files with 173 additions and 8 deletions
|
@ -4,3 +4,7 @@ error: getCount for element that is not in top-k
|
|||
error: getEpsilon for element that is not in top-k
|
||||
error: getCount for element that is not in top-k
|
||||
error: getEpsilon for element that is not in top-k
|
||||
error: getCount for element that is not in top-k
|
||||
error: getEpsilon for element that is not in top-k
|
||||
error: getCount for element that is not in top-k
|
||||
error: getEpsilon for element that is not in top-k
|
||||
|
|
|
@ -35,3 +35,23 @@
|
|||
5
|
||||
4
|
||||
[c, e, d]
|
||||
6
|
||||
0
|
||||
5
|
||||
0
|
||||
4
|
||||
0
|
||||
[c, e]
|
||||
6
|
||||
0
|
||||
5
|
||||
0
|
||||
0
|
||||
0
|
||||
[c, e]
|
||||
12
|
||||
0
|
||||
10
|
||||
0
|
||||
0
|
||||
0
|
||||
|
|
|
@ -87,6 +87,34 @@ event bro_init()
|
|||
topk_add(k1, "f");
|
||||
s = topk_get_top(k1, 3);
|
||||
print s;
|
||||
print topk_count(k1, "c");
|
||||
print topk_epsilon(k1, "c");
|
||||
print topk_count(k1, "e");
|
||||
print topk_epsilon(k1, "d");
|
||||
print topk_count(k1, "d");
|
||||
print topk_epsilon(k1, "d");
|
||||
|
||||
local k3 = topk_init(2);
|
||||
topk_merge(k3, k1);
|
||||
|
||||
s = topk_get_top(k3, 3);
|
||||
print s;
|
||||
print topk_count(k3, "c");
|
||||
print topk_epsilon(k3, "c");
|
||||
print topk_count(k3, "e");
|
||||
print topk_epsilon(k3, "e");
|
||||
print topk_count(k3, "d");
|
||||
print topk_epsilon(k3, "d");
|
||||
|
||||
topk_merge(k3, k1);
|
||||
|
||||
s = topk_get_top(k3, 3);
|
||||
print s;
|
||||
print topk_count(k3, "c");
|
||||
print topk_epsilon(k3, "c");
|
||||
print topk_count(k3, "e");
|
||||
print topk_epsilon(k3, "e");
|
||||
print topk_count(k3, "d");
|
||||
print topk_epsilon(k3, "d");
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue