Skip to content

k-means clustering: ncluster value other than 2 #251

@RajeshKumarS

Description

@RajeshKumarS

Setting ncluster to greater than 2 (tried with 3 & 4) gives the following error:

IndexError: arrays used as indices must be of integer (or boolean) type.

Following is the full dump:

Time: 0.0
Traceback (most recent call last):
File "d:/apps/PythonRobotics-master/Mapping/kmeans_clustering/kmeans_clustering.py", line 179, in
main()
File "d:/apps/PythonRobotics-master/Mapping/kmeans_clustering/kmeans_clustering.py", line 161, in main
clusters = kmeans_clustering(rx, ry, ncluster)
File "d:/apps/PythonRobotics-master/Mapping/kmeans_clustering/kmeans_clustering.py", line 41, in kmeans_clustering
clusters = calc_centroid(clusters)
File "d:/apps/PythonRobotics-master/Mapping/kmeans_clustering/kmeans_clustering.py", line 54, in calc_centroid
x, y = calc_labeled_points(ic, clusters)
File "d:/apps/PythonRobotics-master/Mapping/kmeans_clustering/kmeans_clustering.py", line 88, in calc_labeled_points
x = tx[inds]
IndexError: arrays used as indices must be of integer (or boolean) type

Also, I still got two clusters even if ncluster was set to 1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions