GithubHelp home page GithubHelp logo

t4d-gmbh / majortrack Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 3.0 495 KB

A time-resolved clustering method

Home Page: https://majortrack.rtfd.io

License: GNU General Public License v3.0

Python 90.82% R 9.18%
dynamic-community-detection window-graphs machine-learning-algorithms evolutionary-clustering clustering

majortrack's People

Contributors

j-i-l avatar jevansbio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

majortrack's Issues

Since python 3.8 MutableSequence is only accessible as second level module

Since python 3.8 importing MajorTrack fails with:

Traceback (most recent call last):
  File ",,,/test.py", line 1, in <module>
    from majortrack import MajorTrack
  File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/__init__.py", line 9, in <module>
    from .tracker import MajorTrack
  File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/tracker.py", line 11, in <module>
    from .lazylist import lazy_list
  File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/lazylist.py", line 4, in <module>
    from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Classes from collections are used in

Solution

The alias collections.MutableSequence which was created when the class moved to collections.abc in 3.3 was removed with python 3.8. So the import needs updating, to be compatible with recent python versions, but should not break backwards compatibility.

Suggestion

try:
    from collections.abc import MutableSequence  # noqa
except ImportError:
    from collections import MutableSequence  # noqa

Allow dynamic cluster (dc) index as labels for groups in the alluvial diagram

Currently, the only out of the box options for labels that are provided are 'groupsize' and 'group_index'.

'group_index' might be helpful for debugging, and for doing custom layout adaptations (see e.g. line 126 in the history.py example and the optional y_fix parameter in AlluvialPlot) but the group IDs can be misleading since they are a priori completely unrelated between slices.

Suggestion:

Adding the option 'dc_index' to the set of available cluster labels, such that the dynamic cluster affiliation can also be shown by the label of a group and not just it's color.

`get_alluvialdiagram` fails if iterator parameter does not start at 0

Providing an iterator with an initial element bigger than 0 leads to an IndexError when attempting to create fluxes between the clusters to display.

The error occurs in https://github.com/j-i-l/MajorTrack/blob/11f92c5fadb8a15c2672c750371df83847d90ca1/majortrack/tracker.py#L2509-L2510

Problem:

The elements to draw (clusters and fluxes) for each slice of the time series are collected in lists rather than in dictionaries. The elements are collected by iterating over the specified iterator and appending to these lists. If the iterator does not start at 0 this creates a miss-match between the index of the slices to draw and the index of the collections of elements to draw for that index.

Fix:

option a): Use the first element of the specified iterator as offset when accessing the elements in to draw.

option b): collect the elements to draw in dict's rather than list's and use the elements from the iterator parameter as keys.

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.