cd6689c12ac4db6489116147b50dfda73e356379,mla/kmeans.py,KMeans,_choose_next_center,#KMeans#,118
Before Change
distances = self._dist_from_centers()
probs = distances / distances.sum()
cumprobs = probs.cumsum()
r = random.random()
ind = np.where(cumprobs >= r)[0][0]
return self.X[ind]
def _is_converged(self, centroids_old, centroids):
Check if the distance between old and new centroids is zero.
After Change
distances = self._dist_from_centers()
squared_distances = distances**2
probs = squared_distances/squared_distances.sum()
ind = np.random.choice(self.X.shape[0] , 1, p=probs)[0]
return self.X[ind]
def _is_converged(self, centroids_old, centroids):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: rushter/MLAlgorithms
Commit Name: cd6689c12ac4db6489116147b50dfda73e356379
Time: 2019-01-07
Author: mimifasosofamire1123@gmail.com
File Name: mla/kmeans.py
Class Name: KMeans
Method Name: _choose_next_center
Project Name: aertslab/pySCENIC
Commit Name: 6d6a32dd677aa6097c4e77b359f81989c3e949af
Time: 2018-04-05
Author: vandesande.bram@gmail.com
File Name: src/pyscenic/rnkdb.py
Class Name:
Method Name: build_rankings
Project Name: PIQuIL/QuCumber
Commit Name: a3645eada1fd6b0dc2f262033a93b81a6ca84b55
Time: 2019-12-23
Author: emerali@users.noreply.github.com
File Name: qucumber/utils/unitaries.py
Class Name:
Method Name: _rotate_basis_state