I want to know if this problem can/should be solved using machine learning? If I can and I should, what resources or next steps should I take ? Which approach seems to fit ?


There are 500,000 buildings, and at any given moment there could be anywhere from 0 to 10 people in a building. There is a population of 10,000,000 people. The people can come and go from the buildings as they please, but certain people will typically be at certain buildings at certain times (certain hour ranges, certain days of the week). A given person can be in 0 or 1 building at any given time, where ~95% of the time they will not be in a building.

There exists a mechanism which can identify all the people in a building and log the occupants at that moment. The log history can be examined, and given two snapshots in time, it can be identified which people have left and which have entered (and likewise remained). The change in the number of people (left+entered) from the previous snapshot shall be called the churn. The act of searching a building costs time


Maximize the rate of identifying the buildings of as much of the population as possible.


Once I get a good model with this limited information I would like to include more parameters/variables such as a buildings public rating. What language is spoken at the building, etc.


I believe re-enforcement learning may be applicable here because the churn is the reward and the search is the punishment. Imagine a building that almost never has people in it, scanning the building and finding no difference (0 people before, 0 people after) is costly. Scanning a popular building (always 10 people) but the occupants never change is almost as bad as scanning a building that typically never has people because the amount of population covered is either 0 or 10. However, scanning a popular building with high churn will yield more information about the whereabouts of more of the population through time. Just as important is the frequency of scanning the same building, because if you scan a building over and over within a minute, not much churn will have occurred.

If I was to solve this programmatically, perhaps I would assign a scanning cool down value to each building. Each buildings cool down would decrease through time and once it hit 0 or below, it would be suitable for re-scan. Re-scanning would reset it's cool down to its "delta cooldown". I would need to know some good min/max/avg cool down delta, such that buildings that had high churn would approach the minimum cooldown delta (so they are scanned more frequently) and buildings with little churn would approach the maximum cooldown (scanned less often, but probably not never again). I don't feel like this is the best approach and it's not exactly easy. I could probably think about this longer and come up with something, but in reality I want an excuse to learn more about machine learning.


I think approach would focus on the buildings with the highest churn and not have much new "discovery". This is especially true for my programmatic approach. Consider a building that gets scanned initially 10 times and every time had no churn. Over the course of time it may get popular (or have some sort of seasonality to it) that it never gets picked up because the algorithm is too busy focusing on previously scanned high churn rooms. I think this concern might be alleviated just by having a programmatic/random portion which adds data back in some % of the time, or alternatively give the machine learning a short memory time span.


I just spent all this time typing this up and I realized this is basically a search crawling problem, figuring out which sites to crawl and how often. Hopefully that will direct me in numerous approaches that are simple enough (I just need something basic that will probably be better than a programmatic approach)

  • $\begingroup$ how is this related to a real project? $\endgroup$
    – carlo
    Commented May 25, 2020 at 11:41
  • $\begingroup$ The buildings are chat rooms and the people are users. I am trying to give an outlook of which chat rooms a user spends their time and which chat rooms they visit. There are far too many users and chat rooms to know it all. $\endgroup$
    – ParoX
    Commented May 25, 2020 at 13:37

2 Answers 2


I have some doubts about your ultimate goal - You want to identify if the residents are at home or not and from there get an id of witch building they are into ? On the concerns you have raised, you didn't mention the one where the difference of the snapshots is zero, but the individuals inside are all different (3 went out 3 went in). This will give you the illusion of no change while there was a big change. Because the act of going in or going out should be related to the individuals itself, although at 1st sight I get the idea that you don't give different preferences / behaviors to each.

However I would suggest that you can use AI and more specifically Multi-Agents systems. I don't know your level of coding, but if limited or if you still prefer and easy to integrate software I would recommend Netlogo.

I would start by creating the 2 main breeds of agents that you have mentioned:

  • Buildings
  • Population

From there you might wish to separate into groups of different behaviors.

  1. Individual that don't go out
  2. Individuals that go out

And different type of buildings

  1. High scrun
  2. Medium scrum
  3. Low scrum

Well, the way I do my models is by giving probabilities for the different actions and creating the possible interaction between agents of the same and different breeds.

As I said at the beginning, I am not sure of your ultimate goal, but you won't lose anything about having a look.


  • $\begingroup$ Thanks for the suggestion. Just to note, 3 people leaving and 3 people entering would be a "churn" of 6. I have unique identification for each person so if at snapshot 0 I have people (A,B) and snapshot 1 I have people (B,C,D) I know that A left, and C and D joined. $\endgroup$
    – ParoX
    Commented May 25, 2020 at 13:39

You are correct, that this may be viewed as a problem where we are trying to optimize our data gathering process. Similar approaches are often used in practice, e.g. Bayesian optimization is used for suggesting the hyperparameter values to be tried, when searching for best parameters, or for designing experiments, or clinical trials (see e.g. Villar et all, 2015, or Aziz et al, 2019 for some examples), Bayesian search is a special case of Bayesian optimization that is used when a vessel is lost on the sea and we need to shrunken the search area to the most promising area to speed up search and rescue, the area of machine learning where an algorithm decides about learning process is called active learning and there is an incoming book on this by Robert Munro. You can dig deeper into those links for some inspirations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.