C
C
copyhold2018-07-27 07:49:06
Algorithms
copyhold, 2018-07-27 07:49:06

What is the name of the algorithm for counting visitors?

I have data as [{userid,time}]. Every 30 seconds I get a list of people that the sensor sees.
How to count unique visitors who stayed in the store for more than a minute? Given that if a person appeared now and after 10 minutes, then he is not considered a visitor, but a passerby.
In pursuit, how to calculate the average time a person spends in a store.
thanks in advance.
PS: what does the data look like

userid  1...2.................................2..1...1....1................................1.......................1....2333......................
time    часназад----------------------------------------------------------------------------------------------------------сейчас

in this case, 1.3 - are considered and 2 - no, because more than 10 minutes have passed between the appearances.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2018-07-27
@Rsa97

Make up an associative array like {id: time}.
Upon arrival of the data, go through all the people detected now, if such a person is not in the list, then add him to the array with the time.
Walk through the array. If a person is not in those detected now, then look at the time of the first detection and classify him as a visitor or passer-by, and then remove him from the array.

X
xmoonlight, 2018-07-28
@xmoonlight

Set difference
05a3f8afb80730a02f91fb84f3aa590573a4c961200px-Venn_A_setminus_B.svg.png x - new visitors
A - current set on the timeline.
B is the previous set on the timeline.
The "depth" of the analysis of "frames" (how many pairs in the chain we look at at a time) and the maximum time (transition from a passerby to a visitor) - you will choose yourself experimentally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question