Finding an appropriate binary classification algorithm for time series data intervals
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.