Cubic smoothing splines for discontinuous signals (CSSD)
Project description
CSSD - Cubic smoothing splines for discontinuous signals
This is a reference implementation in Matlab 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
See also
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.1.tar.gz.
File metadata
- Download URL: cssd-1.0.1.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
421c5175b1f8bf8e6b8eedffcfb5b2f4e8ce4fe688bee756778b8f39ca04da4b
|
|
| MD5 |
ef995d131910f9c9b433bf875cfd4600
|
|
| BLAKE2b-256 |
03ee1ec7a49862fbba03d14a8f1b91685b9e6b7c3589497353331e0c03683e28
|
Provenance
The following attestation bundles were made for cssd-1.0.1.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.1.tar.gz -
Subject digest:
421c5175b1f8bf8e6b8eedffcfb5b2f4e8ce4fe688bee756778b8f39ca04da4b - Sigstore transparency entry: 1463534291
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: cssd-1.0.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 250.4 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 |
cbf54ea260b08fc1ec4d8ddbfc9edeb6ed25a59863fc6956572680cf4648d888
|
|
| MD5 |
75e79c7da6c4abb310a0c8b3c807792c
|
|
| BLAKE2b-256 |
de57c835456a9a839bfb9ebfcb00f67240b2dd12a3e384851cbbb21ef6c87a9f
|
Provenance
The following attestation bundles were made for cssd-1.0.1-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.1-cp39-abi3-win_amd64.whl -
Subject digest:
cbf54ea260b08fc1ec4d8ddbfc9edeb6ed25a59863fc6956572680cf4648d888 - Sigstore transparency entry: 1463534756
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: cssd-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 348.1 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 |
3e1c894d4b8210d4bd17520f6ae9981b81e97b8bc2795811b4e6d4a2242fd570
|
|
| MD5 |
7bffb6897a41b20f3a4b3a020f1e99aa
|
|
| BLAKE2b-256 |
953c96bb61f7f24168aa243d0df7c34aaf2f301b3f3e16e93b0cb1b97b10f8de
|
Provenance
The following attestation bundles were made for cssd-1.0.1-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.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
3e1c894d4b8210d4bd17520f6ae9981b81e97b8bc2795811b4e6d4a2242fd570 - Sigstore transparency entry: 1463534538
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: cssd-1.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 324.2 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 |
4736c37c2b9764565dd101e5a2baab8055a6c6c37e5e5eff089c08828fcc33ad
|
|
| MD5 |
ad238a38052b07d44d1dd033159fd2a1
|
|
| BLAKE2b-256 |
dbc35381023cdfda8ca957ddf97aa0e3c8ba71751f332a6d780fbcb92e371a5d
|
Provenance
The following attestation bundles were made for cssd-1.0.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
4736c37c2b9764565dd101e5a2baab8055a6c6c37e5e5eff089c08828fcc33ad - Sigstore transparency entry: 1463534637
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: cssd-1.0.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 297.9 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 |
56183e5f34f3def5d8fade4d223ded16f6b9de06f9c8260c2ad10b8c4869fb55
|
|
| MD5 |
d04ad852c01c9257a5c51b682c55b650
|
|
| BLAKE2b-256 |
f9d3e57dd7b49f2944cdb410c4b6cc471dd9a1367c12785ef30f7a3debb049fd
|
Provenance
The following attestation bundles were made for cssd-1.0.1-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.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
56183e5f34f3def5d8fade4d223ded16f6b9de06f9c8260c2ad10b8c4869fb55 - Sigstore transparency entry: 1463534445
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cssd-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: cssd-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 318.1 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 |
6c8572de37df3bf8713340c324ef9bfc6c46b5d881653c26b85e1c39149c5f0f
|
|
| MD5 |
d8e281c22d24660fef59de404cbf8974
|
|
| BLAKE2b-256 |
831ad0b09ce904781283048694f3b06bcba0e152f8aeeb179ce0885e89ce2154
|
Provenance
The following attestation bundles were made for cssd-1.0.1-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.1-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
6c8572de37df3bf8713340c324ef9bfc6c46b5d881653c26b85e1c39149c5f0f - Sigstore transparency entry: 1463534377
- Sigstore integration time:
-
Permalink:
mstorath/CSSD@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ae1488c926be1dadff083eadbf0d8a8871a7a85 -
Trigger Event:
push
-
Statement type: