1

In this question: What algorithms need feature scaling, beside from SVM? it is said that we need to standardize so that all features are weighted equally. But what if we only have as features: time and a count (ex: number of logins by hour). Do we still need to standardize? Why?

Nick Cox
  • 48,377
  • 8
  • 110
  • 156
Aizzaac
  • 989
  • 2
  • 11
  • 21

2 Answers2

2

Time series data is frequently univariate, and some univariate time series forecasting algorithms require some sort of "standardization" (i.e using a broad definition of the term):

  • ARMA models require the data to be weakly stationary (that is to have constant mean and constant variance). You can use differencing and/or the Box-Cox transform to transform your univariate series into a stationary series. The 'I' in ARIMA stands for differencing, and an ARIMA model is an ARMA model with the "standardization" built into it, so to speak.
  • Using neural networks for time series forecasting, it is often recommended to standardize the data as well, either using the above mentioned transformations, a $log(x+1)$ transform, or a sometimes just a simple ${x}^T = \frac{x - E(x)}{VAR(x)}$.
Skander H.
  • 10,602
  • 2
  • 33
  • 81
  • @Skander_H, What about "standardscaler" or "robustscaler" as a way to standarize a univariate time series dataset? – Aizzaac Aug 05 '19 at 19:40
  • 1
    I already mentioned standardscaler in my second bullet point (${x}^T = \frac{x - E(x)}{VAR(x)}$.), robust scaler is just a variation of standardscaler that uses the median and quartiles, instead of mean an variance. – Skander H. Aug 05 '19 at 20:36
  • @SkanderH. How about a time series model(SARIMAX,VARMAX) with exogenous variables? do exogenous variables need to be standardised? – A-dude Jul 26 '21 at 16:20
-3

Edit:
I believe your variables are still subject to standardization depending on the model due to being on different scales. Time series data needs transformed before use in ML, so going with your example (hours) will be something like an INT between 0-24, while logins will be on the scale of something like 0-10,000.

barker
  • 219
  • 1
  • 9
  • Could you explain how "balancing" is related to the *standardization* mentioned in the question? It might help to read the link in the question for clarification of what is meant by "all features are weighted equally." – whuber Jul 08 '19 at 20:07
  • By "standarization", I mean the use of StandardScaler or RobustScaler (Scikit-learn algorithms). These are used to normalize data which means that the distribution will have: mean=0 and standard deviation=1 – Aizzaac Jul 08 '19 at 20:13
  • 1
    @Aizzaac, then you were wrong to accept this answer, because it is incorrect in its remarks about time series. – whuber Jul 08 '19 at 22:30
  • @whuber, What do you mean? – Aizzaac Aug 05 '19 at 20:04
  • The time series data do not necessarily need standardization or transformation. Moreover, reducing them to integer hours on a 24 hour clock as indicated here loses all more detailed information (about minutes and seconds) as well as all larger information (about date). – whuber Aug 05 '19 at 20:48
  • I only want to standarize the number of logins. They go from 0 to 15000. I believe that will only help to better visualize data but will not have any effect on the performance of the algorithm even if I use a distance based one. And that is why I posted the question. – Aizzaac Aug 06 '19 at 15:12
  • I have just tested what happens. DBSCAN gives different results when scaled. Meanwhile LOF remains the same. So, just in case I will always use "standarization" – Aizzaac Aug 06 '19 at 16:29