Finding an appropriate binary classification algorithm for time series data intervals Maybe someone here has experience in this matter and can point me in the right direction. I want to classify parts of an interval of numerical movement data as either resting or not resting. I have training data of what resting intervals look like. And am looking for the right algorithm to tackle this problem. I don't need the code, just a friendly push in the right direction.
Here is a rundown of the expected process.

I have an array of values that represent measurement over 5 minutes.

testData = [0, 4, 3, 5, 2, 4, 3, 4, 6, 11, 9, 10, 3, 15, 21, 5]



I have training data

trainingDataResting = [[1, 2, 1, 6, 4, 2], [3, 2, 2, 0, 4, 1, 5, 2], [3, 6, 2, 1, 0, 4, 5, 2]]
trainingDataActive = [[10, 4, 5, 9, 19, 13], [12, 8, 20, 9, 14], [13, 22, 19, 21, 11, 7, 9]]

A resting interval has to be at least 6 measurements long, and the longest possible resting interval is of interest. Is there a way to classify portion of the testData as resting, based on the trainingData? Something like:
testData = [0, 4, 3, 5, 2, 4, 3, 4, 6, 11, 9, 10, 3, 15, 21, 5]
           '-------------------------' '----------------------'
                     Resting                 Not Resting

testResting = [0, 4, 3, 5, 2, 4, 3, 4, 6]
testActive = [11, 9, 10, 3, 15, 21, 5]

I get that there will be many solutions of possible resting intervals, but I am particularly interested in the longest and most resting one.
Of course I am working with a lot more training data than I provided here.
I was working on a decision tree -&gt; Decision Tree, before I was informed that there is prelabeled data that I could use for training.
I was thinking about long short term memory networks, do you know whether this applies here?
Thank you for the help.
Best,
Jo
You could do logistic regression combined with an additional moving average/ clustering step.
Combine your data into training rest and active data into a single array X, and have an additional array y which would represent the labels e.g. 0 - active / 1 - resting for each row in your training dataset.
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression(random_state=0).fit(X, y)

Then  predict for each step whether it is resting or active.
The predictions of the test set would look something like:
[0,1,1,1,0,1,1,0,0,0,0,1,0,0,0]

The additional step would be to find the groups. You could do this with a moving window like &quot;if 5 active states in a window of 7, label it as active&quot;. You could also solve that final step with clustering, e.g. &quot;if 0 is surrounded by 1s it is 0&quot;, or find local clusters of binary values.