Skip to content

Commit 5be86f4

Browse files
authored
Adding clustering module to init (#43)
* Adding clustering module to init * Improve documentation
1 parent f647c60 commit 5be86f4

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

khiva/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
99

1010
from khiva.array import *
11+
from khiva.clustering import *
1112
from khiva.dimensionality import *
1213
from khiva.distances import *
1314
from khiva.features import *

khiva/clustering.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020
def 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):
4247
def 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)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
author="Shapelets.io",
2222
author_email="dev@shapelets.io",
2323
name="khiva",
24-
version='0.1.4',
24+
version='0.2.0',
2525
long_description = LONG_DESC,
2626
description="Python bindings for khiva",
2727
license="MPL 2.0",

0 commit comments

Comments
 (0)