Last active
April 10, 2018 14:09
-
-
Save iphysresearch/dbd440a8ba7bb1595daedc6ebdb097d6 to your computer and use it in GitHub Desktop.
S_Dbw_part4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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