intervals to maskΒΆ

path: mlstars.custom.timeseries_preprocessing.intervals_to_mask

description: this primitive creates boolean mask from given intervals.

see json.

argument

type

description

parameters

index

numpy.ndarray

array containing the index values

intervals

list or numpy.ndarray

list or array of intervals, consisting of start-index and end-index for each interval

output

mask

numpy.ndarray

array of boolean values, with one boolean value for each index value (True if the index value is contained in a given interval)

In [1]: import numpy as np

In [2]: from mlstars import load_primitive

In [3]: primitive = load_primitive('mlstars.custom.timeseries_preprocessing.intervals_to_mask')

In [4]: index = np.array(range(10))

In [5]: intervals = [(1, 3), (7, 7)]

In [6]: primitive.produce(index=index, intervals=intervals)
Out[6]: 
array([False,  True,  True,  True, False, False, False,  True, False,
       False])