Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
def M_intraClasses(self,classList):
somme1 = 0.0
#for each class in the classlist
for i in range(0,len(classList)):
#take a cluster
cluster = classList[i].getListOfGraphems()
s1 = []
#now for each element in the cluster ( s1 is f(x,y) which contains values, so s1 will contain vectors instead of values)
for sommet in range(0,len(cluster)):
s1.append(self.sub[sommet,:])
#take fmax and fmin
fmax = amax(s1)
fmin = amin(s1)
#compute the standard deviation divided by fmax - fmin
somme1 += std(s1)**2/(((fmax - fmin)**2 + self.epsilon)/2.0)
#since the intra-region uniformity should be low i maximize it but taking 1 out of it.
uniforme = 1.0-(somme1/float(len(classList)))
return uniforme