Solved

pseudo-code formula

Posted on 2011-02-11
4
535 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:dadadude
  • 2
  • 2
4 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34875193
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).
0
 

Author Comment

by:dadadude
ID: 34878064
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

Open in new window

0
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 500 total points
ID: 34879467
So why don't you just do a nested for loop and add all the elements of all the vectors into s1? Is that what you tried already? Why didn't it work? It should have.

Or should you be computing multiple values? Should you be getting a different uniformity for each place in the vector or are all the values in the vector related to the same thing?
0
 

Author Closing Comment

by:dadadude
ID: 34881745
Hello,
yes it did work now when i have only 1 class the uniformity criteria is high, but when many classes the uniformity is low.

the more i have the classes the lower the uniformity criteria. So i think yes it's working perfectly.

Thank you for your help as usual!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CrossWord puzzle solve code 2 648
Binary Search Tree Implementation 4 455
Stanford NLP enhance splitting a line to sentences 10 275
very simple linked list - stackoverflow errror 6 110
This algorithm (in C#) will resize any image down to a given size while maintaining the original aspect ratio. The maximum width and max height are both optional but if neither are given, the original image is returned. This example is designed t…
Prime numbers are natural numbers greater than 1 that have only two divisors (the number itself and 1). By “divisible” we mean dividend % divisor = 0 (% indicates MODULAR. It gives the reminder of a division operation). We’ll follow multiple approac…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now