tslearn-team / tslearn

The machine learning toolkit for time series analysis in Python
https://tslearn.readthedocs.io
BSD 2-Clause "Simplified" License
2.91k stars 339 forks source link

Soft-DTW Barycenter init parameter isn't documented #46

Closed unnamedplay-r closed 6 years ago

unnamedplay-r commented 6 years ago

See the docs.

GillesVandewiele commented 6 years ago

Good call. I just inspected the source-code to figure out what it is used for (note that I don't even know what a Barycenter is, so this is just a guess).

    if init is None:
        if check_equal_size(X_):
            barycenter = euclidean_barycenter(X_, weights)
        else:
            resampled_X = TimeSeriesResampler(sz=X_.shape[1]).fit_transform(X_)
            barycenter = euclidean_barycenter(resampled_X, weights)
    else:
        barycenter = init

So I guess the init-parameter is used when you already pre-computed this guy called Barycenter, else, it will calculate it for you.

rtavenar commented 6 years ago

Thanks for the report. Should be fixed now.

unnamedplay-r commented 6 years ago

Thanks @rtavenar!

@GillesVandewiele, you're correct. A barycenter is just a average (aka mean, center) of a time-series sample. The use of barycenter in this package most likely stems from one of the more tractable averaging algorithms that uses the DTW measure, DBA (DTW Barycenter Averaging).