Coder Social home page Coder Social logo

Comments (4)

AKuederle avatar AKuederle commented on June 13, 2024

Sry I just realised you already mentioned tslearn in the README. It would still be interesting to have some further information under which circumstances this package should be chosen over the existing alternatives

from seg1d.

cadop avatar cadop commented on June 13, 2024

I added an additional explanation in the README for this topic, but I also will try to address some of it here as well.

First, I do use some methods in sklearn, so there is overlap there, but it is in order to achieve the goal of seg1d.

I think there is also some nuance to the packages and wording that conflates some of the differences. I spent a few hours trying to get seglearn and tslearn running so that I could compare them, but reached a point that I either do not understand what they are doing enough to modify their examples, or the differences are user-related. For example, the tslearn method you linked to is using cross correlation (seg1d uses rolling correlation), and is clustering the time series (seg1d uses clustering, but it is really just to determine which segments are the best match, not for classification).

The closest method I can find in tslearn is this example: https://tslearn.readthedocs.io/en/stable/auto_examples/misc/plot_distance_and_matrix_profile.html#sphx-glr-auto-examples-misc-plot-distance-and-matrix-profile-py

Essentially the distance profile is similar to the output of the rolling window correlation. Other than that, it is using the minimum distance to find the segment whereas in seg1d, it uses peak detection. The clustering part would be for example, the neighbor dist that is shows with a red x in their figure by finding all the x's and clustering which one is the desired motion. The other difference is how seg1d can use both multiple features and multiple sets, along with weighting values. In the end, I can see how to get similar results, although it requires a good deal of effort (i.e., how seg1d ended up being created). Other small features of seg1d I don't think are too important in this matter.

I also realize I can be missing some essential info, so if you know of a way that these libraries are facilitating the same process/outputs as the API examples please let me know, I can also test the differences in output/usability as well then.
These would be the two cases:

https://cadop.github.io/seg1d/build/html/api_ecg.html

https://cadop.github.io/seg1d/build/html/api_feat.html

I used the ecg example data from seg1d on the tslearn and got to this point

tslearn_ecg

It doesn't have the multifeatures/references but shows a similar distance profile. However, this is as close as I could get to seg1d based on their examples.

from seg1d.

AKuederle avatar AKuederle commented on June 13, 2024

Thank you very much for putting so much effort into this! I guess you are right, non of packages methods includes a rolling correlation based system for segmentation. There are other methods (e.g subsequence DTW in tslearn), but I agree that there are not identical the same.

From a scientific point of view, could you quickly explain what die advantages of rolling correlation + peak detection compared to normalized cross correlation + peak detection is? I would consider the latter approach pretty popular.

from seg1d.

cadop avatar cadop commented on June 13, 2024

The result of a rolling pearson correlation is the same as a normalized cross correlation implementation. NCC is not the same as cross correlation, and based on what I expect most users to be confused with, its easier to refer to rolling correlation since the common methods of np.correlate(x, y, 'full') is not NCC, but cross correlation.

from seg1d.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.