def centroid(vectors=[], features=[]):
    c = []
    for v in vectors:
        if isinstance(v, Cluster):
            c.extend(v.flatten())
        elif isinstance(v, Document):
            c.append(v.vector)
        else:
            c.append(v)
    if not features:
        features = _features(c)
    c = [(f, mean((v.get(f, 0) for v in c), len(c))) for f in features]
    c = Vector((f, w) for f, w in c if w != 0)
    return c
Locks the operations on the state for use in threads
dataset/ETHPy150Open clips/pattern/pattern/vector/__init__.py/centroid--crossover with--dataset/ETHPy150Open duerrp/pyexperiment/pyexperiment/state_context.py/thread_state_context