mapclassify.EqualInterval

class mapclassify.EqualInterval(y, k=5)[source]

Equal Interval Classification.

Parameters:
ynumpy.array

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

kint (default 5)

The number of classes required.

Attributes:
ybnumpy.array

\((n,1)\), bin IDs for observations. Each value is the ID of the class the observation belongs to \(yb[i] = j\) for \(j>=1\) if \(bins[j-1] < y[i] <= bins[j]\), otherwise \(yb[i] = 0\).

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.

Notes

Intervals defined to have equal width:

\[bins_j = min(y)+w*(j+1)\]

with \(w=\frac{max(y)-min(j)}{k}\)

Examples

>>> import mapclassify
>>> cal = mapclassify.load_example()
>>> ei = mapclassify.EqualInterval(cal, k=5)
>>> ei.k
5
>>> ei.counts.tolist()
[57, 0, 0, 0, 1]
>>> ei.bins
array([ 822.394, 1644.658, 2466.922, 3289.186, 4111.45 ])
__init__(y, k=5)[source]

see class docstring

Methods

__init__(y[, k])

see class docstring

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