aeon
aeon copied to clipboard
[ENH] Add `weights` parameter to `elastic_barycenter_average`
Describe the feature or idea you want to propose
Basically until now, we compute the barycenter average supposing a uniform weight distribution for all series in the batch. I would like to assume this by default, and give control over the weights in the parameters of the elastic_barycenter_average
function.
Describe your proposed solution
Basically, weights
should be an array-like object containing a weight, between 0 and 1, with the same shape as len(X) (the number of input series). If weights is set to None (default), then the function will generate a default uniformly distributed weights between 0 and 1, on all series (i.e. weights[i] = 1/len(X)).
This should then replace this part of the code inside _ba_update
:
alignment[:, k] += curr_ts[:, j]
sum[k] += 1
cost += squared_distance(curr_ts[:, j], center[:, k])
return alignment / sum, cost / X_timepoints
with a weighted average
Describe alternatives you've considered, if relevant
No response
Additional context
This issue is assigned to Maxime Devanne
great idea