简体   繁体   English

检查队列中的用户:管理优先级的算法?

[英]Checking Users in a Queue: Algorithm for managing Priority?

Let's say I have a large set of users in a queue that I query each user against a rate-limited API periodically.假设我在队列中有大量用户,我定期根据速率受限的API 查询每个用户。 Once all users have been queried, the process is restarted.查询完所有用户后,将重新启动该过程。 The rate limit is applied such that I cannot check all users within a reasonable amount of time (> 1 day to check everyone).应用了速率限制,因此我无法在合理的时间内检查所有用户(> 1 天检查每个人)。

Every time I check a user, I am able to check when they were last active.每次我检查用户时,我都可以检查他们上次活动的时间。 If a user has been actively recently (let's say last few days), then they should have priority over users that have not been active at all (> a year).如果用户最近一直活跃(比方说最近几天),那么他们应该优先于根本不活跃(> 一年)的用户。 However, the probability of an inactive user being queried should still be more than 0. Are there any existing research/methods on how to manage this queue efficiently?但是,不活跃用户被查询的概率应该仍然大于 0。是否有关于如何有效管理此队列的现有研究/方法?

Currently what i'm thinking is doing a simple priority queue and have user's initial value be the time they were last active.目前我在想的是做一个简单的优先级队列,并让用户的初始值是他们上次活动的时间。 Any time a user is queried, their position in the queue is replaced with the date they are last active + some random number generated from a distribution so that all users can be checked eventually.任何时候查询用户时,他们在队列中的位置都会被替换为他们上次活跃的日期+从分布中生成的一些随机数,以便最终可以检查所有用户。

After some thought I decided to use a bayesian model to infer each user's time between events.经过一番思考,我决定使用贝叶斯模型来推断每个用户在事件之间的时间。 I assume that each user's amount of activity within a time-period follows a poisson distribution.我假设每个用户在一个时间段内的活动量遵循泊松分布。 It follows that the time between each event follows an exponential distribution.因此,每个事件之间的时间遵循指数分布。 For the rate parameter, i assumed it to be gamma distributed.对于速率参数,我假设它是伽马分布的。 Therefore, the posterior distribution is a lomax distribution.因此,后验分布是 lomax 分布。 For every user I add to the queue, I sampled from the posterior as their new priority #.对于我添加到队列中的每个用户,我从后验采样作为他们的新优先级#。 When a user has a recent activity, i update their user-specific hyperparameters and then resample a new priority value.当用户有最近的活动时,我更新他们特定于用户的超参数,然后重新采样一个新的优先级值。 This allows me the flexibility to adjust each user's priority based on data as well as set priors for new users that i dont have any information on.这使我可以根据数据灵活地调整每个用户的优先级,并为我没有任何信息的新用户设置优先级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM