Cubic smoothing splines for discontinuous signals (CSSD)
Project description
CSSD — Cubic smoothing splines for discontinuous signals
Cubic smoothing splines for signals with a-priori unknown discontinuities — joint estimation of the spline and the discontinuity set via dynamic programming, with K-fold cross-validation for the regularisation parameters.
This is a reference implementation for the algorithms described in the paper
M. Storath, A. Weinmann, "Smoothing splines for discontinuous signals", Journal of Computational and Graphical Statistics, 2023, [Preprint]
Overview of main functionalities
- cssd.m computes a cubic smoothing spline with discontinuities (CSSD) for data (x,y). It is a solution of the following model of a smoothing spline $f$ with a-priori unknown discontinuities $J$
$$\min_{f, J} p \sum_{i=1}^N \left(\frac{y_i - f(x_i)}{\delta_i}\right)^2 + (1-p) \int_{[x_1, x_N] \setminus J} (f''(t))^2 dt + \gamma |J|.$$
where
- $y_i = g(x_i) + \epsilon_i$ are samples of piecewise smooth function $g$ at data sites $x_1, \ldots, x_N$, and an estimate $\delta_i$ of the standard deviation of the errors $\epsilon_i$
- the minimum is taken over all possible sets of discontinuities between two data sites $J \subset [x_1, x_N]\setminus {x_1, \ldots, x_N}$ and all functions $f$ that are twice continuously differentiable away from the discontinuities.
- The model parameter $p \in (0, 1)$ controls the relative weight of the smoothness term (second term) and the data fidelity term.
- The last term is a penalty for the number of discontinuities $|J|$ weighted by a parameter $\gamma > 0.$
- cssd_cv.m automatically determines values for the model parameters $p$ and $\gamma$ based on K-fold cross validation.
Quickstart
Python (Rust core)
pip install cssd
import numpy as np
from cssd import cssd, cssd_cv
x = np.linspace(0, 1, 100)
y = np.sin(4 * np.pi * x) - np.sign(x - 0.3) - np.sign(0.72 - x)
out = cssd(x, y, p=0.999, gamma=8.0)
out.discont # detected jump locations
out.pp(x) # evaluate the piecewise spline
cv = cssd_cv(x, y, cv_type="random", cv_arg=5)
cv.p, cv.gamma, cv.fit.discont
The Python package wraps a Rust extension built with PyO3
and maturin; see crates/cssd-core for the algorithm
crate and crates/cssd-py for the bindings.
MATLAB (reference implementation, unchanged)
- Execute "install_cssd.m" which adds the folder and all subfolders to the Matlab path.
- Execute any m-file from the demos folder
Examples
Synthetic data
Stock data
Geyser data
Reference
M. Storath, A. Weinmann, "Smoothing splines for discontinuous signals", Journal of Computational and Graphical Statistics, 2023
How to cite
If you use this software, please cite the paper above. GitHub's "Cite this repository" button on the repo page reads the version and date-released fields from CITATION.cff and renders BibTeX/APA.
See also
Sibling projects from the same research program on variational methods for signal and image processing:
- Pottslab — multilabel image segmentation via the Potts / piecewise-constant Mumford-Shah model
- L1TV — exact L1-TV regularisation of real- or circle-valued signals
- MumfordShah2D — edge-preserving image restoration via the Mumford-Shah model
- CircleMedianFilter — fast median filtering for phase or orientation data
- DCEBE — bolus arrival time estimation for DCE-MRI signals
Related external projects:
- Higher order Mumford-Shah models — discrete splines with discontinuities.
- pcw-regrs — degrees-of-freedom penalised piecewise regression.
License
Released under the MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cssd-1.0.2.tar.gz.
File metadata
- Download URL: cssd-1.0.2.tar.gz
- Upload date:
- Size: 45.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d17b4b157a7a13d0e368e7152705838f8ebc1c7135f643ad90888265ddc2238f
|
|
| MD5 |
08492ac6f2cd594ad7546622b0df8b16
|
|
| BLAKE2b-256 |
381af4f28fc5d7fe14d0064d7cbecf3bc19c17d54754844fb9816624d995bf1d
|
Provenance
The following attestation bundles were made for cssd-1.0.2.tar.gz:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2.tar.gz -
Subject digest:
d17b4b157a7a13d0e368e7152705838f8ebc1c7135f643ad90888265ddc2238f - Sigstore transparency entry: 1504380359
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: cssd-1.0.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 251.0 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90846a6f72ec9f21bac9dad16359d50f6f282d6bcc7aa7483de221ac6634aea7
|
|
| MD5 |
be5d5ba32af0807c4d41538e916d91f9
|
|
| BLAKE2b-256 |
dbfe134172377a7609ac43bc26c64cc3fee1fa1f1f8ac90247c1e4a365dedc74
|
Provenance
The following attestation bundles were made for cssd-1.0.2-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2-cp39-abi3-win_amd64.whl -
Subject digest:
90846a6f72ec9f21bac9dad16359d50f6f282d6bcc7aa7483de221ac6634aea7 - Sigstore transparency entry: 1504380422
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: cssd-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 348.7 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb6563ec425673af2fa52a3da710b13fd9292d44902b731351d4fb70637c20b0
|
|
| MD5 |
3f2bac80c0e126db31818cc84063ed73
|
|
| BLAKE2b-256 |
735a5f05a54384feef3054e4d8b01915153cc5bb2c033e55b1e22e9f48206e01
|
Provenance
The following attestation bundles were made for cssd-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
fb6563ec425673af2fa52a3da710b13fd9292d44902b731351d4fb70637c20b0 - Sigstore transparency entry: 1504380553
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: cssd-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 324.8 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20cb8823e5a3e9738f4f357b4c7ad58135b7df440852e06c26d9591a079aa205
|
|
| MD5 |
8510a8a5444fb23d8628c0213b497e8e
|
|
| BLAKE2b-256 |
3464500a5c9c799509ca99c2482d5d1314fded15d3e9fd89b89a00b6000beb1e
|
Provenance
The following attestation bundles were made for cssd-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
20cb8823e5a3e9738f4f357b4c7ad58135b7df440852e06c26d9591a079aa205 - Sigstore transparency entry: 1504380619
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: cssd-1.0.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 298.6 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b9eb39f9bdee437be9eef286e60b964f8badfe43919c5a1dc4d9021cb349f95
|
|
| MD5 |
8befd07975f144bc650fb72c026209bf
|
|
| BLAKE2b-256 |
151e6ebf1a2225ac84316c37dad6f39df078d5583324ecd7934722db282f1a9c
|
Provenance
The following attestation bundles were made for cssd-1.0.2-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
5b9eb39f9bdee437be9eef286e60b964f8badfe43919c5a1dc4d9021cb349f95 - Sigstore transparency entry: 1504380675
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: cssd-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 318.7 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d3fb7149ff0444956d7e013b08e51469da6254022d65c439b7bf905c1f4a076
|
|
| MD5 |
17aa7416b1f9c9ffe86d9683907519a4
|
|
| BLAKE2b-256 |
0bfeeb67c2a462cfb2ace20736334189e908ad8086476662f0533e85585e3ab4
|
Provenance
The following attestation bundles were made for cssd-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on mstorath/CSSD
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cssd-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
2d3fb7149ff0444956d7e013b08e51469da6254022d65c439b7bf905c1f4a076 - Sigstore transparency entry: 1504380489
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@367b0c4184caa39291d6bccc17f8143bb5d8f178 -
Trigger Event:
push
-
Statement type: