Bootcamps

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Academy

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Full-Stack Software Developer - 16w

Data Science and Machine Learning - 16 wks

Search from all Lessons


LoginGet Started
← Back to Lessons

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast
Edit on Github

Time Series

Time series

Time series

A time series is a sequence of data ordered in time, where each data point is associated with a specific instant. In other words, it is a collection of observations that are recorded at regular or irregular intervals over time. These observations can be collected over hours, days, months or even years, depending on the context and the nature of the phenomenon being analyzed.

In a time series, time is the independent variable, and the observations recorded over time are the dependent variables. The main objective of analyzing a time series is to understand and model the underlying pattern or structure in the data over time, in order to make future predictions or extract relevant information.

Time series are commonly found in a wide variety of fields: economics, finance, meteorology, science and engineering, among others. Examples of time series include daily sales data, stock prices, daily temperatures, population growth rates, production levels, and so on.

temporal-serie-example

When analyzing a time series, it is important to keep in mind that the data are correlated over time. This means that observations at one point in time may depend on past observations and, in some cases, may also be affected by future observations. This pattern of correlation over time is what makes time series analysis unique and requires specific techniques for modeling and prediction.

Time series analysis can involve various techniques, such as smoothing methods, decomposition, autoregressive models, moving average models, among others. In addition, the use of visualization tools, such as line graphs or autocorrelation plots, is common to better understand patterns and trends in the data over time.

Analyzing a time series

When visually analyzing a time series, there are several important things to look for in order to understand the behavior and patterns of the data over time. Here are some of the main things to look for:

  • Trend: Identify whether there is a general trend in the time series, i.e., whether the data tend to increase or decrease over time. A trend can be linear (steady growth or decline) or non-linear (accelerating or decelerating growth or decline).
  • Seasonality: Observe whether there are seasonal or cyclical patterns in the data, i.e., whether there are behaviors that repeat at regular intervals, such as daily, monthly, or seasonally. For example, there may be an increase in toy sales during the Christmas vacations each year.
  • Variability: Check whether the variability of the data changes over time. There may be periods of high variability followed by periods of low variability. Variability may indicate times of instability or changes in the behavior of the phenomenon being studied.
  • Outliers: Identify if there are extreme or unusual values that differ significantly from the general pattern of the series. Outliers can affect interpretation and further analysis.
  • Autocorrelation: Check for correlation between past and current observations. Autocorrelation can indicate dependencies over time and is critical for time series modeling.
  • Inflection points: Look for abrupt changes or turning points in the series, where the trend or behavior of the phenomenon changes significantly.

Visualization of a time series can be done using line graphs, scatter plots, histograms, autocorrelation plots and other visualization techniques. By identifying these features in the time series, we can gain valuable insights into the behavior and temporal relationships of the data, allowing us to make informed decisions and perform deeper analysis or predictive modeling.

Predicting a time series

To predict and analyze time series, there are several types of models that can be used. Some of the most common models are:

  • ARIMA model (AutoRegressive Integrated Moving Average): ARIMA is a forecasting model for time series that combines information from past values, differencing and forecast errors to make projections about future values. ARIMA is versatile and can adapt to different patterns in the time series, such as trends and seasonality. When we apply ARIMA to a time series, we can first differencing the series if necessary to make it stationary. Then, we fit the ARIMA model to the data and use its AR, I and MA components to make future forecasts.
  • Exponential Smoothing Model: This model is very simple and efficient. It is based on the idea of assigning different weights to past observations, giving them more importance the more recent they are. It is useful for time series with trends or gradual growth/decline patterns.
  • Recurrent Neural Networks (RNN, Recursive Neural Networks) and Long Short-Term Memory (LSTM): These models are deep learning techniques that can handle sequences of data, such as time series. RNNs and LSTMs are especially suited for complex behavioral patterns and long-term relationships in data. They are powerful and versatile models, but can also be more complicated to train and fit.

These three models are widely used in time series forecasting because of their ability to deal with different types of temporal behavior. Each has its advantages and limitations, and the choice of model will depend on the type of data and the temporal pattern to be modeled. It is important to consider the nature of the data and to make a careful evaluation of the model's performance in order to make the most appropriate decision.