# `Concept`

### *class* capymoa.stream.drift.Concept[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/drift.py#L742)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

A concept and the number of instances it contributes to the stream.

Used by the *range* form of [`DriftStream`](capymoa.stream.drift.DriftStream.md#capymoa.stream.drift.DriftStream), which specifies how long
each concept lasts instead of where each drift lands:

```pycon
>>> 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 [`Stream`](capymoa.stream.Stream.md#capymoa.stream.Stream) has 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_instances` places the drifts; it does not ration instances.
Around an [`AbruptDrift`](capymoa.stream.drift.AbruptDrift.md#capymoa.stream.drift.AbruptDrift) it is exact, because the switch is a
step. Around a [`GradualDrift`](capymoa.stream.drift.GradualDrift.md#capymoa.stream.drift.GradualDrift) the 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. See
[`GradualDrift`](capymoa.stream.drift.GradualDrift.md#capymoa.stream.drift.GradualDrift) for the shape of the ramp.

#### \_\_init_\_(stream, num_instances: [int](https://docs.python.org/3/builtins/functions.html#int))[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/drift.py#L774)

* **Parameters:**
  * **stream** – The concept to draw instances from.
  * **num_instances** – How many instances this concept contributes.

#### get_schema()[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/drift.py#L786)
