2020def k_means (tss , k , tolerance = 1e-10 , max_iterations = 100 ):
2121 """ Calculates the K-Means algorithm.
2222
23+ [1] S. Lloyd. 1982. Least squares quantization in PCM. IEEE Transactions on Information Theory, 28, 2,
24+ Pages 129-137.
25+
2326 :param tss: Expects an input array whose dimension zero is the length of the time series (all the same) and
2427 dimension one indicates the number of time series.
2528 :param k: The number of means to be computed.
2629 :param tolerance: The error tolerance to stop the computation of the centroids.
2730 :param max_iterations: The maximum number of iterations allowed.
31+
32+ :return: Tuple with an array of centroids and array of labels.
2833 """
2934 centroids = ctypes .c_void_p (0 )
3035 labels = ctypes .c_void_p (0 )
@@ -42,11 +47,17 @@ def k_means(tss, k, tolerance=1e-10, max_iterations=100):
4247def k_shape (tss , k , tolerance = 1e-10 , max_iterations = 100 ):
4348 """ Calculates the K-Shape algorithm.
4449
50+ [1] John Paparrizos and Luis Gravano. 2016. k-Shape: Efficient and Accurate Clustering of Time Series.
51+ SIGMOD Rec. 45, 1 (June 2016), 69-76.
52+
53+
4554 :param tss: Expects an input array whose dimension zero is the length of the time series (all the same) and
4655 dimension one indicates the number of time series.
4756 :param k: The number of means to be computed.
4857 :param tolerance: The error tolerance to stop the computation of the centroids.
4958 :param max_iterations: The maximum number of iterations allowed.
59+
60+ :return: Tuple with an array of centroids and array of labels.
5061 """
5162 centroids = ctypes .c_void_p (0 )
5263 labels = ctypes .c_void_p (0 )
0 commit comments