So note again, like with

the previous lecture on categorical features,

we don't need to have

a special dimension for January because

January is going to be captured by

the offset time Theta naught.

So essentially, in this case

Theta naught would say what is

the prediction for January,

Theta one would say what's

the difference in prediction for February versus January,

Theta two would say what's the difference in

prediction for March versus January, et cetera.

So equivalently, just to make it

clear that this really is linear model,

we can write it down as an inner product like the

following where we would say the rating is

equal to Theta dot product with

x for our feature vector x is given

by this 12 dimensional vector

with ones in the first position for our offset time,

and then an additional

one in the second position if it's February,

in the third position if it's March,

in the fourth position if it's April, et cetera.

So again, this is going to be a one-hot-encoding,

exactly like we saw in the categorical features lecture.

So this is a very flexible type

of feature representation.

It's going to be able to

handle complex shapes, periodicity,

just by using the

one-hot-encoding to fit a piecewise function.

If we wanted, we can easily increase or decrease

the resolution of this function for

a week or an entire season,

just by changing how fine grained our encoding was.

Also, we could extend this by

combining multiple types of encodings together.

We might think that

seasonality in some data set at the level of

a week and there's also

seasonality at the level of a year.

In other words, maybe people who make purchases have

certain preferences depending on

whether it's Monday or Friday,

and they also have certain preferences

depending on whether it's winter or summer.

So we can easily combine those two things together just

by concatenating two one-hot-encodings.

So here we would just say the rating is equal to

Theta dot product with x1 concatenated with x2,

where x1 was our one-hot-encoding for the month,

and x2 is our one-hot-encoding for the day.

Okay, so to summarize,

we have motivated the use of piecewise functions as

a means of modeling temporal or periodic data,

and we've described how one-hot-encodings

can be used to do this.

So on your own,

you might think about the types of

piecewise functions you would use

to model demand in Amazon.

So if you're trying to predict demand,

is it going to be important to capture

the day of the week or the day of the month,

and how would you incorporate

one-off events like significant holidays?

How do you extend

your one-hot-encoding to account

for the day being Christmas,

or New Years, or July fourth?