From the course: Advanced SQL for Data Science: Time Series
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Forecasting with linear regression - SQL Tutorial
From the course: Advanced SQL for Data Science: Time Series
Forecasting with linear regression
- [Instructor] So, for the most part we've been looking at the past with our time series data. For example, we might have an average temperature, an average CPU utilization and then we look back and try to get an idea what was the average for the trailing hour or day. Sometimes though, we want to predict what's going to happen in the future and we can do that using regression functions. And we're going to work with linear regression and basically the idea is we're going to make predictions based on what we've seen in the past. So to start, I just want to remind everybody from some high school math. The formula for a line is Y = MX + B. M, that's the slope of the line. B, is the Y intercept. X is the input value and Y is the predicted value. So, in our example, let's try and predict the amount of free memory that will be available given a particular CPU utilization. So what we need to do, is we need to calculate the slope and the intercept first. Fortunately, PostgreSQL gives us…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Common Table Expressions and recursion2m 46s
-
(Locked)
Calculating aggregates over windows1m 34s
-
(Locked)
Previous day comparison3m 50s
-
(Locked)
Moving averages1m 59s
-
(Locked)
Weighted moving averages5m 18s
-
(Locked)
Forecasting with linear regression3m 39s
-
(Locked)
Exponential moving average1m 29s
-
(Locked)
-