pysal.viz.mapclassify.Box_Plot

class pysal.viz.mapclassify.Box_Plot(y, hinge=1.5)[source]

Box_Plot Map Classification

Parameters:
y : array

attribute to classify

hinge : float

multiplier for IQR

Notes

The bins are set as follows:

bins[0] = q[0]-hinge*IQR
bins[1] = q[0]
bins[2] = q[1]
bins[3] = q[2]
bins[4] = q[2]+hinge*IQR
bins[5] = inf  (see Notes)

where q is an array of the first three quartiles of y and IQR=q[2]-q[0]

If q[2]+hinge*IQR > max(y) there will only be 5 classes and no high outliers, otherwise, there will be 6 classes and at least one high outlier.

Examples

>>> import pysal.viz.mapclassify as mc
>>> cal = mc.load_example()
>>> bp = mc.Box_Plot(cal)
>>> bp.bins
array([-5.287625e+01,  2.567500e+00,  9.365000e+00,  3.953000e+01,
        9.497375e+01,  4.111450e+03])
>>> bp.counts
array([ 0, 15, 14, 14,  6,  9])
>>> bp.high_outlier_ids
array([ 0,  6, 18, 29, 33, 36, 37, 40, 42])
>>> cal[bp.high_outlier_ids].values
array([ 329.92,  181.27,  370.5 ,  722.85,  192.05,  110.74, 4111.45,
        317.11,  264.93])
>>> bx = mc.Box_Plot(np.arange(100))
>>> bx.bins
array([-49.5 ,  24.75,  49.5 ,  74.25, 148.5 ])
Attributes:
yb : array

(n,1), bin ids for observations

bins : array

(n,1), the upper bounds of each class (monotonic)

k : int

the number of classes

counts : array

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

low_outlier_ids : array

indices of observations that are low outliers

high_outlier_ids : array

indices of observations that are high outliers

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, hinge=1.5)[source]
Parameters:
y : array (n,1)

attribute to classify

hinge : float

multiple of inter-quartile range (default=1.5)

Methods

__init__(y[, hinge])
Parameters:
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.