Particionamento pelo c-means completo

This commit is contained in:
Petrônio Cândido de Lima e Silva 2016-12-21 15:16:16 -02:00
parent 8cdbfbf537
commit 41c264be7a

View File

@ -72,4 +72,19 @@ def c_means(k, dados, tam):
iteracoes = iteracoes + 1 iteracoes = iteracoes + 1
return centroides return centroides
def CMeansPartitionerTrimf(data,npart,names = None,prefix = "A"):
sets = []
dmax = max(data)
dmax = dmax + dmax*0.10
dmin = min(data)
dmin = dmin - dmin*0.10
centroides = c_means(npart, data, 1)
centroides.append(dmax)
centroides.append(dmin)
centroides.sort()
for c in np.arange(1,len(centroides)-1):
sets.append(common.FuzzySet(prefix+str(c),common.trimf,[round(centroides[c-1],3), round(centroides[c],3), round(centroides[c+1],3)], round(centroides[c],3) ) )
return sets