AnomalyDetection: Anomaly Detection Using Seasonal Hybrid Extreme Studentized Deviate Test

異常検知

> library(AnomalyDetection)
> data("raw_data")

バージョン: 1.0


関数名 概略
AnomalyDetectionTs Anomaly Detection Using Seasonal Hybrid ESD Test
AnomalyDetectionVec Anomaly Detection Using Seasonal Hybrid ESD Test
raw_data raw_data

AnomalyDetectionTs

異常検知

Arguments

  • x
  • max_anoms
  • direction... 検出の基準。過剰な時 (pos)、不足な時 (neg)、両方 (both)
  • alpha
  • only_last
  • threshold
  • e_value
  • longterm
  • piecewise_median_period_weeks
  • plot
  • y_log
  • xlabel
  • ylabel
  • title
  • verbose
> AnomalyDetectionTs(raw_data, max_anoms = 0.02, direction = 'both', plot = FALSE)

plot of chunk usage_AnomalyDetectionTs

$anoms
              timestamp    anoms
1   1980-09-25 16:05:00  21.3510
2   1980-09-29 06:40:00 193.1036
3   1980-09-29 21:44:00 148.1740
4   1980-09-30 17:46:00  52.7478
5   1980-09-30 17:48:00  49.6582
6   1980-09-30 17:50:00  35.6067
7   1980-09-30 17:51:00  32.5045
8   1980-09-30 17:52:00  30.0555
9   1980-09-30 17:53:00  31.2614
10  1980-09-30 17:54:00  30.2551
11  1980-09-30 17:55:00  27.3860
12  1980-09-30 17:56:00  28.9807
13  1980-09-30 17:57:00  29.0844
14  1980-09-30 17:58:00  26.9185
15  1980-09-30 17:59:00  26.4621
16  1980-09-30 18:00:00  27.2180
17  1980-09-30 18:01:00  40.4268
18  1980-09-30 18:02:00  28.8811
19  1980-09-30 18:03:00  27.1294
20  1980-09-30 18:04:00  26.9913
21  1980-09-30 18:05:00  26.7741
22  1980-09-30 18:06:00  30.6972
23  1980-09-30 18:07:00  27.6085
24  1980-09-30 18:08:00  25.2841
25  1980-09-30 18:09:00  25.2264
26  1980-09-30 18:10:00  25.1927
27  1980-09-30 18:11:00  27.6501
28  1980-09-30 18:12:00  24.8858
29  1980-09-30 18:13:00  24.8099
30  1980-09-30 18:14:00  24.2950
31  1980-09-30 18:15:00  24.5221
32  1980-09-30 18:16:00  26.7354
33  1980-09-30 18:17:00  24.7589
34  1980-09-30 18:18:00  25.6300
35  1980-09-30 18:19:00  24.6949
36  1980-09-30 18:20:00  23.6518
37  1980-09-30 18:21:00  27.6977
38  1980-09-30 18:22:00  25.8687
39  1980-09-30 18:23:00  24.6654
40  1980-09-30 18:24:00  24.6694
41  1980-09-30 18:25:00  24.4351
42  1980-09-30 18:26:00  25.7723
43  1980-09-30 18:27:00  24.2502
44  1980-09-30 18:28:00  25.0965
45  1980-09-30 18:29:00  23.9362
46  1980-09-30 18:30:00  24.4127
47  1980-09-30 18:31:00  32.8182
48  1980-09-30 18:32:00  27.4586
49  1980-09-30 18:33:00  26.3163
50  1980-09-30 18:34:00  30.3965
51  1980-09-30 18:35:00  26.9516
52  1980-09-30 18:36:00  26.8908
53  1980-09-30 18:37:00  28.9461
54  1980-09-30 18:38:00  28.9742
55  1980-09-30 18:39:00  30.0406
56  1980-09-30 18:40:00  28.8507
57  1980-09-30 18:41:00  32.7811
58  1980-09-30 18:42:00  27.7468
59  1980-09-30 18:43:00  30.8174
60  1980-09-30 18:44:00  28.5658
61  1980-09-30 18:45:00  27.6677
62  1980-09-30 18:46:00  31.0409
63  1980-09-30 20:16:00 154.7750
64  1980-09-30 20:17:00 148.8620
65  1980-09-30 20:23:00 165.7870
66  1980-09-30 20:24:00 167.5850
67  1980-09-30 20:25:00 170.3490
68  1980-09-30 20:26:00 180.8990
69  1980-09-30 20:27:00 170.5130
70  1980-09-30 20:28:00 174.6780
71  1980-09-30 20:29:00 164.7350
72  1980-09-30 20:30:00 178.8220
73  1980-09-30 20:31:00 198.3260
74  1980-09-30 20:32:00 203.9010
75  1980-09-30 20:33:00 200.3090
76  1980-09-30 20:34:00 178.4910
77  1980-09-30 20:35:00 167.7480
78  1980-09-30 20:36:00 183.0180
79  1980-09-30 20:37:00 176.7690
80  1980-09-30 20:38:00 186.8230
81  1980-09-30 20:39:00 183.6600
82  1980-09-30 20:40:00 179.2760
83  1980-09-30 20:41:00 197.2830
84  1980-09-30 20:42:00 191.0970
85  1980-09-30 20:43:00 194.6700
86  1980-09-30 20:44:00 177.3250
87  1980-09-30 20:45:00 173.7580
88  1980-09-30 20:46:00 200.8160
89  1980-09-30 20:47:00 186.2350
90  1980-09-30 20:48:00 185.4210
91  1980-09-30 20:49:00 178.9580
92  1980-09-30 20:50:00 171.7500
93  1980-09-30 20:51:00 203.2310
94  1980-09-30 20:52:00 181.3540
95  1980-09-30 20:53:00 186.7780
96  1980-09-30 20:54:00 175.5820
97  1980-09-30 20:55:00 176.1250
98  1980-09-30 20:56:00 181.5140
99  1980-09-30 20:57:00 175.2610
100 1980-09-30 20:58:00 164.7190
101 1980-09-30 21:01:00 170.7360
102 1980-09-30 21:02:00 151.5490
103 1980-09-30 21:03:00 149.4120
104 1980-09-30 21:04:00 150.5540
105 1980-09-30 21:06:00 149.5410
106 1980-10-02 23:20:00 188.2908
107 1980-10-05 01:12:00  56.4691
108 1980-10-05 01:13:00  54.9415
109 1980-10-05 01:14:00  52.0359
110 1980-10-05 01:15:00  47.7313
111 1980-10-05 01:16:00  50.5876
112 1980-10-05 01:17:00  48.2846
113 1980-10-05 01:18:00  44.6438
114 1980-10-05 01:19:00  42.3077
115 1980-10-05 01:20:00  38.8363
116 1980-10-05 01:21:00  41.0145
117 1980-10-05 01:22:00  39.5523
118 1980-10-05 01:23:00  38.9117
119 1980-10-05 01:24:00  37.3052
120 1980-10-05 01:25:00  36.1725
121 1980-10-05 01:26:00  37.5150
122 1980-10-05 01:27:00  38.1387
123 1980-10-05 01:28:00  39.5351
124 1980-10-05 01:29:00  38.1834
125 1980-10-05 01:30:00  37.5988
126 1980-10-05 01:31:00  43.6522
127 1980-10-05 01:32:00  47.9571
128 1980-10-05 13:08:00 210.0000
129 1980-10-05 13:18:00  40.0000
130 1980-10-05 13:28:00 250.0000
131 1980-10-05 13:38:00  40.0000

