Simple InterfaceΒΆ

seg1d.segment_data(r, t, w, minS, maxS, step)[source]

Segmentation manager for interfacing with Segmenter class

Find segments of a reference dataset in a target dataset using a rolling correlation of n number of reference examples with a peak detection applied to the average of m reference features with weights applied to each feature.

Parameters:
rList[Dict[key,numpy.array]]

reference data of form [ {(feature Key): [data array] }, {(feature Key): [data array] } ]

tDict[key,numpy.array]

target data of form { (feature Key): [data array] }

wDict[key,float] or None

Weights of form { (feature key):float,(feature key):float }

minSint

Minimum scale to apply for reference data

maxSint

Maximum scale to apply for reference data

stepint

Size of step to use in rolling correlation

Returns:
3 x n array

segments of form [start of segment,end of segment,correlation score]

Examples

>>> import numpy as np

First we import sample data from the examples folder that has multiple features derived from motion capture data

>>> import seg1d
>>> r,t,w = seg1d.sampleData()

Then we define some segmentation parameters such as the scaling percentage of the reference data and index stepping to use in rolling correlation

>>> minW = 70 # percent to scale down reference data
>>> maxW = 150 # percent to scale up reference data
>>> step = 1 #step to use for correlating reference to target data

Finally we call the segmentation algorithm

>>> np.around(seg1d.segment_data(r,t,w,minW,maxW,step),7)
array([[207.       , 240.       ,   0.9124224],
       [342.       , 381.       ,   0.8801901],
       [ 72.       , 112.       ,   0.8776795]])

Previous topic

Code Reference

Next topic

Segmenter Class