1
00:00:11,100 --> 00:00:16,150
So in this lecture, we are going to discuss how to do change point detection with profit.

2
00:00:16,830 --> 00:00:22,220
Now, as you recall, the change points are actually detected automatically when we call fit because

3
00:00:22,230 --> 00:00:23,730
they are actually part of the model.

4
00:00:24,270 --> 00:00:27,960
This lecture is only about how to visualize what the model has found.

5
00:00:28,650 --> 00:00:32,340
So we'll begin by importing the function, add change points to plot.

6
00:00:37,270 --> 00:00:43,810
The next step is to call em plot passing in the forecast we made earlier, as you recall, you already

7
00:00:43,810 --> 00:00:49,110
know how to do this step, which plots both the original Time series, along with the predictions.

8
00:00:49,750 --> 00:00:54,640
The next step is to simply add the change points on top of that plot by calling the function we just

9
00:00:54,640 --> 00:00:55,330
imported.

10
00:01:01,840 --> 00:01:07,440
OK, so our plot shows that we have one change point where the trend goes from more sleep to less deep,

11
00:01:08,140 --> 00:01:12,400
as you recall, this is what we saw earlier when we plotted the trend to component.

12
00:01:16,170 --> 00:01:19,950
The second step is to do the same thing, but with our second model, M2.

13
00:01:25,910 --> 00:01:30,120
OK, so notice that this time we have many change points within a small area.

14
00:01:30,770 --> 00:01:36,410
Recall that these are governed by the priors so the priors can be tuned to increase or decrease the

15
00:01:36,410 --> 00:01:38,720
sensitivity of the change points.

16
00:01:39,380 --> 00:01:45,260
Remember that by default, the model sets twenty five potential change points in the first 80 percent

17
00:01:45,260 --> 00:01:46,310
of the training data.

18
00:01:46,970 --> 00:01:52,040
So basically what's happening is it's choosing change points from among those twenty five.

19
00:01:52,550 --> 00:01:55,610
So that explains why these change points are equally spaced.

20
00:02:00,320 --> 00:02:04,070
The next step is to do the same thing, but with our third model M three.

21
00:02:10,450 --> 00:02:14,200
So, again, we get pretty much the same result, which is not unexpected.

22
00:02:19,690 --> 00:02:24,160
Now, in this next portion, we're going to see what happens when we tune the prior for change point

23
00:02:24,160 --> 00:02:30,210
detection, the text you see here is copied from the Facebook documentation for a convenience.

24
00:02:30,880 --> 00:02:33,930
So notice that the default is zero point zero five.

25
00:02:34,390 --> 00:02:37,720
If you increase this value, it makes the trend more flexible.

26
00:02:37,910 --> 00:02:41,230
And if you decrease this value, it makes the trend less flexible.

27
00:02:44,980 --> 00:02:49,160
So the next step is to fit a new model with the prior set to zero point five.

28
00:02:49,630 --> 00:02:53,590
This is larger than before, so it will make the change points more flexible.

29
00:03:00,410 --> 00:03:04,630
OK, so as you can see, we now get more change points, which makes sense.

30
00:03:10,180 --> 00:03:15,820
The next step is to try the same thing, but with our second data set, DFB two were the days where

31
00:03:15,820 --> 00:03:21,730
the store is closed or removed again and notice that have increased the prior scale by a factor of 10.

32
00:03:28,550 --> 00:03:33,500
So, again, we see more change points and they aren't all bunched up in one area like before.

33
00:03:35,060 --> 00:03:40,070
So what this tells us is that including all those zeros affects how the change points are detected.

34
00:03:41,120 --> 00:03:43,400
One might consider this to be a cleaner signal.

35
00:03:48,220 --> 00:03:53,350
The next step is to use the same data set again, but this time will decrease the change point prior

36
00:03:53,350 --> 00:03:54,520
by a factor of 10.

37
00:03:55,120 --> 00:03:57,670
This should result in us having less change points.

38
00:04:05,160 --> 00:04:08,260
So, as expected, we have less change points than before.

39
00:04:08,280 --> 00:04:09,440
In fact, we have none.
