# Path: mlpy/auxiliary/array.py
# def nunique(x, axis=None):
#     """Efficiently count the unique elements of `x` along the given axis.
# 
#     Parameters
#     ----------
#     x : array_like
#         The array for which to count the unique elements.
#     axis : int
#         Dimension along which to count the unique elements.
# 
#     Returns
#     -------
#     int or array_like :
#         The number of unique elements along the given axis.
# 
#     Examples
#     --------
#     >>>
# 
#     .. note::
#         Ported from Matlab:
# 
#         | Project: `Probabilistic Modeling Toolkit for Matlab/Octave <https://github.com/probml/pmtk3>`_.
#         | Copyright (2010) Kevin Murphy and Matt Dunham
#         | License: `MIT <https://github.com/probml/pmtk3/blob/5fefd068a2e84ae508684d3e4750bd72a4164ba0/license.txt>`_
# 
#     """
#     axis = 0 if axis is None else axis
#     n = np.sum(np.diff(np.sort(x, axis=axis), axis=axis) > 0, axis=axis) + 1
#     return n


from six.moves import range
from sklearn.utils.extmath import logsumexp
from ..auxiliary.array import nunique
import numpy as np

    Parameters
    ----------
    x : array_like, shape (`n`, `dim`)
        The data to group, where `n` is the number of data points and
        `dim` is the dimensionality of each data point.
    y : array_like, shape (`n`,)
        The class label for each data point.
    return_counts : bool
        Whether to return the number of elements in each group or not.

    Returns
    -------
    mean : array_like
        The mean of each group.
    counts : int
        The number of elements in each group.

    Examples
    --------
    >>> partitioned_mean()

    .. note::
        Adapted from Matlab:

        | Project: `Probabilistic Modeling Toolkit for Matlab/Octave <https://github.com/probml/pmtk3>`_.
        | Copyright (2010) Kevin Murphy and Matt Dunham
        | License: `MIT <https://github.com/probml/pmtk3/blob/5fefd068a2e84ae508684d3e4750bd72a4164ba0/license.txt>`_

    """

# Path: mlpy/auxiliary/array.py
# def nunique(x, axis=None):
#     """Efficiently count the unique elements of `x` along the given axis.
# 
#     Parameters
#     ----------
#     x : array_like
#         The array for which to count the unique elements.
#     axis : int
#         Dimension along which to count the unique elements.
# 
#     Returns
#     -------
#     int or array_like :
#         The number of unique elements along the given axis.
# 
#     Examples
#     --------
#     >>>
# 
#     .. note::
#         Ported from Matlab:
# 
#         | Project: `Probabilistic Modeling Toolkit for Matlab/Octave <https://github.com/probml/pmtk3>`_.
#         | Copyright (2010) Kevin Murphy and Matt Dunham
#         | License: `MIT <https://github.com/probml/pmtk3/blob/5fefd068a2e84ae508684d3e4750bd72a4164ba0/license.txt>`_
# 
#     """
#     axis = 0 if axis is None else axis
#     n = np.sum(np.diff(np.sort(x, axis=axis), axis=axis) > 0, axis=axis) + 1
#     return n


# Path: mlpy/stats/_stats.py
from six.moves import range
from sklearn.utils.extmath import logsumexp
from ..auxiliary.array import nunique
import numpy as np


    Parameters
    ----------
    x : array_like, shape (`n`, `dim`)
        The data to group, where `n` is the number of data points and
        `dim` is the dimensionality of each data point.
    y : array_like, shape (`n`,)
        The class label for each data point.
    return_counts : bool
        Whether to return the number of elements in each group or not.

    Returns
    -------
    mean : array_like
        The mean of each group.
    counts : int
        The number of elements in each group.

    Examples
    --------
    >>> partitioned_mean()

    .. note::
        Adapted from Matlab:

        | Project: `Probabilistic Modeling Toolkit for Matlab/Octave <https://github.com/probml/pmtk3>`_.
        | Copyright (2010) Kevin Murphy and Matt Dunham
        | License: `MIT <https://github.com/probml/pmtk3/blob/5fefd068a2e84ae508684d3e4750bd72a4164ba0/license.txt>`_

    """

    c = nunique(y) if c is None else c