Anomaly Detection in Time Series: How to label the data
Anomaly or Outlier detection are usually used when we have cases that happens rarely. So it is not easy to gather data for those cases. Then what we do is, we just train with our normal data. It is also the same for time series.

It is usually falls under Unsupervised learning, as there is no need to label your data. You feed all the data that you have to the model (For example one Class SVM) and it would try to understand or find clusters/groups in the data. Afterwards for test data, it would give you a number as a result of prediction/detection. This number would represent how close or far this test data is to normal group/clusters. 

Of course you should have labeled data for the propose of testing the model. For this case you can either generate anomaly data manually just for the sake of testing or you should identify some anomalies by analysing the data. Then you can test the model with these labeled data and see if it can actually recognise them or not.

Of course you can tackle this issue as two-class classification but then this is not anomaly detection anymore, and it will be a normal classification model.

Hope this helps.



For further info you can take a look at these:

https://scikit-learn.org/stable/modules/outlier_detection.html

https://scikit-learn.org/stable/modules/generated/sklearn.svm.OneClassSVM.html#sklearn-svm-oneclasssvm