mapclassify.KClassifiers

class mapclassify.KClassifiers(y, pct=0.8)[source]

Evaluate all \(k\)-classifers and pick optimal based on \(k\) and GADF.

Parameters:
ynumpy.array

\((n,1)\), values to be classified.

pctfloat (default 0.8)

The percentage of GADF to exceed.

Attributes:
bestMapClassifier

Instance of the optimal MapClassifier.

resultsdict

Keys are classifier names, values are the MapClassifier instances with the best pct for each classifier.

See also

gadf

Notes

This can be used to suggest a classification scheme.

Examples

>>> import mapclassify
>>> cal = mapclassify.load_example()
>>> ks = mapclassify.classifiers.KClassifiers(cal)
>>> ks.best.name
'FisherJenks'
>>> ks.best.k
4
>>> float(ks.best.gadf)
0.8481032719908105
__init__(y, pct=0.8)[source]

Methods

__init__(y[, pct])