diff --git a/README.md b/README.md index 5a307ff..47ef4ef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # eindex -Multidimensional indexing for tensors +Concept of multidimensional indexing for tensors ## Example of K-means clustering @@ -23,9 +23,8 @@ def kmeans(init_centers, X, n_iterations: int): clusters = np.argmin(d, axis=0) new_centers_sum = np.zeros_like(centers) clstr_indices = np.tile(clusters[:, None], reps=(1, n_dim)) - dim___indices = np.tile(np.arange(n_dim)[None, :], - reps=(n_onservations, 1)) - np.add.at(new_centers_sum, (clstr_indices, dim___indices), X) + dim_indices = np.tile(np.arange(n_dim)[None, :], reps=(n_onservations, 1)) + np.add.at(new_centers_sum, (clstr_indices, dim_indices), X) cluster_counts = np.bincount(clusters, minlength=n_clusters) centers = new_centers_sum / cluster_counts[:, None] return centers @@ -40,7 +39,7 @@ def kmeans_eindex(init_centers, X, n_iterations: int): for _ in range(n_iterations): d = cdist(centers, X) clusters = EX.argmin(d, 'cluster i -> [cluster] i') - centers = EX.scatter('i c, [cluster] i -> cluster c', X, clusters, + centers = EX.scatter(X, clusters, 'i c, [cluster] i -> cluster c', agg='mean', cluster=len(centers)) return centers ``` diff --git a/tutorial/data.py b/tutorial/data.py index 783737a..6f56d99 100644 --- a/tutorial/data.py +++ b/tutorial/data.py @@ -16,9 +16,9 @@ def __init__(self): "Yoda", "Alice", "Gandalf", - "R. Daneel Olivaw", + "Harry Potter-Verres", "Devola & Popola", - # "Harry James Potter-Evans-Verres", + # "R. Daneel Olivaw", # Aerith, # Aloy, ] diff --git a/tutorial/tutorial.ipynb b/tutorial/tutorial.ipynb index 1074d8d..4ebbd8f 100644 --- a/tutorial/tutorial.ipynb +++ b/tutorial/tutorial.ipynb @@ -109,7 +109,7 @@ "