Skip to content

Instantly share code, notes, and snippets.

@iphysresearch
Last active April 10, 2018 14:09
Show Gist options
  • Save iphysresearch/dbd440a8ba7bb1595daedc6ebdb097d6 to your computer and use it in GitHub Desktop.
Save iphysresearch/dbd440a8ba7bb1595daedc6ebdb097d6 to your computer and use it in GitHub Desktop.
S_Dbw_part4.py
def Scat(self):
# 分母部分:
sigma_s = np.std(self.data,axis=0)
sigma_s_2norm = np.sqrt(np.dot(sigma_s.T,sigma_s))
# 分子部分:
sum_sigma_2norm = 0
for i in range(self.k):
matrix_data_i = self.data[self.data_cluster == i]
sigma_i = np.std(matrix_data_i,axis=0)
sum_sigma_2norm += np.sqrt(np.dot(sigma_i.T,sigma_i))
return sum_sigma_2norm/(sigma_s_2norm*self.k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment