Answers.Body: <p>This is exactly what a “classifier” does.</p>
  <p>“Classification” problems often get talked about as choosing one of several categories. However, most classifiers, neural networks included, actually output values on a continuum. Software functions might output the category corresponding to the highest predicted value on that continuum, but that is not actually part of the neural network.</p>
  <p>The key point is that, despite having outcome data that are categorical, the predictions are on a continuum.</p>
  <p>One irritating point is that neural networks are notorious for being overconfident in their predictions, meaning that the values returned, despite being in <span class="math-container">$(0,1)$</span>, arguably are not probabilities. This is a matter of either calibrating your miscalibrated neural network or using a model like logistic regression that is more likely to produce good calibration.</p>
  <p>(“Calibrated” probability means that an event predicted to occur with probability <span class="math-container">$p$</span> actually happens <span class="math-container">$100p\%$</span> of the time.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-13T21:09:14.580Z
Answers.LastActivityDate: 2022-10-13T21:09:14.580Z
Answers.UserDisplayName: Dave
Answers.Body: <p>Given your sequences you can frame the problem as sequence classification where the input is the sequence leading up to a time interval and the output is the probability of an event occurring in that interval. Use a recurrent neural network (RNN) or LSTM to model the sequences and train it as a classification problem. Monitor for overfitting and consider using techniques like early stopping and regularization.
  if only you could provide a more detailed explanation.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-06T22:13:08.893Z
Answers.LastActivityDate: 2024-04-06T22:13:08.893Z
Answers.UserDisplayName: mak_97
Answers.Body: <p>The post states that the period is exactly <code>1</code> and that there is some noise.  Since you have thousands of numbers in the sequence, you should be able to construct a robust probability density function (pdf) to model the time interval between events.  This can be done by subtracting consecutive numbers in the time series.  Once you have done that, you can construct an empirical pdf, which can then be used to ask almost any question you want.</p>
  <ul>
  <li>What is the probability that the next event will occur between some time interval?</li>
  <li>What is the expected value of the time of the next event?</li>
  </ul>
  <p>Note that the average of the time intervals should be <code>~1</code> if the data are in fact periodic with a true period of <code>1</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-13T06:12:27.023Z
Answers.LastActivityDate: 2022-11-13T06:12:27.023Z
Answers.UserDisplayName: Snehal Patel
Answers.Body: <p>You can set up a neural network to predict whether there is an event in a randomly picked interval. I.e. if there is an event in this interval in your trainingsdata you train to output a 1 otherwise you train to output a 0. </p>
  
  <p>If you use the quadratic loss function the prediction of the NN should approximate the probability of such an event. </p>
  
  <p>Overfitting can be monitored with by splitting your trainingsdata into train- and testset. </p>
  
  <p>If you train an RNN by inputting the intervals between events, these intervals should be more similar than the exact event times. Modelling a time series like this also makes more sense. </p>
  
  <p>Of course these details depend on what exactly the data is representing. And it is also possible that decent predictions are impossible for this dataset. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-27T14:07:54.673Z
Answers.LastActivityDate: 2020-01-27T14:07:54.673Z
Answers.UserDisplayName: BlindKungFuMaster
Body: <p>I've got a few thousands of sequences like</p>
  
  <pre><code>1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  </code></pre>
  
  <p>where the numbers denote times on which an event happened (there's just a single kind of events). The events are sort of periodical and the period is <em>known to be exactly</em> one, however, the  exact times varies. Sometimes, events are missing and there are other irregularities, but let's ignore them for now.</p>
  
  <p>I'd like to train an neural network for predicting the probability that there'll be a next even in a given time interval. The problem is that I have no probabilities for the training.</p>
  
  <p>All I have are the above sequences. If I had four sequences like</p>
  
  <pre><code>1.23, 2.15. 3.19, 4.30, 5.24, 6.05
  1.23, 2.15. 3.19, 4.30, 5.24, 6.83
  1.23, 2.15. 3.19, 4.30, 5.24, 6.27
  1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  1.23, 2.15. 3.19, 4.30, 5.24, 6.17
  </code></pre>
  
  <p>then I could say that the probability of an event in the interval <code>[6.10, 6.30]</code> is 60% and use this value for learning. However, all my sequences are different. I could try to group them somehow so that I can define something like a probability, but this sounds way more complicated than what I'm trying to achieve.</p>
  
  <p>Instead, I could try to use the sequence</p>
  
  <pre><code>1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  </code></pre>
  
  <p>to learn that after the prefix <code>1.23, 2.15. 3.19, 4.30, 5.24</code>, there will be an event in the interval <code>[6.10, 6.30]</code> for sure (value to learn equal to one); if there was 6.05 instead of 6.22, the value to learn would be zero. A learned network would produce the average value (let's say 0.60).</p>
  
  <p>However, the error would never converge to zero, so there'd be no quality criterion and probably a big chance of overtraining leading to non-sense results.</p>
  
  <p>Is there a way to handle this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-15T19:32:35.337Z
Comments.Text: Could you help us refine your problem statement? Given a time series $(t_0, t_1, ..., t_n)$ as input, do you want the neural network to predict whether there will be an event in the interval $[t_n, t_{n+\tau}]$, with $\tau$ fixed for all predictions? Or do you want the neural network to predict the probability that an event will occur in $[t_1, t_2]$, for any $t_1$ an $t_2$ given as input? Or is it something else?
Comments.UserDisplayName: Raphael Lopez Kaufman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-13T05:27:32.920Z
Comments.Text: I agree with @Raphael Lopez kaufman that the question, as it stands, is not clear.  Please revise your post according to his request.
Comments.UserDisplayName: Snehal Patel
Tags: <neural-networks><prediction><probability>
Title: Predicting probabilities of events using neural networks
UserDisplayName: maaartinus
ThreadText: # Predicting probabilities of events using neural networks
  
  (Asked by: username_0 on 2020-01-27)
  
  I've got a few thousands of sequences like
  1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  
  where the numbers denote times on which an event happened (there's just a single kind of events). The events are sort of periodical and the period is known to be exactly one, however, the  exact times varies. Sometimes, events are missing and there are other irregularities, but let's ignore them for now.
  I'd like to train an neural network for predicting the probability that there'll be a next even in a given time interval. The problem is that I have no probabilities for the training.
  All I have are the above sequences. If I had four sequences like
  1.23, 2.15. 3.19, 4.30, 5.24, 6.05
  1.23, 2.15. 3.19, 4.30, 5.24, 6.83
  1.23, 2.15. 3.19, 4.30, 5.24, 6.27
  1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  1.23, 2.15. 3.19, 4.30, 5.24, 6.17
  
  then I could say that the probability of an event in the interval [6.10, 6.30] is 60% and use this value for learning. However, all my sequences are different. I could try to group them somehow so that I can define something like a probability, but this sounds way more complicated than what I'm trying to achieve.
  Instead, I could try to use the sequence
  1.23, 2.15. 3.19, 4.30, 5.24, 6.22
  
  to learn that after the prefix 1.23, 2.15. 3.19, 4.30, 5.24, there will be an event in the interval [6.10, 6.30] for sure (value to learn equal to one); if there was 6.05 instead of 6.22, the value to learn would be zero. A learned network would produce the average value (let's say 0.60).
  However, the error would never converge to zero, so there'd be no quality criterion and probably a big chance of overtraining leading to non-sense results.
  Is there a way to handle this?
  
  **Tags:** neural-networks, prediction, probability
  > **Comments:**
  > **username_1**: Could you help us refine your problem statement? Given a time series $(t_0, t_1, ..., t_n)$ as input, do you want the neural network to predict whether there will be an event in the interval $[t_n, t_{n+\tau}]$, with $\tau$ fixed for all predictions? Or do you want the neural network to predict the probability that an event will occur in $[t_1, t_2]$, for any $t_1$ an $t_2$ given as input? Or is it something else?  
  > **username_2**: I agree with @Raphael Lopez kaufman that the question, as it stands, is not clear.  Please revise your post according to his request.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_3 on 2022-10-13. Score: 0
  
  This is exactly what a “classifier” does.
  
  “Classification” problems often get talked about as choosing one of several categories. However, most classifiers, neural networks included, actually output values on a continuum. Software functions might output the category corresponding to the highest predicted value on that continuum, but that is not actually part of the neural network.
  
  The key point is that, despite having outcome data that are categorical, the predictions are on a continuum.
  
  One irritating point is that neural networks are notorious for being overconfident in their predictions, meaning that the values returned, despite being in $(0,1)$, arguably are not probabilities. This is a matter of either calibrating your miscalibrated neural network or using a model like logistic regression that is more likely to produce good calibration.
  
  (“Calibrated” probability means that an event predicted to occur with probability $p$ actually happens $100p\%$ of the time.)
  
  
  ---
  
  ### Answer by username_4 on 2024-04-06. Score: 0
  
  Given your sequences you can frame the problem as sequence classification where the input is the sequence leading up to a time interval and the output is the probability of an event occurring in that interval. Use a recurrent neural network (RNN) or LSTM to model the sequences and train it as a classification problem. Monitor for overfitting and consider using techniques like early stopping and regularization.
  if only you could provide a more detailed explanation.
  
  
  ---
  
  ### Answer by username_2 on 2022-11-13. Score: 0
  
  The post states that the period is exactly `1` and that there is some noise. Since you have thousands of numbers in the sequence, you should be able to construct a robust probability density function (pdf) to model the time interval between events. This can be done by subtracting consecutive numbers in the time series. Once you have done that, you can construct an empirical pdf, which can then be used to ask almost any question you want.
  
  * What is the probability that the next event will occur between some time interval?
  * What is the expected value of the time of the next event?
  
  Note that the average of the time intervals should be `~1` if the data are in fact periodic with a true period of `1`.
  
  
  ---
  
  ### Answer by username_5 on 2020-01-27. Score: 0
  
  You can set up a neural network to predict whether there is an event in a randomly picked interval. I.e. if there is an event in this interval in your trainingsdata you train to output a 1 otherwise you train to output a 0.
  
  If you use the quadratic loss function the prediction of the NN should approximate the probability of such an event.
  
  Overfitting can be monitored with by splitting your trainingsdata into train- and testset.
  
  If you train an RNN by inputting the intervals between events, these intervals should be more similar than the exact event times. Modelling a time series like this also makes more sense.
  
  Of course these details depend on what exactly the data is representing. And it is also possible that decent predictions are impossible for this dataset.
  
  
  ---
  
  