subhadarship / kmeans_pytorch

kmeans using PyTorch
https://subhadarship.github.io/kmeans_pytorch
MIT License
479 stars 77 forks source link

fix 'center_shift=nan' bug and add a dependency 'numba' for installing from source #38

Open yangnianzu0515 opened 1 year ago

yangnianzu0515 commented 1 year ago

Dear,

When running the code, I also encountered the "center_shift=nan" bug (which was also reported in issue #3). I would like to thank @GenjiB for identifying the issue: "If a cluster_center is an outlier, there are no neighbor points to calculate the mean point. To calculate the mean of none points results in Nan."

@GenjiB also proposed a solution that worked for me. To facilitate the use of this solution by others, we have modified the source code accordingly. Additionally, we found that numbda needs to be installed before running the code from source, and we have added a corresponding prompt in the ReadMe file.

Best regards, Nianzu Yang