Book Image

Machine Learning Quick Reference

By : Rahul Kumar
Book Image

Machine Learning Quick Reference

By: Rahul Kumar

Overview of this book

Machine learning makes it possible to learn about the unknowns and gain hidden insights into your datasets by mastering many tools and techniques. This book guides you to do just that in a very compact manner. After giving a quick overview of what machine learning is all about, Machine Learning Quick Reference jumps right into its core algorithms and demonstrates how they can be applied to real-world scenarios. From model evaluation to optimizing their performance, this book will introduce you to the best practices in machine learning. Furthermore, you will also look at the more advanced aspects such as training neural networks and work with different kinds of data, such as text, time-series, and sequential data. Advanced methods and techniques such as causal inference, deep Gaussian processes, and more are also covered. By the end of this book, you will be able to train fast, accurate machine learning models at your fingertips, which you can easily use as a point of reference.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Stationarity


A common assumption for a few of the time series models is that data has to be stationary. Let's look at what stationarity means regarding time series.

A stationary process is one for which the mean, variance, and autocorrelation structure doesn't change over time. What this means is that the data doesn't have a trend (increasing or decreasing).

We can describe this by using the following formulas:

E(xt)= μ, for all t

E(xt2)= σ2, for all t

cov(xt,xk)= cov(xt+s, xk+s), for all t, k, and s

Detection of stationarity

There are multiple methods that can help us in figuring out whether the data is stationary, listed as follows:

  • Plotting the data: Having a plot of the data with respect to the time variable can help us to see whether it has got a trend. We know from the definition of stationarity that a trend in the data means that there is no constant mean and variance. Let's do this in Python. For this example, we are using international airline passenger data.

First, let's load all the required...