Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning for Time-Series with Python

You're reading from   Machine Learning for Time-Series with Python Forecast, predict, and detect anomalies with state-of-the-art machine learning methods

Arrow left icon
Product type Paperback
Published in Oct 2021
Publisher Packt
ISBN-13 9781801819626
Length 370 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Auffarth Ben Auffarth
Author Profile Icon Ben Auffarth
Ben Auffarth
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Introduction to Time-Series with Python 2. Time-Series Analysis with Python FREE CHAPTER 3. Preprocessing Time-Series 4. Introduction to Machine Learning for Time-Series 5. Forecasting with Moving Averages and Autoregressive Models 6. Unsupervised Methods for Time-Series 7. Machine Learning Models for Time-Series 8. Online Learning for Time-Series 9. Probabilistic Models for Time-Series 10. Deep Learning for Time-Series 11. Reinforcement Learning for Time-Series 12. Multivariate Forecasting 13. Other Books You May Enjoy
14. Index

Python Practice

NumPy and SciPy offer most of the functionality that we need, but we might need a few more libraries.

In this section, we'll use several libraries, which we can quickly install from the terminal, the Jupyter Notebook, or similarly from Anaconda Navigator:

pip install -U tsfresh workalendar astral "featuretools[tsfresh]" sktime

All of these libraries are quite powerful and each of them deserves more than the space we can give to it in this chapter.

Let's start with log and power transformations.

Log and Power Transformations in Practice

Let's create a distribution that's not normal, and let's log-transform it. We'll plot the original and transformed distribution for comparison, and we'll apply a statistical test for normality.

Let's first create the distribution:

from scipy.optimize import minimize
import numpy as np
np.random.seed(0)
pts = 10000
vals = np.random.lognormal(0, 1.0, pts...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image