# Introduction to Time Series Analysis in Machine learning

• Neelam Tyagi
• Jan 05, 2020
• Machine Learning
• Updated on: Mar 04, 2021 While all the numerous advanced tools and techniques are employed for data analysis such as ML, IoT etc, one of the techniques frequently preferred for analyzing such data is statistical Time Series Analysis.

We all must have heard that people are saying that the price of different objects has decreased or increased with time, these different objects could be anything like petrol, diesel, gold, silver, edible things, etc.

Another example is, the rate of interest fluctuates in banks and different for different kinds of loans. What are all this data, how useful it is? These types of data are time-series data that go through analysis for forecasts.

Because of the tremendous variety of conditions, time-series analysis is used by both nature and human beings for communication, description, and data visualizations.

Also, time is the physical quantity, and elements, coefficients, parameters, and characteristics of time-series data are mathematical quantities, so time-series can have real-time or real-world interpretations as well.

## Topic Covered

1. Introduction

2. What is Time-Series Analysis?

3. Examples of Time-Series Analysis

4. Implementing Time-series Analysis in ML

5. ML Models and Methods in Time-Series Analysis

## Introduction

In the broad form, an analysis is conducted to obtain inference what has occurred in the past with the data point series and endeavour to predict what is going to appear in the coming time.

An ordered set of observations with respect to time periods is a time series. In simple words, a sequential organization of data accordingly to their time of occurrence is termed as time series.

For example, "how do people get to know that the price of an object as increased or decreased over time", they do so by comparing the price of an object over a set of the time period.

A time series data is the set of measurements taking place in a constant interval of time, here time acts as independent variable and the objective ( to study changes in a characteristics) is dependent variables.

For example, one can measure

• Consumption of energy per hour

• Sales on daily basis

• Company's profits per quarter

• Annual changes in a population of a country.

The time series data is of three types:

• Time series data: A set of observations contains values, taken by variable at different times.

• Cross-sectional data: Data values of one or more variables, gathered at the same time-point.

• Pooled data: A combination of time series data and cross-sectional data.

A time-series data can be represented using various data visualization techniques in order to uncover the hidden patterns in  datasets, such as shown below in the image. Time-Series Analysis through various mode of data visualization

Since time acts as a reference point in relation to the entire procedure, it can be noticed that time-series always depicts a relationship between two variables in which one is time and the other one is any quantitative variable.

Moreover, it is not necessarily there is an increment in the change of variable with respect to time in the observations, it also exhibited decrement in variable-time observational data.

For example, the temperature of a particular area at a particular time increases or decreases accordingly.

## What is Time Series Analysis?

"Time series analysis is a statistical technique dealing in time series data, or trend analysis."

A time-series contains sequential data points mapped at a certain successive time duration, it incorporates the methods that attempt to surmise a time series in terms of understanding either the underlying concept of the data points in the time series or suggesting or making predictions.

• Forecasting data using time-series analysis comprises the use of some significant model to forecast future conclusions on the basis of known past outcomes.
• An objective of time series analysis is to explore and understand patterns in changes over time where these patterns signifies the components of a time series including trends, cycles, and irregular movements.
• When such components reside in a time series, the data model must be considered for these patterns for generating accurate forecasts, such as future sales, GDP, and global temperatures.

Consider an example of a restaurant in which prediction is made on the number of customers as when will more customers appear in the restaurant at a specified time duration based on the previous appearance of customers with time.

We can use Time Series for multiple investigations to predict future as circadian rhythms, seasonal behaviours, trends, changes, etc. to interrogate the questions like predicted values, what is leading and lagging behind, connections and association, control, repetitions, and hidden pattern, etc.

Time series analysis is basically the recording of data at a regular interval of time, which could lead to taking a versed decision, crucial for trade and so have multiple applications such as Stock Market and Trends Analysis, Financial Analysis and forecasting, Inventory analysis, Census Analysis, Yield prediction, Sales forecasting, etc. Multiple applications of the Time-Series Analysis

Broadly specified time-series models are Autoregressive (AR), Integrated (I), Moving Average(MA), and some other models are the combination of these models such as Autoregressive Moving Average (ARMA), and Autoregressive Integrated Moving Average (ARIMA) models.

These models reflect measurements near concurrently in time will be more closely relevant as compared to measurements distant apart.

## Examples of Time-Series Analysis

Consider an example In the financial domain, the main objective is to recognize trends, seasonal behaviour, and correlation through the usage of time series analysis technique and producing filters based on the forecasts, this includes;

1. To predict expected utilities-  For the perfect and successively trading, it is necessary to have accurate and reliable future predictions such as asset prices, variation in usage, products in demand in statistical form through market research, and time-series dataset.

2. Simulate series- After getting statistical output data of financial time series, that can be used for creating simulations of future events. It helps us to determine the count of trades, expected trading costs and returns, required financial and technical investment, several risks in trading, etc.

3. Presume relationship- Recognition of the relationship between the time series and other quantities gives us trading signs to improve the existing fashion of trading. For example, to know the spreading of foreign exchange pair and its variation with a proposal, estimated trades can be inferred for a certain period for forecasting a widespread to reduce transaction costs.

Moreover, consider the simple example of a train steadiness, it includes the Time Series Data model that can be implemented to represent information such as stopping trains. It can be used;

