So now that you know, the basics of classification and regression, we are now going to learn how to
convert these problems into time, serious problems in actuality, the main focus of this lecture is
not machine learning itself, but rather the data.
So I want to repeat that because it's very important.
The focus of this lecture is not machine learning.
The focus of this lecture is the data.
So what do I mean by this?
OK, so let's start with a typical regression problem, so you would like to predict your exam grade
from the number of hours you studied and the number of hours you slept the night before your exam.
Pretty standard example.
Now, as you can see, this data set is essentially just two tables of numbers, one table we call X
and the other table we call Y.
So how can this structure be used for a time series?
Well, let's state what we are trying to do in a slightly different way.
We are trying to predict the Y column, given the values in the X column.
So why does that sound familiar?
Well, in Time series forecasting, we're trying to predict the next value in the Time series from the
previous values in the Time series.
OK, so what does that mean?
Well, it means that I can simply put, the thing I want to predict in the Y column and put the things
I want to predict from in the X columns.
And you could see here that I've done exactly this.
I want to predict Y for from y one way to one y three, I want to predict Y five from Y to Y three and
Y four.
OK, so I bet you're probably a bit surprised at how simple that was in order to use machine learning,
four time series forecasting.
All I had to do was put my data into a format that can be accepted by machine learning models.
At this point you can plug and chug into any machine learning model you choose.
Now, there's one small note I want to make about this concept which relates to contemporary machine
learning.
So I'm sure you've all heard of the work done in Transformers, which have led to state of the art results
in NLP.
One of the new categories of learning that has come out in recent years is self supervised learning.
One example of this is imagine you have a bunch of text downloaded from Wikipedia in order to train
a language model, say, using a transformer, you simply take a part of your sentence and use the next
word as the label that is your model learns to predicts the next word in a sentence, given previous
words in the sentence.
An alternative set up to this problem would be to predict any middle word in a sentence.
Another example is with images.
So given most of an image, try to figure out the missing part of the image or given a video, try to
predict the next frame of the video.
So hopefully this is sounding familiar.
In fact, what we've done in this course is essentially self supervised learning.
We technically do not have any targets or labels, but we've converted our data into a supervised problem.
One major advantage of this approach is that it allows you to learn from data without requiring labels.
It turns out that labels are pretty expensive to create because you actually have to pay someone to
sit down and make these labels.
It also turns out that, unsurprisingly, human error is a big problem with this process.
So you end up having labels which are incorrect.
Self supervised learning allows us to learn from essentially all existing data on the Internet, which
would be infeasible to label.
So I thought this was just an interesting note to make about how old ideas have been given new names
in the modern era of machine learning.
Note that this also opens the door for time series classification in this case, suppose that we have
an input time series like your brain activity and we'd like to predict what you are thinking about either
food or mathematics.
Well, again, all we have to do is figure out how to put our data into X and Y tables in the next table.
We have the time series.
Call that X one up to X one hundred in the Y table.
We have the label either food or mathematics.
OK, so pretty simple.
At this point, we can also turn our attention to multistep forecasts, as you recall, the Yarema method
of making multistep forecasts is to do so in an incremental fashion.
With machine learning, you can obviously take the same approach because once we get a prediction,
we can just plug it back into the model.
One downside to this method is that you get a problem called error propagation.
What this means is that, well, your first prediction will have some amount of error.
So let's say you just found we have four from white one whites.
Who and why three?
When you put this back into your model, you do not know the true way for you use white hat for which
has an error.
This gives you I had five, which will probably be even more wrong than if you had used the true white
for.
In other words, the error propagates because the errors are compounding over each step.
So one possible solution to this is called the multi output multi-step forecast, the thing to realize
is that your targets, which we've been calling y, are not limited to just being a single column table.
So imagine that we have a forecast horizon of three and the number of lags is also three.
In this case, the first row of X will be Y one way to and Y three.
The first row Y will be Y for Y five and Y six.
There's no reason that the first row of Y has to be only Y four.
In this way our model will have three outputs and we can make a forecast instantly without having to
plug our predictions back into the input.
And because we haven't used predictions to make more predictions, there is no error propagation.
Now one limitations.
This is that not all machine learning models have this capability.
So if you're curious about which ones do and which ones don't.
My advice would be to simply try it and see if it works.
Of course, at some point you probably want to know how your model actually works, but this is a quick
way to find out.
The final question I want to address in this lecture is, why is this approach powerful?
The answer is that most of the models we will study in the section are non-linear.
As you know, from the geometrical perspective, nonlinear models are more flexible and can learn more
complex patterns than simple linear models.
The auto regressive model we studied before is a linear model.
So what we've done here is extremely potent.
We've generalized our problem statements such that it applies to both linear and nonlinear models.
We've allowed ourselves to build Time series models for more complex time series with more complex patterns.
Now it remains to be seen if this actually helps, but at least the possibility exists.