COP-Kmeans
COP-Kmeans copied to clipboard
A Python implementation of COP-KMEANS algorithm
Hi Behrouz, I am looking into your implementation (new to COP-Kmeans). I would like to train the classification COP-Kmeans on a train set with constrains and then try it on...
When using `kmpp` initialisation, `chances` vector keeps decreasing till the point at which the [following code line](https://github.com/Behrouz-Babaki/COP-Kmeans/blob/36ca01fbf001c9bf080408074c2f46838257c14b/copkmeans/cop_kmeans.py#L69): ``` chances = [x/sum(chances) for x in chances] ``` produces a `ZeroDivisionError` error...
Functions [`closest_cluster`](https://github.com/Behrouz-Babaki/copkmeans/blob/3c9d7b72ebbf59d3a78baedaf563de616f201bf5/copkmeans/cop_kmeans.py#L55) and [`compute_centers`](https://github.com/Behrouz-Babaki/copkmeans/blob/3c9d7b72ebbf59d3a78baedaf563de616f201bf5/copkmeans/cop_kmeans.py#L97) might take a lot of time to run. Also the loop of assigning instances to clusters can incur some computational cost. We should profile the code...
When the number of clusters is larger than the number of instances, a `division by zero` exception is raised. Handle this error gracefully.
Sometimes the algorithm does not detect the inconsistency between constraints.