ConceptDriftStreamΒΆ
Generates a stream with concept drift.
A stream generator that adds concept drift or change by joining two streams. This is done by building a weighted combination of two pure distributions that characterizes the target concepts before and after the change.
The sigmoid function is an elegant and practical solution to define the probability that each new instance of the stream belongs to the new concept after the drift. The sigmoid function introduces a gradual, smooth transition whose duration is controlled with two parameters:
-
, the position of the change. -
, the width of the transition.
The sigmoid function at sample
ParametersΒΆ
-
stream (river.datasets.base.SyntheticDataset) β defaults to
None
Original stream
-
drift_stream (river.datasets.base.SyntheticDataset) β defaults to
None
Drift stream
-
position (int) β defaults to
5000
Central position of the concept drift change.
-
width (int) β defaults to
1000
Width of concept drift change.
-
seed (int) β defaults to
None
If int,
seed
is used to seed the random number generator; If RandomState instance,seed
is the random number generator; If None, the random number generator is theRandomState
instance used bynp.random
. -
alpha (float) β defaults to
None
Angle of change used to estimate the width of concept drift change. If set, it will override the width parameter. Valid values are in the range (0.0, 90.0].
AttributesΒΆ
-
desc
Return the description from the docstring.
ExamplesΒΆ
>>> from river import synth
>>> dataset = synth.ConceptDriftStream(stream=synth.SEA(seed=42, variant=0),
... drift_stream=synth.SEA(seed=42, variant=1),
... seed=1, position=5, width=2)
>>> for x, y in dataset.take(10):
... print(x, y)
{0: 6.3942, 1: 0.2501, 2: 2.7502} False
{0: 2.2321, 1: 7.3647, 2: 6.7669} True
{0: 6.3942, 1: 0.2501, 2: 2.7502} False
{0: 8.9217, 1: 0.8693, 2: 4.2192} True
{0: 2.2321, 1: 7.3647, 2: 6.7669} True
{0: 8.9217, 1: 0.8693, 2: 4.2192} True
{0: 0.2979, 1: 2.1863, 2: 5.0535} False
{0: 0.2653, 1: 1.9883, 2: 6.4988} False
{0: 5.4494, 1: 2.2044, 2: 5.8926} False
{0: 8.0943, 1: 0.0649, 2: 8.0581} False
MethodsΒΆ
take
Iterate over the k samples.
Parameters
- k (int)
NotesΒΆ
An optional way to estimate the width of the transition