Python practice
The installation in this chapter is very simple, since, in this chapter, we'll only use River. We can quickly install it from the terminal (or similarly from Anaconda Navigator):
pip install river
We'll execute the commands from the Python (or IPython) terminal, but equally, we could execute them from a Jupyter notebook (or a different environment).
Drift detection
Let's start off by trying out drift detection with an artificial time-series. This follows the example in the tests of the River library.
We'll first create an artificial time-series that we can test:
import numpy as np
np.random.seed(12345)
data_stream = np.concatenate(
(np.random.randint(2, size=1000), np.random.randint(8, size=1000))
)
This time-series is composed of two series that have different characteristics. Let's see how quickly the drift detection algorithms pick up on this.
Running the drift detector over this means iterating over...