mapclassify.MaximumBreaks¶
- class mapclassify.MaximumBreaks(y, k=5, mindiff=0)[source]¶
Maximum Breaks Map Classification.
- Parameters:
- y
numpy.array
\((n,1)\), values to classify.
- k
int
(default
5) The number of classes required.
- mindiff
float
(default
0) The minimum difference between class breaks.
- y
- Attributes:
- yb
numpy.array
\((n,1)\), bin IDs for observations.
- bins
numpy.array
\((k,1)\), the upper bounds of each class.
- k
int
The number of classes.
- counts
numpy.array
\((k,1)\), the number of observations falling in each class.
- yb
Examples
>>> import mapclassify >>> cal = mapclassify.load_example() >>> mb = mapclassify.MaximumBreaks(cal, k=5) >>> mb.k 5
>>> mb.bins array([ 146.005, 228.49 , 546.675, 2417.15 , 4111.45 ])
>>> mb.counts.tolist() [50, 2, 4, 1, 1]
Methods
__init__
(y[, k, mindiff])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
- update(y=None, inplace=False, **kwargs)[source]¶
Add data or change classification parameters.
- Parameters:
- y
numpy.array
(default
None
) \((n,1)\), array of data to classify.
- inplacebool (
default
False
) Whether to conduct the update in place or to return a copy estimated from the additional specifications.
- **kwargs
dict
Additional parameters that are passed to the
__init__
function of the class. For documentation, check the class constructor.
- y