mlpy.stats.partitioned_mean(x, y, c=None, return_counts=False)[source]

Mean of groups.

Groups the rows of x according to the class labels in y and takes the mean of each group.


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.


mean : array_like

The mean of each group.

counts : int

The number of elements in each group.


>>> partitioned_mean()


Adapted from Matlab:

Copyright (2010) Kevin Murphy and Matt Dunham
License: MIT