09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6

Time Series

An Exceptional Scenario

In the airline or hotel domain, the passenger load of month t is less

correlated with data of t-1 or t-2 month, but it is more correlated for t-12

month. For example, the passenger load in the month of Diwali (October)

is more correlated with last year’s Diwali data than with the same year’s

August and September data. Historically, the pick-up model is used to

predict this kind of data. The pick-up model has two variations.

In the additive pick-up model,

X(t) = X(t-1) + [X(t-12) –X(t-13)]

In the multiplicative pick-up model,

X(t) = X(t-1) * [X(t-12) / X(t-13)]

Studies have shown that for this kind of data the neural network–based

predictor gives more accuracy than the time-series model.

In high-frequency trading in investment banking, time-series models

are too time-consuming to capture the latest pattern of the instrument.

So, they on the fly calculate dX/dt and d2X/dt2, where X is the price of

the instruments. If both are positive, they blindly send an order to buy the

instrument. If both are negative, they blindly sell the instrument if they

have it in their portfolio. But if they have an opposite sign, then they do a

more detailed analysis using the time series data.

As I stated earlier, there are many scenarios in time-series analysis

where R is a better choice than Python. So, here is an example of timeseries

forecasting using R. The beauty of the auto.arima model is that it

automatically finds the order, trends, and seasonality of the data and fits

the model. In the forecast, we are printing only the mean value, but the

141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!