1. To aggregate over time which train is late at which location, and

2. How many passengers were there on the train?

Furthermore, in order to examine social media hashtags and how frequently a hashtag is utilized in a specified interval of time. More and more, how many responses this particular hashtag used during such an interval. (Source)

A table below shows the particular field to analyze using time-series data and what possible instance could be investigated through it,

 S.No Field Example topics 1 Economics Gross Domestic Product (GDP), Consumer Price Index (CPI), and unemployment rates 2 Social sciences Birth rates, population, migration data, political indicators 3 Epidemiology Disease rates, mortality rates, mosquito populations 4 Medicine Blood pressure tracking, weight tracking, cholesterol measurements, heart rate monitoring 5 Physical sciences Global temperatures, monthly sunspot observations, pollution levels.

## Implementing Time Series Analysis in Machine Learning

It is a well-known fact that Machine Learning is a powerful technique in imagining, speech and natural language processing for a huge explicated dataset available. On the other hand,

1. Problems based on time series do not have usually interpreted datasets, even as data is collected from various sources so exhibit substantial variations in terms of features, properties, attributes, temporal scales, and dimensionality.
2. Time series analysis requires such sorting algorithms that can allow it to learn time-dependent patterns across multiples models different from images and speech.
3. Various machine learning tools such as classification, clustering, forecasting, and anomaly detection depend upon real-world business applications

Among various defined applications, discussing here Time series forecasting, it is an important area of machine learning because there are multiple problems involving time components for making predictions. There are multiple models and methods used as approaches for time series forecasting, let’s understand them more clearly;

## ML Methods For Time-Series Forecasting

1. In the Univariate Time-series Forecasting method, forecasting problems contain only two variables in which one is time and the other is the field we are looking to forecast.

• For example, if you want to predict the mean temperature of a city for the coming week, now one parameter is time( week) and the other is a city.
• Another example could be when measuring a person’s heart rate per minute through using past observations of heart rate only. Now one parameter is time( minute) and the other is a heart rate.

1. On the other hand, in the Multivariate Time-series Forecasting method, forecasting problems contain multiple variables keeping one variable as time fixed and others will be multiple in parameters.

Consider the same example, predicting the temperature of a city for the coming week, the only difference would come here now temperature will consider impacting factors such as

• Rainfall and time duration of raining,
• Humidity,
• Wind speed,
• Precipitation,
• Atmospheric pressure, etc,

And then the temperature of the city will be predicted accordingly. All these factors are related to temperature and impact it vigorously.

(Related blog: Big data analytics in Weather Forecasting) Time-Series Forecasting: Methods and Models in Machine Learning

## ML Models For Time-Series Forecasting

• ARIMA Model: As mentioned in the above section, it is a combination of three different models itself, AR, MA and I, where
1. “AR” reflects the evolving variable of interest is regressed on its own prior values,
2. “MA” infers that the regression error is the linear combination of error terms values happened at various stages of time priorly, and
3. “I” shows the data values are replaced by the difference between their values and the previous values.

Combinedly “ARIMA” tries to fit the data into the model, and also ARIMA depends on the accuracy over a broad width of time series.

• ARCH/GARCH Model: Being the extended model of its common version GARCH, Autoregressive Conditional Heteroscedasticity (ARCH) is the most volatile model for time series forecasting, and are well trained for catching dynamic variations of volatility from time series.

• Vector Autoregressive Model or VAR model:  It gives the independencies between various time-series data which as a generalization of the Univariate Autoregression Model.

• LSTM: Long-short term memory(LSTM)is a deep learning model, it is a kind of Recurrent Neural Network(RNN) to read the sequence dependencies.

It enables us to handle long structures during training the dataset and creates predictions according to previous data.

The blog ends here, we have discussed so far about time series analysis and its model, its role in financial analysis including various examples, and the impact of machine learning on time series along with applications.

0%
{"ft_lang_label":"__label__en","ft_lang_prob":0.91378075,"math_prob":0.91608673,"size":9650,"snap":"2021-43-2021-49","text_gpt3_token_len":1817,"char_repetition_ratio":0.13228281,"word_repetition_ratio":0.012145749,"special_character_ratio":0.18051814,"punctuation_ratio":0.10036058,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9545769,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,null,null,4,null,4,null,4,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-22T22:58:08Z\",\"WARC-Record-ID\":\"<urn:uuid:f59ee083-ad65-4609-943f-ad21665e62d4>\",\"Content-Length\":\"53899\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8b826186-5586-42b3-8113-ccf089cd0e17>\",\"WARC-Concurrent-To\":\"<urn:uuid:8b74a1bb-3c3b-47e1-b9ac-dde42d4af220>\",\"WARC-IP-Address\":\"13.235.204.31\",\"WARC-Target-URI\":\"https://www.analyticssteps.com/blogs/introduction-time-series-analysis-time-series-forecasting-machine-learning-methods-models\",\"WARC-Payload-Digest\":\"sha1:L3HUKENMBOI4FHH4CY762BYVKBHC5F2T\",\"WARC-Block-Digest\":\"sha1:OKBSQ2YBUX76QJGVASRV6TJI56LN2JRL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585522.78_warc_CC-MAIN-20211022212051-20211023002051-00568.warc.gz\"}"}