mapclassify.EqualInterval¶
-
class
mapclassify.
EqualInterval
(y, k=5)[source]¶ Equal Interval Classification
- Parameters
- yarray
(n,1), values to classify
- kint
number of classes required
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 as mc >>> cal = mc.load_example() >>> ei = mc.EqualInterval(cal, k = 5) >>> ei.k 5 >>> ei.counts array([57, 0, 0, 0, 1]) >>> ei.bins array([ 822.394, 1644.658, 2466.922, 3289.186, 4111.45 ])
- Attributes
- ybarray
(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], yb[i] = 0 otherwise
- binsarray
(k,1), the upper bounds of each class
- kint
the number of classes
- countsarray
(k,1), the number of observations falling in each class
Methods
__init__
(self, y[, k])see class docstring
find_bin
(self, x)Sort input or inputs according to the current bin estimate
get_adcm
(self)Absolute deviation around class median (ADCM).
get_fmt
(self)get_gadf
(self)Goodness of absolute deviation of fit
get_legend_classes
(self[, fmt])Format the strings for the classes on the legend
get_tss
(self)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.
plot
(self, gdf[, border_color, …])Plot Mapclassiifer NOTE: Requires matplotlib, and implicitly requires geopandas dataframe as input.
set_fmt
(self, fmt)table
(self)update
(self[, y, inplace])Add data or change classification parameters.
Attributes
fmt