Non-parametric curve fitting using an adaptive spline. The knots of the spline are optimized by Particle Swarm Optimization (PSO). The method can fit both smooth and non-smooth curves having jumps in values or derivatives.
(Requires PSO codes in SDMBIGDAT19 on the Mathworks file exchange or in the GitHub repository of the same name at https://github.com/mohanty-sd/SDMBIGDAT19)
Further details are in the paper: Mohanty, Soumya D., and Ethan Fahnestock. "Adaptive spline fitting with particle swarm optimization." arXiv preprint arXiv:1907.12160 (2019)
Abstract of the paper: In fitting data with a spline, finding the optimal placement of knots can significantly improve the quality of the fit. However, the challenging high-dimensional and non-convex optimization problem associated with completely free knot placement has been a major roadblock in using this approach. We present a method that uses particle swarm optimization (PSO) combined with model selection to address this challenge. The problem of overfitting due to knot clustering that accompanies free knot placement is mitigated in this method by explicit regularization, resulting in a significantly improved performance on highly noisy data. The principal design choices available in the method are delineated and a statistically rigorous study of their effect on performance is carried out using simulated data and a wide variety of benchmark functions. Our results demonstrate that PSO-based free knot placement leads to a viable and flexible adaptive spline fitting approach that allows the fitting of both smooth and non-smooth functions.
An example is provided in test_shps.m. It runs SHAPES on data generated by test_gendataBFsig.m. Hence, use the latter to first generate some data.
For reference, test_shps.m, which tests the main function shps.m, takes about 9 sec to complete on a 3 GHz 8-Core Intel Xeon E5 on one data realization with 260 samples, one PSO run, and other algorithm settings as given in the paper.
Each test_*.m script also serves as an example of how to use the respective function.
In addition, each function has associated usage instructions that can be accessed using Matlab's "help" command.
Soumya Mohanty (2021). SHAPES (https://github.com/mohanty-sd/SHAPES/releases/tag/v1.0.0), GitHub. Retrieved .
Mohanty, Soumya D., and Ethan Fahnestock. "Adaptive spline fitting with particle swarm optimization." arXiv preprint arXiv:1907.12160 (2019)
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!