Head/tail Breaks Map Classification for Heavy-tailed Distributions.

Parameters:
ynumpy.array

$$(n,1)$$, values to classify.

Notes

Head/tail Breaks is a relatively new classification method developed for data with a heavy-tailed distribution.

Implementation based on contributions by Alessandra Sozzi <alessandra.sozzi@gmail.com>.

For theoretical details see [Jia13].

Examples

>>> import mapclassify
>>> import numpy
>>> numpy.random.seed(10)
>>> htb.k
3

>>> htb.counts.tolist()
[50, 7, 1]

>>> htb.bins
array([ 125.92810345,  811.26      , 4111.45      ])

>>> numpy.random.seed(123456)
>>> x = numpy.random.lognormal(3, 1, 1000)
>>> htb.bins
array([ 32.26204423,  72.50205622, 128.07150107, 190.2899093 ,
264.82847377, 457.88157946, 576.76046949])

>>> htb.counts.tolist()
[695, 209, 62, 22, 10, 1, 1]

Attributes:
ybnumpy.array

$$(n,1)$$, bin IDs for observations.

binsnumpy.array

$$(k,1)$$, the upper bounds of each class.

kint

The number of classes.

countsnumpy.array

$$(k,1)$$, the number of observations falling in each class.

__init__(y)[source]

Methods

 find_bin(x) Sort input or inputs according to the current bin estimate. get_adcm() Absolute deviation around class median (ADCM). get_fmt() get_gadf() Goodness of absolute deviation of fit. get_legend_classes([fmt]) Format the strings for the classes on the legend. get_tss() Returns sum of squares over all class means. make(*args, **kwargs) Configure and create a classifier that will consume data and produce classifications, given the configuration options specified by this function. plot(gdf[, border_color, border_width, ...]) Plot a mapclassifier object. plot_histogram([color, linecolor, ...]) Plot histogram of y with bin values superimposed set_fmt(fmt) table() update([y, inplace]) Add data or change classification parameters.

Attributes

 fmt