I have a historical list of reports, made by users, containing what happened (taken from a list) and the time when the report was filed. And I would like to fit the data with some joint time-semantics machine learning model. The final output I would like to obtain is a list of probabilities, something like "what is the probability of X now". I have only superficial knowledge on machine learning (basic user), so I ask for suggestions about which model should I use.

The problem is equivalent to the following example (the beach example is not real, it just has the same characteristics as the real problem):

The users of a small beach want to know the probability of finding something annoying before deciding whether to go sunbathing or hiking. So the users set up an app with a defined list of annoying things, for sharing reports. The users' reports would look like this:

2024-04-29 06:32 beach_cleaning_machine
2024-04-29 07:16 dog_fight
2024-04-29 08:30 loud_music
2024-04-29 08:36 dog_fight
2024-04-29 08:49 loud_music
2024-04-29 12:21 overcrowded
2024-04-29 14:15 loud_music
2024-04-29 14:43 loud_music
2024-04-29 16:20 overcrowded
2024-04-29 21:45 loud_music
2024-04-29 21:45 noisy_binge_drinking
2024-04-30 09:36 dog_fight

This is how far I got with the thinking (no actual coding yet):

  1. From the data in the example, the reports at 8:30 and 8:49 likely refer to the same problem (as well the ones at 14:15 and 14:43). So I would group the reports by the hour. Following the example after this grouping, loud_music would be "positive" at hours 8 AM, 2 PM and 9 PM for the day 2024-04-29.

  2. Also, for simplicity (and lack of a better alternative), I would assume that if nobody reported an event, it didn't happen (e.g. if there is loud_music at 4 AM, but nobody reported it, we will assume that there was no loud_music there). So, following the example, the loud_music was "negative" at all the hours that were not considered as "positive".

  3. From what I saw, usually datasets for ML have entries for the negative events as well. But in our case, we only have reports from the users when the thing IS happening. If the negative is needed, the negative cases could be generated by taking the complement of the positive cases (as the positive cases are quite diluted, the generated negative ones would be a very large amount, but that should not be a problem).

  4. The day of the week should be considered: The situation on a beach on Tuesdays would be very different from the one on Saturdays. And the same for the day of the year (e.g. day 1 would be in January, day 200 would be in July).

  5. The information about whether a day is a bank holiday should be added manually, as this is expected to have an impact.

  6. The year is not interesting (we have reports since Sept. 2022). The lower amount of reports in the first year should not be considered a sign that less things were happening. Rather, it was due to the lower popularity of the reporting app.

  7. Each semantic (e.g. loud_music) could be fitted separately, avoiding the complications of a joint time+semantic model. This would work. Still, I would expect a better result when fitting everything together, as some things have similar behaviour (e.g. loud_music with noisy_binge_drinking). But I have no idea if such a model is too much more complicated...

  8. Different users could dislike different things. For example, somebody could be frightened by dog_fight but could be okay with overcrowded. So the output should show the likeliness of each possible kind of event separately.

  9. The most useful output of the model would be a list of probabilities for each annoying thing at the current time. The user would then decide if the probabilities are too high of having a bad time. For example:

Probabilities for the current hour (2024-04-30 12:00)

  • beach_cleaning_machine 0%
  • dog_fight 10%
  • loud_music 30%
  • noisy_binge_drinking 5%
  • overcrowded 80%

  1. If probabilities are too complicated to obtain, a qualitative "very likely", "likely", "unlikely" output would also be good.

You can see the actual data here:

JSON 552 KB https://sprunge.us/WZJy8I

As you can see, there are more than 400 possible alert_id (in the beach example, these would represent 400 different possible annoying things) but only 189 have been actually reported. We can simply give zero probability to all the alert_id that were not reported yet.

Which model would you recommend me?

  • $\begingroup$ Trying to access that URL using Firefox leads to: "503 Service Unavailable, No server is available to handle this request." $\endgroup$
    – J_H
    Commented May 2 at 17:18
  • $\begingroup$ Something very weird is happening on the server. Clicking the link does not work, but then copying and pasting the same URL works. I have no root access to investigate further. I edited adding the zip file, I hope it works. $\endgroup$ Commented May 2 at 17:38
  • $\begingroup$ Neither the zip file worked, I added the link to a pastebin service. If anyone wants to investigate the superweird problem with the old link, here you have the "weirdly broken" one: uz.sns.it/~ilario/20240502-alerts.json $\endgroup$ Commented May 2 at 17:45

1 Answer 1


What about using a Bayesian Classifier?


  1. Define as many features as you need. I mean, inner definitions of the data you want to study: moment of the day (ranges of hours: morning, afternoon...), by month, by day of the week, by holiday...
  2. Iterate over the data to create your dataset. Ex: for the output "beach_cleaning_machine" and the record "2024-04-29 06:32 beach_cleaning_machine" you can set [dawn=1, morning=0, noon=0, January=0, February=0, April=1, May=0, holiday=0, workday=1, weekend=0...]
  3. Now you can train your model for each event.

Does it make sense for you?

  • $\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Commented May 13 at 4:27

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.