Reputation: 73
There is a set of objects to be classified into n classes. Each class has its own coefficient.
For example:
class coefficient
1 0.5
2 0.7
N 0.4
I arranged objects into classes and get the set of coefficients. But i need to determine a single coefficient that would be most suitable for the entire set of objects.
How can I Aggregate the Objects' Coefficients and choose one common coefficient? Except for the methods of average coefficients.
Upvotes: 1
Views: 37
Reputation: 564
in python
pandas.value_counts
over coefficients, and pick most commoncollections.Counter
over coefficients, and pick most commonor plain old histogram
other than that you can make something like weighted average
there are many statistics, depends on what you need
Upvotes: 0
Reputation: 4949
This depends on the nature of your data and any specific requirements of your problem.
You can perform variety of statistical analysis on the data and see which ones provide the best classification.
For instance, the median and mode are particularly useful when dealing with outliers. Harmonic and geometric means are suitable for multiplicative data, and there are numerous other methods to apply.
import numpy as np
from scipy import stats
def get_aggr(C):
_med = np.median(C)
_mod = stats.mode(C).mode
_hmean = stats.hmean(C)
_gmean = stats.gmean(C)
_trim_mean = stats.trim_mean(C, 0.1)
return _med, _mod, _hmean, _gmean, _trim_mean
C = [0.5, 0.7, 0.4, 0.5, 0.6, 0.4]
print(get_aggr(C))
(0.5, 0.4, 0.49606299212598426, 0.5060788802128566, 0.5166666666666666)
Upvotes: 0