OK, so let's recap what kinds of problems we can solve.
So far, we now know how to build a feed for neural network.
This can handle two dimensional input arrays of size.
And by these so in samples and features, in other words, just tabular data because of the rule, all
data is the same.
This can also handle univariate time series of shape and by t, just like we learned about in the machine
learning section.
And of course this applies to both classification and regression.
The next question to consider is how we might handle multivariate time series.
And this is because Human Activity Recognition is a multivariate time series.
Now, one option would be to do the naive thing, suppose that we have a D dimensional time series and
each time series has length T, so in effect, each sample has the shape TBD.
Well, what we could do is simply flatten this into a single vector of size t times the then our feet
for a neural network would take an inputs of shape and by T times d but this is not ideal since it treats
every point equally.
We know that there is a special structure, two time series that we might want to take advantage of.
Suppose that we wanted to have a separate neuron for each dimension of the Time series, this would
allow that single neuron to learn the temporal structure of that dimension's time series.
This would give us some possibly useful feature vector.
Then we could combine these feature vectors into a single large feature vector that represents the features
for all the dimensions.
We could then pass this through a final dense layer as usual.
So because this model has multiple separate inputs, I refer to this as a multi tale's and neural network.
You might wonder why this is not called a multiheaded neural network.
The reason for this is we typically think of the output as the head or the top, and so by default,
so the input becomes the tail.
You can think of this as a kind of multi tailed beast, although I hear that this name has been taken.
OK, so the next question to answer is, how do we build a multi tailored neural network?
The main idea to keep in mind is there wherever you previously passed in a single input, it's also
acceptable to pass out a list or tuple of inputs.
Note that in other applications, it's possible to have multiple outputs as well.
And this follows the same principle.
In this class, we generally won't deal with multiple outputs, but it should be comforting to know
that the API sensible.
OK, so what should you do if you want multiple inputs?
Well, you simply create multiple input objects for this example.
Let's just say that D is equal to three.
So we effectively have three time series each wavelength t.
The next step is to create a dense layer for each of these inputs, so basically you can think of these
as like three parallel neural networks.
Now, technically, you could add more layers, but I leave that to you to try by yourself for this
simple example.
The next step will be to combine the output of these parallel neural networks together.
Remember that you can think of neural networks as like transforming input vectors into feature vectors.
So at this point, after passing each input time series through their own neural network, we now have
a set of feature vectors for each of those Times series.
So to combine each of these feature vectors together, we will use concatenation in a picture you can
imagine simply lining up each of the feature vectors side by side to make one gigantic feature vector
intenser flow.
This can be done using the contaminate layer.
Now, at this point, we have a feature vector which can be passed through yet more dense layers, in
other words, through another neural network, for this example, we'll just have one layer to keep
things simple.
At this point, the number of outputs of the final layer should correspond to the task.
So if you're doing multiclass classification with K classes, then you'll have key outputs.
The next thing we should discuss in this lecture is how to create your model objects.
Previously, when we only had one input, we instantiated a model object by passing in that single input
along with the corresponding output when you have multiple inputs.
You simply pass them into the first argument as a list or a tuple.
Same goes if you had multiple outputs.
Now, since your model has multiple inputs, this is going to change how you call a fit and predicts
functions, but again, it follows the same pattern as before.
So when you call a function, your first argument will now be a list of input arrays, since our multivariate
time series will have the shape.
And by TBD, if we index this in the final dimension, we'll get an array of shape and by T which are
neural network will accept the same thing applies to predict.
OK, so instead of a single input array, you now have a list of input arrays, specifically a list
of length D where each element is an array of shape and by T.
OK, so here's one last look at the multi tailed neural network for multivariate time series.
Now, in practice, keep in mind that these can be pretty large.
So you might want to use a for loop instead of trying to create each input one by one.
Again, it's a pretty simple pattern to follow anywhere.
You previously had a single input array.
You now have a list of input arrays.