{"id":32388591,"url":"https://github.com/nup002/pymjc","last_synced_at":"2026-02-25T14:32:23.903Z","repository":{"id":57442096,"uuid":"111276143","full_name":"nup002/pymjc","owner":"nup002","description":"A python implementation of the Minimum Jump Cost dissimilarity measure.","archived":false,"fork":false,"pushed_at":"2022-11-03T14:07:34.000Z","size":81,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T21:29:53.730Z","etag":null,"topics":["datascience","dissimilarity","dissimilarity-measures","python","python-3","python3","time-series","timeseries"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nup002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-19T08:05:35.000Z","updated_at":"2024-03-13T05:32:56.000Z","dependencies_parsed_at":"2022-09-26T17:21:02.426Z","dependency_job_id":null,"html_url":"https://github.com/nup002/pymjc","commit_stats":null,"previous_names":["nup002/mjc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nup002/pymjc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nup002%2Fpymjc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nup002%2Fpymjc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nup002%2Fpymjc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nup002%2Fpymjc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nup002","download_url":"https://codeload.github.com/nup002/pymjc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nup002%2Fpymjc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280901452,"owners_count":26410586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datascience","dissimilarity","dissimilarity-measures","python","python-3","python3","time-series","timeseries"],"created_at":"2025-10-25T03:51:07.983Z","updated_at":"2025-10-25T03:51:08.871Z","avatar_url":"https://github.com/nup002.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![LICENCE](https://img.shields.io/github/license/nup002/pymjc)\n[![Flake8](https://github.com/nup002/pymjc/actions/workflows/flake8.yml/badge.svg)](https://github.com/nup002/mjc/actions/workflows/flake8.yml)\n[![PyTest](https://github.com/nup002/pymjc/actions/workflows/PyTest.yml/badge.svg)](https://github.com/nup002/mjc/actions/workflows/PyTest.yml)\n![Version](https://img.shields.io/pypi/v/pymjc)\n![Python](https://img.shields.io/pypi/pyversions/pymjc)\n# Minimum Jump Cost dissimilarity measure in Python\n\nThis python library implements the Minimum Jump Cost (MJC) dissimilarity measure devised by Joan Serra and Josep Lluis \nArcos in 2012. The MJC dissimilarity measure was shown to outperform the Dynamic Time Warp (DTW) dissimilarity measure \non several datasets. You can read their paper here: \nhttps://www.iiia.csic.es/sites/default/files/4584.pdf.\n\nThis library can compute the MJC for timeseries with different sampling rates, arbitrarily spaced data points, and \nnon-overlapping regions.\n\n## How to install\n`pymjc` is available from PyPi. Run the following in a command line terminal:\u003cbr\u003e\n``` pip install pymjc```\n\n## How to use\nExample: \n```\nfrom pymjc import mjc\nimport numpy as np\n\nseries_1 = np.array([1,2,3,2,1])\nseries_2 = np.array([0,1,2,1,0])\n\nd_xy, abandoned = mjc(series_1, series_2, show_plot=True)\n\nprint(f\"The MJC dissimilarity of series 1 and series 2 is {d_xy}\")\n```\nThere are some options for reducing the computational load of this algorithm. They are detailed in the next section.\n\n## More detailed information\nThe time series s1 and s2 are specified as follows:\n- They may be python Lists or numpy.ndarrays\n- They may be of different length.\n- They may or may not have time information.\n- If one of the time series has time information, the other must also have it.\n- Their datatype may be floats or integers.\n\nA time series with no time information is just a list of values. The first element of the list corresponds to\nthe earliest point in the time series.\u003cbr\u003e\nExample: `s1 = [d₀, d₁, d₂, ...]`, where `dᵢ` is the i-th value of the time series.\n\nA time series with time information must be a 2D array of shape (2, n). The data at index 0 are time\ndata, and the data at index 1 is amplitude data.\u003cbr\u003e\nExample: `s1 = [[t₀, t₁, t₂, ...], [d₀, d₁, d₂, ...]]`, where `tᵢ` is the time of the i-th measurement. The time \nvalues may be integers or floats, and need not begin at 0.\n\nTo visualize the algorithm, you may pass the variable `show_plot=True`. This will generate a plot with the two time\nseries, and arrows signifying the jumps that the algorithm made when calculating the Minimum Jump Cost.\n\nTo stop the algorithm early, pass a value for `dxy_limit`. If the dissimilarity measure exceeds this value during \ncomputation, it is abandoned.\n\n\n### Performance\nThe time series are cast to numpy arrays. The checking and casting lowers execution speed. Therefore, an option to\ndisable this checking and casting has been implemented. If you are certain that the time series `s1` and `s2`\nare `numpy.ndarray`s of the format `[[time data],[amplitude data]]`, you may pass the variable `override_checks=True`.\n\nThe algorithm locates the overlapping region between the two timeseries. This step is skipped if the first and last\ntimestamps are equal between the two timeseries. If your data has no time data, it is skipped if there is the same\nnumber of samples in each timeseries.\n\nAs part of the calculation of the MJC, the algorithm calculates the standard deviations of the amplitude data, and\nthe average sampling periods of `s1` and `s2`. This lowers execution speed, but is required.\nHowever, if you know the standard deviations and/or the average time difference between data points of either\n(or both) `s1` and `s2` a-priori, you may pass these as variables. They are named `std_s1`, `std_s2`, `tavg_s1`, and\n`tavg_s2`. Any number of these may be passed. The ones which are not passed will be calculated.\n\nmjc() input parameters:\n```\ns1              : numpy ndarray | List. Time series 1.\ns2              : numpy ndarray | List. Time series 2.\ndxy_limit       : Optional float. Early abandoning variable.\nbeta            : Optional float. Time jump cost. \nshow_plot       : Optional bool. If True, displays a plot that visualize the algorithms jump path. Default False.\nstd_s1          : Optional float. Standard deviation of time series s1.\nstd_s2          : Optional float. Standard deviation of time series s2.\ntavg_s1         : Optional float. Average sampling period of time series 1.\ntavg_s2         : Optional float. Average sampling period of time series 2. \nreturn_args     : Optional bool. If True, returns the values for std_s1, std_s2, tavg_s1, tavg_s2, s1, and s2.\noverride_checks : Optional bool. Override checking and casting\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnup002%2Fpymjc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnup002%2Fpymjc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnup002%2Fpymjc/lists"}