$plot
NULL

AnomalyDetectionVec

Arguments

  • x
  • max_anoms
  • direction
  • alpha
  • period
  • only_last
  • threshold
  • e_value
  • longterm_period
  • plot
  • y_log
  • xlabel
> AnomalyDetectionVec(raw_data[,2], max_anoms = 0.02, period = 1440, direction = 'both', plot = FALSE)

plot of chunk usage_AnomalyDetectionVec

$anoms
    index    anoms
1     125  21.3510
2    5320 193.1036
3    6224 148.1740
4    7426  52.7478
5    7428  49.6582
6    7430  35.6067
7    7431  32.5045
8    7432  30.0555
9    7433  31.2614
10   7434  30.2551
11   7435  27.3860
12   7436  28.9807
13   7437  29.0844
14   7438  26.9185
15   7439  26.4621
16   7440  27.2180
17   7441  40.4268
18   7442  28.8811
19   7443  27.1294
20   7444  26.9913
21   7445  26.7741
22   7446  30.6972
23   7447  27.6085
24   7448  25.2841
25   7449  25.2264
26   7450  25.1927
27   7451  27.6501
28   7452  24.8858
29   7453  24.8099
30   7454  24.2950
31   7455  24.5221
32   7456  26.7354
33   7457  24.7589
34   7458  25.6300
35   7459  24.6949
36   7460  23.6518
37   7461  27.6977
38   7462  25.8687
39   7463  24.6654
40   7464  24.6694
41   7465  24.4351
42   7466  25.7723
43   7467  24.2502
44   7468  25.0965
45   7469  23.9362
46   7470  24.4127
47   7471  32.8182
48   7472  27.4586
49   7473  26.3163
50   7474  30.3965
51   7475  26.9516
52   7476  26.8908
53   7477  28.9461
54   7478  28.9742
55   7479  30.0406
56   7480  28.8507
57   7481  32.7811
58   7482  27.7468
59   7483  30.8174
60   7484  28.5658
61   7485  27.6677
62   7486  31.0409
63   7576 154.7750
64   7577 148.8620
65   7583 165.7870
66   7584 167.5850
67   7585 170.3490
68   7586 180.8990
69   7587 170.5130
70   7588 174.6780
71   7589 164.7350
72   7590 178.8220
73   7591 198.3260
74   7592 203.9010
75   7593 200.3090
76   7594 178.4910
77   7595 167.7480
78   7596 183.0180
79   7597 176.7690
80   7598 186.8230
81   7599 183.6600
82   7600 179.2760
83   7601 197.2830
84   7602 191.0970
85   7603 194.6700
86   7604 177.3250
87   7605 173.7580
88   7606 200.8160
89   7607 186.2350
90   7608 185.4210
91   7609 178.9580
92   7610 171.7500
93   7611 203.2310
94   7612 181.3540
95   7613 186.7780
96   7614 175.5820
97   7615 176.1250
98   7616 181.5140
99   7617 175.2610
100  7618 164.7190
101  7621 170.7360
102  7622 151.5490
103  7623 149.4120
104  7624 150.5540
105  7626 149.5410
106 10640 188.2908
107 13632  56.4691
108 13633  54.9415
109 13634  52.0359
110 13635  47.7313
111 13636  50.5876
112 13637  48.2846
113 13638  44.6438
114 13639  42.3077
115 13640  38.8363
116 13641  41.0145
117 13642  39.5523
118 13643  38.9117
119 13644  37.3052
120 13645  36.1725
121 13646  37.5150
122 13647  38.1387
123 13648  39.5351
124 13649  38.1834
125 13650  37.5988
126 13651  43.6522
127 13652  47.9571
128 14348 210.0000
129 14358  40.0000
130 14368 250.0000
131 14378  40.0000

$plot
NULL

raw_data

観測数を含んだ時系列データ

> data("raw_data")
> raw_data %>% {
+   class(.) %>% print()
+   dplyr::glimpse(.)
+ }
[1] "data.frame"
Observations: 14,398
Variables: 2
$ timestamp (time) 1980-09-25 14:01:00, 1980-09-25 14:02:00, 1980-09-2...
$ count     (dbl) 182.478, 176.231, 183.917, 177.798, 165.469, 181.878...