From 41c264be7a34805dd340aceca968324ff5988bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido=20de=20Lima=20e=20Silva?= Date: Wed, 21 Dec 2016 15:16:16 -0200 Subject: [PATCH] Particionamento pelo c-means completo --- partitioners/CMeans.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/partitioners/CMeans.py b/partitioners/CMeans.py index 8051dd4..70ec288 100644 --- a/partitioners/CMeans.py +++ b/partitioners/CMeans.py @@ -72,4 +72,19 @@ def c_means(k, dados, tam): iteracoes = iteracoes + 1 - return centroides \ No newline at end of file + 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