pombreda / pysal

Automatically exported from code.google.com/p/pysal
Other
0 stars 0 forks source link

pysal.esda.mapclassify.Fisher_Jenks - local variable 'best' referenced before assignment #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. x=numpy.array([1,2,3,4,5,1,2,3,4,5])
2. pysal.esda.mapclassify.Fisher_Jenks(x)

What is the expected output? What do you see instead?

local variable 'best' referenced before assignment
pysal/esda/mapclassify.py in _two_part, line 993

What version of the product are you using? On what operating system?

pysal 1.2
python 2.7
Ubuntu server 11.04

Original issue reported on code.google.com by kevxr...@gmail.com on 12 Aug 2011 at 7:42

GoogleCodeExporter commented 9 years ago
There is a fix in trunk committed in 
http://code.google.com/p/pysal/source/detail?r=993

Original comment by sjsrey on 13 Aug 2011 at 1:29

GoogleCodeExporter commented 9 years ago
need more testing

Original comment by sjsrey on 13 Aug 2011 at 1:48

GoogleCodeExporter commented 9 years ago
Thanks for the really quick response!  Your update seems to have fixed the 
specific case that I posted, with that array, but I still get the error with 
other arrays.  I'm new to this library, and to Python in general, so I'm still 
trying to familiarize myself with the code.  It seems to have issues with 
arrays that should really have fewer breaks than are requested.  For instance, 
an array of [0,0,0,1] with the default of 5 classes will throw the original 
error I posted, even after your update.  I will keep familiarizing myself with 
the code to see if I can find anything helpful.

Original comment by kevxr...@gmail.com on 13 Aug 2011 at 1:50

GoogleCodeExporter commented 9 years ago
Sorry, just noticed you reopened this.

Original comment by kevxr...@gmail.com on 13 Aug 2011 at 1:51

GoogleCodeExporter commented 9 years ago
more general fix is in at http://code.google.com/p/pysal/source/detail?r=994

the issue of having less unique values than the number of classes is currently 
not handled for Fisher_Jenks. The issues with ties is dealt with in some of the 
other classifiers in the library. I will think through a scheme for doing so 
with Fisher_Jenks

Original comment by sjsrey on 13 Aug 2011 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by sjsrey on 9 Jan 2012 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by sjsrey on 31 Jan 2012 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by sjsrey on 31 Jul 2012 at 4:09

GoogleCodeExporter commented 9 years ago

Original comment by sjsrey on 4 Jan 2013 at 6:18