@numpyonly
def test_clustering_centroid():
    with util_numpy.test_uses_numpy() as np:
        s = np.array([[0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [1.0, 2, 0, 0, 0, 0, 0, 1, 1]])
        model = clustering.KMedoids(dtw.distance_matrix_fast, {}, k=3, show_progress=False)
        try:
            cluster_idx = model.fit(s)
        except PyClusteringException:
            return
        if (not dtwvis.test_without_visualization()):
            if directory:
                png_fn = os.path.join(directory, 'centroid.png')
            else:
                file = tempfile.NamedTemporaryFile()
                png_fn = (file.name + '_centroid.png')
            model.plot(png_fn)
            print('Figure saved to', png_fn)
@numpyonly
def test_clustering_centroid():
    with util_numpy.test_uses_numpy() as np:
        s = np.array([[0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [1.0, 2, 0, 0, 0, 0, 0, 1, 1]])
        model = clustering.KMedoids(dtw.distance_matrix_fast, {}, k=3, show_progress=False)
        try:
            cluster_idx = model.fit(s)
        except PyClusteringException:
            return
        if (not dtwvis.test_without_visualization()):
            if directory:
                png_fn = os.path.join(directory, 'centroid.png')
            else:
                file = tempfile.NamedTemporaryFile()
                png_fn = (file.name + '_centroid.png')
            model.plot(png_fn)
            print('Figure saved to', png_fn)