Concept#
- class capymoa.stream.drift.Concept[source]#
Bases:
objectA concept and the number of instances it contributes to the stream.
Used by the range form of
DriftStream, which specifies how long each concept lasts instead of where each drift lands:>>> from capymoa.stream.drift import Concept, DriftStream, AbruptDrift >>> from capymoa.stream.generator import SEA >>> stream = DriftStream(stream=[ ... Concept(SEA(function=1), num_instances=1000), ... AbruptDrift(), ... Concept(SEA(function=3), num_instances=500), ... ]) >>> print(stream.get_drifts()[0]) AbruptDrift(position=1000)
The wrapper exists because
Streamhas no notion of a length: MOA generators are unbounded, and giving every stream a length to serve this one API would not survive contact with them.Note
num_instancesplaces the drifts; it does not ration instances. Around anAbruptDriftit is exact, because the switch is a step. Around aGradualDriftthe two concepts overlap, so both contribute while the transition runs, and with the default sigmoid the older concept keeps appearing – with diminishing probability – past the nominal end of the window. A concept declared as 500 instances may therefore be drawn from rather more often than 500 times. SeeGradualDriftfor the shape of the ramp.