Skip to content

Commit 7b016a8

Browse files
author
Jaime Céspedes Sisniega
authored
Merge pull request #223 from IFCA/feature-bocd
Add Bayesian Online Changepoint Detection method
2 parents cbc572f + e6482a4 commit 7b016a8

File tree

9 files changed

+508
-4
lines changed

9 files changed

+508
-4
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,19 @@ The currently implemented detectors are listed in the following table.
207207
</thead>
208208
<tbody>
209209
<tr>
210-
<td rowspan="12" style="text-align: center; border: 1px solid grey; padding: 8px;">Concept drift</td>
211-
<td rowspan="12" style="text-align: center; border: 1px solid grey; padding: 8px;">Streaming</td>
212-
<td rowspan="3" style="text-align: center; border: 1px solid grey; padding: 8px;">CUMSUM</td>
210+
<td rowspan="13" style="text-align: center; border: 1px solid grey; padding: 8px;">Concept drift</td>
211+
<td rowspan="13" style="text-align: center; border: 1px solid grey; padding: 8px;">Streaming</td>
212+
<td rowspan="1" style="text-align: center; border: 1px solid grey; padding: 8px;">Change detection</td>
213213
<td style="text-align: center; border: 1px solid grey; padding: 8px;">U</td>
214214
<td style="text-align: center; border: 1px solid grey; padding: 8px;">N</td>
215-
<td style="text-align: center; border: 1px solid grey; padding: 8px;">CUMSUM</td>
215+
<td style="text-align: center; border: 1px solid grey; padding: 8px;">BOCD</td>
216+
<td style="text-align: center; border: 1px solid grey; padding: 8px;"><a href="https://doi.org/10.48550/arXiv.0710.3742">Adams and MacKay (2007)</a></td>
217+
</tr>
218+
<tr>
219+
<td rowspan="3" style="text-align: center; border: 1px solid grey; padding: 8px;">CUSUM</td>
220+
<td style="text-align: center; border: 1px solid grey; padding: 8px;">U</td>
221+
<td style="text-align: center; border: 1px solid grey; padding: 8px;">N</td>
222+
<td style="text-align: center; border: 1px solid grey; padding: 8px;">CUSUM</td>
216223
<td style="text-align: center; border: 1px solid grey; padding: 8px;"><a href="https://doi.org/10.2307/2333009">Page (1954)</a></td>
217224
</tr>
218225
<tr>

docs/source/api_reference/detectors/concept_drift/streaming.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ The {mod}`frouros.detectors.concept_drift.streaming` module contains streaming c
1111
```{currentmodule} frouros.detectors.concept_drift.streaming
1212
```
1313

14+
## Change Detection
15+
16+
```{eval-rst}
17+
.. automodule:: frouros.detectors.concept_drift.streaming.change_detection
18+
:no-members:
19+
:no-inherited-members:
20+
```
21+
22+
```{eval-rst}
23+
.. autosummary::
24+
:toctree: auto_generated/
25+
:template: class.md
26+
27+
BOCD
28+
BOCDConfig
29+
```
30+
1431
## CUSUM Test
1532

1633
```{eval-rst}

frouros/detectors/concept_drift/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from .streaming import (
44
ADWIN,
55
ADWINConfig,
6+
BOCD,
7+
BOCDConfig,
68
CUSUM,
79
CUSUMConfig,
810
DDM,
@@ -30,6 +32,8 @@
3032
__all__ = [
3133
"ADWIN",
3234
"ADWINConfig",
35+
"BOCD",
36+
"BOCDConfig",
3337
"CUSUM",
3438
"CUSUMConfig",
3539
"DDM",

frouros/detectors/concept_drift/streaming/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"""Concept drift streaming detection methods init."""
22
# FIXME: Remove pylint disable if batch methods are added
33
# pylint: skip-file
4+
from .change_detection import (
5+
BOCD,
6+
BOCDConfig,
7+
)
8+
49
from .cusum_based import (
510
CUSUM,
611
CUSUMConfig,
@@ -35,6 +40,8 @@
3540
__all__ = [
3641
"ADWIN",
3742
"ADWINConfig",
43+
"BOCD",
44+
"BOCDConfig",
3845
"CUSUM",
3946
"CUSUMConfig",
4047
"DDM",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Concept drift change detection methods' init."""
2+
3+
from .bocd import BOCD, BOCDConfig
4+
5+
__all__ = [
6+
"BOCD",
7+
"BOCDConfig",
8+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Base concept drift ChangeDetection based module."""
2+
3+
import abc
4+
from typing import Union
5+
6+
from frouros.detectors.concept_drift.streaming.base import (
7+
BaseConceptDriftStreaming,
8+
BaseConceptDriftStreamingConfig,
9+
)
10+
11+
12+
class BaseChangeDetectionConfig(BaseConceptDriftStreamingConfig):
13+
"""Class representing a ChangeDetection based configuration class."""
14+
15+
16+
class BaseChangeDetection(BaseConceptDriftStreaming):
17+
"""ChangeDetection based algorithm class."""
18+
19+
config_type = BaseChangeDetectionConfig
20+
21+
@abc.abstractmethod
22+
def _update(self, value: Union[int, float], **kwargs) -> None:
23+
pass

0 commit comments

Comments
 (0)