# mapclassify.StdMean

class mapclassify.StdMean(y, multiples=[-2, -1, 1, 2], anchor=False)

  Standard Deviation and Mean Map Classification.

  Parameters:
    y `numpy.array`

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

    multiples `numpy.array` (`default` [-2, -1, 1, 2])

      The multiples of the standard deviation to add/subtract from the sample mean to define the bins.

    anchor bool (`default` `False`)

      Anchor upper bound of one class to the sample mean.

  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.

  Notes

  If anchor is True, one of the intervals will have its closed upper bound equal to the mean of y. Intermediate intervals will have widths equal to the standard deviation of y. The first interval will be closed on the minimum value of y, and the last interval will be closed on the maximum of y. The first and last intervals may have widths different from the intermediate intervals.

  Examples

      >>> import mapclassify
      >>> cal = mapclassify.load_example()
      >>> st = mapclassify.StdMean(cal)
      >>> st.k
      5

      >>> st.bins
      array([-967.36235382, -420.71712519,  672.57333208, 1219.21856072,
             4111.45      ])

      >>> st.counts.tolist()
      [0, 0, 56, 1, 1]

      >>> st3 = mapclassify.StdMean(cal, multiples = [-3, -1.5, 1.5, 3])
      >>> st3.bins
      array([-1514.00758246,  -694.03973951,   945.8959464 ,  1765.86378936,
              4111.45      ])

      >>> st3.counts.tolist()
      [0, 0, 57, 0, 1]
      >>> stda = mapclassify.StdMean(cal, anchor=True)
      >>> stda.k
      9
      >>> stda.bins
      array([ 125.92810345,  672.57333208, 1219.21856072, 1765.86378936,
             2312.50901799, 2859.15424663, 3405.79947527, 3952.4447039 ,
             4111.45      ])
      >>> float(cal.mean()), float(cal.std()), float(cal.min()), float(cal.max())
      (125.92810344827588, 546.6452286365233, 0.13, 4111.45)

  __init__(y, multiples=[-2, -1, 1, 2], anchor=False)

  Methods

  `__init__`(y[, multiples, anchor]) |
  `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
  `plot_legendgram`(*[, ax, cmap, bins, inset, ...]) | Plot a legendgram, which is a histogram with classification breaks.
  `set_fmt`(fmt) |
  `table`() |
  `update`([y, inplace]) | Add data or change classification parameters.

  Attributes

  `fmt` |

  update(y=None, inplace=False, **kwargs)

    Add data or change classification parameters.

    Parameters:
      y `numpy.array` (`default` `None`)

        \((n,1)\), array of data to classify.

      inplace bool (`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.