pysal.viz.mapclassify.HeadTail_Breaks

class pysal.viz.mapclassify.HeadTail_Breaks(y)[source]

Head/tail Breaks Map Classification for Heavy-tailed Distributions

Parameters:
y : 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 numpy as np
>>> import pysal.viz.mapclassify as mc
>>> np.random.seed(10)
>>> cal = mc.load_example()
>>> htb = mc.HeadTail_Breaks(cal)
>>> htb.k
3
>>> htb.counts
array([50,  7,  1])
>>> htb.bins
array([ 125.92810345,  811.26      , 4111.45      ])
>>> np.random.seed(123456)
>>> x = np.random.lognormal(3, 1, 1000)
>>> htb = mc.HeadTail_Breaks(x)
>>> htb.bins
array([ 32.26204423,  72.50205622, 128.07150107, 190.2899093 ,
       264.82847377, 457.88157946, 576.76046949])
>>> htb.counts
array([695, 209,  62,  22,  10,   1,   1])
Attributes:
yb : array

(n,1), bin ids for observations,

bins : array

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

k : int

the number of classes

counts : array

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

Methods

__call__(*args, **kwargs) This will allow the classifier to be called like it’s a function.
find_bin(x) Sort input or inputs according to the current bin estimate
get_adcm() Absolute deviation around class median (ADCM).
get_gadf() Goodness of absolute deviation of fit
get_tss() Total sum of squares around 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.
update([y, inplace]) Add data or change classification parameters.
__init__(y)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(y) Initialize self.
find_bin(x) Sort input or inputs according to the current bin estimate
get_adcm() Absolute deviation around class median (ADCM).
get_gadf() Goodness of absolute deviation of fit
get_tss() Total sum of squares around 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.
update([y, inplace]) Add data or change classification parameters.