Created
April 10, 2018 13:45
-
-
Save iphysresearch/5caed5bdeda23668e1b098b924bd26e8 to your computer and use it in GitHub Desktop.
S_Dbw_part3.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 Dens_bw(self): | |
density_list = [] | |
result = 0 | |
# 下面的变量 density_list 列表将会算出每个对应单类的密度值。 | |
for i in range(self.k): | |
density_list.append(self.density(density_list=[i])) # i 是循环类别标签 | |
# 开始循环排列 | |
for i in range(self.k): | |
for j in range(self.k): | |
if i==j: | |
continue | |
result += self.density([i,j])/max(density_list[i],density_list[j]) | |
return result/(self.k*(self.k-1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment