Calculate classification accuracy from dbf?

3753
1
02-09-2015 05:57 AM
ErtTre
by
New Contributor II

I have dozens of DBFs and each contains a classification error matrix. From each of these matrices I would like to calculate overall, user's and producer's accuracies.

 

What would be the best method to do that? I have one additional obstacle, just to make the problem a little more challenging; sometimes (but not always) I have more/less predicted classes than the "truth" class has. See the example below, where in the "predicted (Class)" column there is class "B" while the same class does not appear in the "truth" classes.

 

I have used dbfread to read the dbf data.

 

OrderedDict([(u'Class', u'A'), (u'_A', 14), (u'_C', 0), (u'_D', 3), (u'_E', 9), (u'_F', 8)])

OrderedDict([(u'Class', u'B'), (u'_A', 0), (u'_C', 0), (u'_D', 29), (u'_E', 1), (u'_F', 0)])

OrderedDict([(u'Class', u'C'), (u'_A', 0), (u'_C', 149), (u'_D', 101), (u'_E', 0), (u'_F', 2)])

OrderedDict([(u'Class', u'D'), (u'_A', 33), (u'_C', 0), (u'_D', 594), (u'_E', 41), (u'_F', 96)])

OrderedDict([(u'Class', u'E'), (u'_A', 62), (u'_C', 1), (u'_D', 38), (u'_E', 12), (u'_F', 28)])

OrderedDict([(u'Class', u'F'), (u'_A', 95), (u'_C', 34), (u'_D', 665), (u'_E', 38), (u'_F', 47)])

0 Kudos
1 Reply
BlakeTerhune
MVP Regular Contributor

You could try using arcpy's Table to Table Conversion instead of dbfread. That would also let you use the arcpy.da cursors for easy iteration over the rows. Could you post a sample of what your desired overall accuracies output would look like?

0 Kudos