Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Show waiting times/traffic for each location #523

Open
cirex-web opened this issue Sep 29, 2024 · 2 comments
Open

[Feature] Show waiting times/traffic for each location #523

cirex-web opened this issue Sep 29, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@cirex-web
Copy link
Contributor

cirex-web commented Sep 29, 2024

Description

can be implemented through (but not limited to)

  • card swipes
    image

  • Grubhub orders

  • crowdsourced data

Designs

No response

@cirex-web cirex-web added the enhancement New feature or request label Sep 29, 2024
@GhostOf0days
Copy link
Member

For reference, I copied this from the Slack, but implementing this will require probability theory. For GrubHub orders, the following can be slightly modified to also incorporate them. The difference between the first and third is the first will give more data, so we converge to the true value using the law of large numbers faster. See below:

This goes into probability theory, but the expected number of people that are at a restaurant/location in a given time period given sufficient samples is the expected value of a Poisson distribution. The estimated wait time until arrival is found through exponential distribution. If we define an arrival as the time when we get our order filled, we can find our estimated wait time as E[X^2]/2E[X] (called a residual life). Essentially, E[X] would be 1 over the number of orders filled per minute (expected value for an exponential distribution). E[X^2] = 2/((the number of orders filled per minute)^2). This can be found experimentally through observation. If we sample E[X] at certain intervals (say 10 minutes), we can continuously update E[X] to be (sum of values of E[X])/number of time intervals sampled (similar method for E[X^2]), and update the equation for expected wait time (E[X^2]/2E[X]) continuously through crowdsourcing. As the number of samples increases, E[X] should also get closer to its true value. This gives the expected time for the next order to be filled. Then multiply this by the average number of people in the line across all samples taken (this part should work in theory because the exponential distribution is memoryless; waiting time at time A should be same as some time later until we update our samples, i.e., whenever new data comes in). When new data comes in, we can replace the old waiting time with the new waiting time.

This should give good estimates for when there’s no one providing data.

Btw, if anyone’s wondering how to get the formulas for expected values E[X] and E[X^2] for exponential distribution, the probability density function (pdf) of the exponential distribution is lambda * e ^ ((-lambda)(x)). Take the integral from 0 to infinity w.r.t. x of x^n * the pdf I just defined, where n is found from E[X^n] (also called the nth moment). Lambda is the number of orders filled per minute.

If you are confused on this math, please lmk.

@GhostOf0days
Copy link
Member

GhostOf0days commented Sep 29, 2024

The 2nd (grubhub) would be in addition to 1 (card swipes) or 3 (experimental data collection). 1st (card swipes) would just mean much easier to gather samples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants