# pseudo-code formula

there is a formula in the following article:Article link
page 503: Levine and Nazif

where simply it does the following:

ListOfClasses = [c1,c2,c3,...,cn], and where ci = [value1,value2,...,valuen]
so it does the intra-region uniformity, the closer to 1 the better the result.

Well what is really disturbing is that i cannot fix it while working with vectors instead of values:

ListOfClasses = [c1,c2,c3,...,cn], and where ci = [v1,v2,...,vn] where v = VECTOR
and where vi = [value1,value2,value3,...valuen]

Can you pls give me the pseudo-code for that algorithm with vectors!!

I am getting opposite results.
TommySzalapski

What does the vector represent? What is the current algorithm you are using? Since the uniformity should just be the inverse of the variance, it shouldn't give you the opposite unless you are actually calculating the variance. Then you would just need to flip it (realAnswer = 1/oldAnswer or something).

What does the vector represent?
u can think of each vector as f(x,y) the value of each element in a class.
instead of f(x,y) = x (value), f(x,y) = [e1,e2,...,en]
What is the current algorithm you are using?
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
TommySzalapski

membership
Create an account to see this answer
Signing up is free. No credit card required.