{"id":4242,"library":"ruptures","title":"Ruptures","description":"ruptures is a Python library for off-line change point detection. This package provides methods for the analysis and segmentation of non-stationary signals. It is actively maintained with regular minor releases, and the current stable version is 1.1.10.","status":"active","version":"1.1.10","language":"en","source_language":"en","source_url":"https://github.com/deepcharles/ruptures/","tags":["change point detection","signal processing","time series analysis","segmentation","non-stationary signals"],"install":[{"cmd":"pip install ruptures","lang":"bash","label":"Latest stable version"}],"dependencies":[{"reason":"Required for numerical operations.","package":"numpy","optional":false},{"reason":"Required for scientific computing functions.","package":"scipy","optional":false},{"reason":"Optional, for displaying signals and change points.","package":"matplotlib","optional":true},{"reason":"Optional, required for text segmentation examples.","package":"nltk","optional":true}],"imports":[{"note":"Standard import alias for the library.","symbol":"ruptures","correct":"import ruptures as rpt"},{"note":"Alternatively, access via the main alias: `rpt.Pelt`.","symbol":"Pelt","correct":"from ruptures.detection import Pelt"},{"note":"Alternatively, access via the main alias: `rpt.CostL2`.","symbol":"CostL2","correct":"from ruptures.costs import CostL2"}],"quickstart":{"code":"import ruptures as rpt\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# Generate a signal with change points\nn_samples, n_dims, sigma = 500, 3, 2\nn_bkps = 3  # number of breakpoints\nsignal, bkps = rpt.pw_constant(n_samples, n_dims, n_bkps, noise_std=sigma, seed=42)\n\n# Change point detection with Pelt algorithm and L2 cost\nalgo = rpt.Pelt(model=\"l2\", jump=1, min_size=1).fit(signal)\nresult = algo.predict(pen=10)\n\n# Display results\nfig, ax_array = rpt.display(signal, bkps, result)\nplt.show()","lang":"python","description":"This example generates a piecewise constant signal with noise, then applies the Pelt algorithm with an L2 cost function to detect change points. Finally, it visualizes the original signal, true change points, and detected change points."},"warnings":[{"fix":"Upgrade to ruptures v1.1.8 or later to ensure correct behavior, especially for `min_size=1`.","message":"Prior to v1.1.8 (for `CostRbf`) and v1.1.7 (for `CostL2`, `Binseg`), the `min_size` parameter in certain cost functions and search methods might have been incorrectly handled. This could lead to errors or unexpected segmentations when `min_size` was set to 1.","severity":"gotcha","affected_versions":"<1.1.8"},{"fix":"For reproducible results, upgrade to ruptures v1.1.6 or newer and ensure a random seed is set when generating data or initializing algorithms if randomness is involved.","message":"Versions prior to v1.1.6 had a bug affecting the random behavior of `KernelCPD` (particularly with the Pelt method), which could lead to non-reproducible results when using random states.","severity":"gotcha","affected_versions":"<1.1.6"},{"fix":"Users experiencing memory-related issues with `KernelCPD` should update to ruptures v1.1.2 or later.","message":"A memory leak was identified and fixed in `KernelCPD` in versions prior to v1.1.2, which could cause performance degradation or crashes during long-running tasks or with large datasets.","severity":"gotcha","affected_versions":"<1.1.2"},{"fix":"Upgrade to ruptures v1.1.4 or later to prevent unexpected side effects from in-place modifications when using `costar`.","message":"Before v1.1.4, the `costar` function did not always enforce `deepcopy` of input data, which could lead to unintended in-place modifications of the original data when using this cost function.","severity":"gotcha","affected_versions":"<1.1.4"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}