mapclassify.gadf(y, method='Quantiles', maxk=15, pct=0.8)[source]

Evaluate the Goodness of Absolute Deviation Fit of a Classifier Finds the minimum value of k for which gadf>pct

Parameters
yarray

(n, 1) values to be classified

method{‘Quantiles, ‘Fisher_Jenks’, ‘Maximum_Breaks’, ‘Natrual_Breaks’}
maxkint

maximum value of k to evaluate

pctfloat

The percentage of GADF to exceed

Returns
kint

number of classes

clobject

instance of the classifier at k

goodness of absolute deviation fit

Notes

$GADF = 1 - \sum_c \sum_{i \in c} |y_i - y_{c,med}| / \sum_i |y_i - y_{med}|$

where $$y_{med}$$ is the global median and $$y_{c,med}$$ is the median for class $$c$$.

Examples

>>> import mapclassify as mc
15

>>> qgadf2 = mc.classifiers.gadf(cal, pct = 0.2)