mapclassify.MaxP

class mapclassify.MaxP(y, k=5, initial=1000, seed1=0, seed2=1)[source]

MaxP Map Classification. Based on Max-p regionalization algorithm.

Parameters:
ynumpy.array

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

kint (default K==5)

Number of classes required.

initialint (default 1000)

Number of initial solutions to use prior to swapping.

seed1int (default 0)

Random state for initial building process.

seed2int (default 1)

Random state for swapping process.

Examples

>>> import mapclassify
>>> cal = mapclassify.load_example()
>>> mp = mapclassify.MaxP(cal)
>>> mp.bins
array([3.16000e+00, 1.26300e+01, 1.67000e+01, 2.04700e+01, 4.11145e+03])
>>> mp.counts.tolist()
[18, 16, 3, 1, 20]
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, k=5, initial=1000, seed1=0, seed2=1)[source]

Methods

__init__(y[, k, initial, seed1, seed2])

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.

set_fmt(fmt)

table()

update([y, inplace])

Add data or change classification parameters.

Attributes

fmt