Answers.Body: <p>This is a question of <em>time series forecasting</em>, since your numbers form a sequence.
  You may want to take a look at <a href="https://stats.stackexchange.com/questions/tagged/forecasting">the &quot;forecasting&quot; tag at CrossValidated</a>.</p>
  <p>If you have only 700 data points, ML/AI methods will likely not be very useful. Whatever you do, I would recommend you benchmark your chosen method against very simple approaches, like the overall mean, or the last observation (a &quot;random walk forecast&quot;), or a simple Exponential Smoothing method. These very simple benchmarks can often be surprisingly hard to beat, and they are trivially easy to set up.</p>
  <p>You next step should be to include domain knowledge, as <a href="https://ai.stackexchange.com/a/31922/28428">Sanyou recommends</a>. This can be as simple as observing that bipolar mood swings follow a day/night cycle and modeling this seasonality, e.g., in a seasonal Exponential Smoothing method. (I'm not saying this disorder does exhibit this kind of seasonality, only that if it does, this can easily be modeled.) Or model any other kinds of drivers you know.</p>
  <p>In my experience, understanding your data and your context <a href="https://stats.stackexchange.com/a/355395/1352">always beats building more fancy models, or collecting more data</a>.</p>
  <p>As free time series forecasting textbooks, I very much recommend <a href="https://otexts.org/fpp2/" rel="noreferrer"><em>Forecasting: Principles and Practice</em> (2nd ed.) by Athanasopoulos &amp; Hyndman</a>
  and
  <a href="https://otexts.org/fpp3/" rel="noreferrer"><em>Forecasting: Principles and Practice</em> (3rd ed.) by Athanasopoulos &amp; Hyndman</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-05T10:26:59.187Z
Answers.LastActivityDate: 2021-10-05T10:26:59.187Z
Answers.UserDisplayName: Stephan Kolassa
Answers.Body: <p>I guess the most &quot;suitable&quot; approach is to look up research papers on ML/AI/Stats based methods on bipolar disorder mood swings prediction/regression etc. Focus on the abstract, intro/related works and conclusion. Find out why the method is proposed, what the well-known approaches are, what the intuition for the proposed methods are. Find out the fundamental resources cited on the intro/related works. From the intro and related works, look up the references and skim them.</p>
  <p>As for the theoretical basis, the math and the proposed method, just skim them quick, next time you got time/the feels you can deepen them. Utilize sci-hub or lib-gen or similar webs if you/your institution is not subscribed to the publishers. Bonus points: some papers also include github/links to their implementation source code.</p>
  <p>Quick search on google scholar with the query &quot;bipolar mood swing prediction machine learning&quot; resulted in cool (at least the titile) research papers. For example <a href="https://doi.org/10.1016/j.neubiorev.2017.07.004" rel="noreferrer">The impact of machine learning techniques in the study of bipolar disorder: a systematic review</a>, and <a href="https://www.techrxiv.org/articles/preprint/Review_on_Machine_Learning_Techniques_to_predict_Bipolar_Disorder/14346050" rel="noreferrer">Review on Machine Learning Techniques to predict Bipolar Disorder</a>.</p>
  <p>Why do we go with this approach? Because your domain is specific, vast and complex it its own way. Most of the time, they already tried the &quot;basics&quot; prediction/regression/classification on your domain and published the methods as well as the results, so you can start from there and gain even more because of the additional knowledges/references from the papers.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T12:50:03.623Z
Answers.LastActivityDate: 2021-10-04T12:50:03.623Z
Answers.UserDisplayName: Sanyou
Answers.Body: <p>Since you only have only 700 observations, I would not try a deep learning approach. I think it is very unlikely that any Deep Learning approach will learn a non-obvious relationship with that little data.</p>
  <p>What you could try is create a set of features based on lags. Create a feature, that is lagged by 1, by 2, by 3, and so on. Also moving average of lagged variables could be useful, window of 2,3,5. Standard deviation could also be interesting, though at bit larger windows. And then train a regular ML model.</p>
  <p>I would try this simple approach even if I had 10 million observations, and planned on using Deep Learning, so I could use it as a benchmark.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-05T23:08:22.197Z
Answers.Text: Rather than using hand-crafted features using lags, I'd start with a plain old auto-regressive (AR) model, perhaps then auto-regressive moving-average (ARMA).
Answers.UserDisplayName: David Waterworth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-05T05:13:17.113Z
Answers.LastActivityDate: 2021-10-05T05:13:17.113Z
Answers.UserDisplayName: Akavall
Answers.Body: <p>As all you have is a series of numbers, you should try using a <a href="https://towardsdatascience.com/sequence-models-and-recurrent-neural-networks-rnns-62cadeb4f1e1" rel="noreferrer">sequence model</a>. I suggest you look into RNNs and in particular LSTMs. Of course this is assuming despite the lack of &quot;obvious patterns&quot;, there are some kind of hidden patterns in your data. If not, what you have is not very different than <a href="https://machinelearningmastery.com/gentle-introduction-random-walk-times-series-forecasting-python/" rel="noreferrer">random walk</a> in 3 dimensions - which makes the case unpredictable in the first place.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T11:56:52.200Z
Answers.LastActivityDate: 2021-10-04T11:56:52.200Z
Answers.UserDisplayName: serali
Body: <p>I've got an array of integers ranging from -3 to +3.</p>
  <p>Example: [1, 3, -2, 0, 0, 1]</p>
  <p>The array has no obvious pattern since it represents bipolar disorder mood swings.</p>
  <p>What is the most suitable approach to predict the next number in the series? The length of the array is about 700 entries.</p>
  <p>From where can I start the investigation? (provided that I've got some experience in Python and <a href="https://en.wikipedia.org/wiki/Node.js" rel="noreferrer">Node.js</a>, but only a hello-worldish acquaintance with <a href="https://en.wikipedia.org/wiki/TensorFlow" rel="noreferrer">TensorFlow</a>). Which training model might be suitable in this case? How can I chunk the data set properly?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-04T22:54:35.197Z
Comments.Text: Just to clarify, do you only have 700 observations or do you have n sets of 700 observations?
Comments.UserDisplayName: Akavall
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-05T04:58:16.860Z
Comments.Text: Thanks for the question! It's 700 observations only
Comments.UserDisplayName: ZenBerry
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-05T13:52:41.410Z
Comments.Text: Keep in mind that "no obvious pattern" may actually mean "no pattern at all", in which case the answer to "how can I predict the next number?" is "you can't". It's worth trying, but some sequences will be impossible to predict.
Comments.UserDisplayName: Nuclear Hoagie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-05T18:44:25.437Z
Comments.Text: have you seen this recent video from mathloger? They address this question: https://www.youtube.com/watch?v=4AuV93LOPcE
Comments.UserDisplayName: Our
Tags: <machine-learning><recurrent-neural-networks><prediction><sequence-modeling>
Title: How can I predict the next number in a non-obvious sequence?
UserDisplayName: ZenBerry
ThreadText: # How can I predict the next number in a non-obvious sequence?
  
  (Asked by: username_0 on 2021-10-04)
  
  I've got an array of integers ranging from -3 to +3.
  
  Example: [1, 3, -2, 0, 0, 1]
  
  The array has no obvious pattern since it represents bipolar disorder mood swings.
  
  What is the most suitable approach to predict the next number in the series? The length of the array is about 700 entries.
  
  From where can I start the investigation? (provided that I've got some experience in Python and [Node.js](https://en.wikipedia.org/wiki/Node.js), but only a hello-worldish acquaintance with [TensorFlow](https://en.wikipedia.org/wiki/TensorFlow)). Which training model might be suitable in this case? How can I chunk the data set properly?
  
  **Tags:** machine-learning, recurrent-neural-networks, prediction, sequence-modeling
  
  > **Comments:**
  > **username_1**: Just to clarify, do you only have 700 observations or do you have n sets of 700 observations?  
  > **username_0**: Thanks for the question! It's 700 observations only  
  > **username_2**: Keep in mind that "no obvious pattern" may actually mean "no pattern at all", in which case the answer to "how can I predict the next number?" is "you can't". It's worth trying, but some sequences will be impossible to predict.  
  > **username_3**: have you seen this recent video from mathloger? They address this question: https://www.youtube.com/watch?v=4AuV93LOPcE  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_7 on 2021-10-04. Score: 10 | Accepted answer
  
  As all you have is a series of numbers, you should try using a [sequence model](https://towardsdatascience.com/sequence-models-and-recurrent-neural-networks-rnns-62cadeb4f1e1). I suggest you look into RNNs and in particular LSTMs. Of course this is assuming despite the lack of "obvious patterns", there are some kind of hidden patterns in your data. If not, what you have is not very different than [random walk](https://machinelearningmastery.com/gentle-introduction-random-walk-times-series-forecasting-python/) in 3 dimensions - which makes the case unpredictable in the first place.
  
  
  ---
  
  ### Answer by username_4 on 2021-10-05. Score: 14
  
  This is a question of *time series forecasting*, since your numbers form a sequence.
  You may want to take a look at [the "forecasting" tag at CrossValidated](https://stats.stackexchange.com/questions/tagged/forecasting).
  
  If you have only 700 data points, ML/AI methods will likely not be very useful. Whatever you do, I would recommend you benchmark your chosen method against very simple approaches, like the overall mean, or the last observation (a "random walk forecast"), or a simple Exponential Smoothing method. These very simple benchmarks can often be surprisingly hard to beat, and they are trivially easy to set up.
  
  You next step should be to include domain knowledge, as [username_5 recommends](https://ai.stackexchange.com/a/31922/28428). This can be as simple as observing that bipolar mood swings follow a day/night cycle and modeling this seasonality, e.g., in a seasonal Exponential Smoothing method. (I'm not saying this disorder does exhibit this kind of seasonality, only that if it does, this can easily be modeled.) Or model any other kinds of drivers you know.
  
  In my experience, understanding your data and your context [always beats building more fancy models, or collecting more data](https://stats.stackexchange.com/a/355395/1352).
  
  As free time series forecasting textbooks, I very much recommend [*Forecasting: Principles and Practice* (2nd ed.) by Athanasopoulos & Hyndman](https://otexts.org/fpp2/)
  and
  [*Forecasting: Principles and Practice* (3rd ed.) by Athanasopoulos & Hyndman](https://otexts.org/fpp3/).
  
  
  ---
  
  ### Answer by username_5 on 2021-10-04. Score: 6
  
  I guess the most "suitable" approach is to look up research papers on ML/AI/Stats based methods on bipolar disorder mood swings prediction/regression etc. Focus on the abstract, intro/related works and conclusion. Find out why the method is proposed, what the well-known approaches are, what the intuition for the proposed methods are. Find out the fundamental resources cited on the intro/related works. From the intro and related works, look up the references and skim them.
  
  As for the theoretical basis, the math and the proposed method, just skim them quick, next time you got time/the feels you can deepen them. Utilize sci-hub or lib-gen or similar webs if you/your institution is not subscribed to the publishers. Bonus points: some papers also include github/links to their implementation source code.
  
  Quick search on google scholar with the query "bipolar mood swing prediction machine learning" resulted in cool (at least the titile) research papers. For example [The impact of machine learning techniques in the study of bipolar disorder: a systematic review](https://doi.org/10.1016/j.neubiorev.2017.07.004), and [Review on Machine Learning Techniques to predict Bipolar Disorder](https://www.techrxiv.org/articles/preprint/Review_on_Machine_Learning_Techniques_to_predict_Bipolar_Disorder/14346050).
  
  Why do we go with this approach? Because your domain is specific, vast and complex it its own way. Most of the time, they already tried the "basics" prediction/regression/classification on your domain and published the methods as well as the results, so you can start from there and gain even more because of the additional knowledges/references from the papers.
  
  
  ---
  
  ### Answer by username_1 on 2021-10-05. Score: 4
  
  Since you only have only 700 observations, I would not try a deep learning approach. I think it is very unlikely that any Deep Learning approach will learn a non-obvious relationship with that little data.
  
  What you could try is create a set of features based on lags. Create a feature, that is lagged by 1, by 2, by 3, and so on. Also moving average of lagged variables could be useful, window of 2,3,5. Standard deviation could also be interesting, though at bit larger windows. And then train a regular ML model.
  
  I would try this simple approach even if I had 10 million observations, and planned on using Deep Learning, so I could use it as a benchmark.
  
  > **Comments:**
  > **username_6**: Rather than using hand-crafted features using lags, I'd start with a plain old auto-regressive (AR) model, perhaps then auto-regressive moving-average (ARMA).  
  
  ---
  
  