SignalSharp 0.1.10

dotnet add package SignalSharp --version 0.1.10
                    
NuGet\Install-Package SignalSharp -Version 0.1.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SignalSharp" Version="0.1.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SignalSharp" Version="0.1.10" />
                    
Directory.Packages.props
<PackageReference Include="SignalSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SignalSharp --version 0.1.10
                    
#r "nuget: SignalSharp, 0.1.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SignalSharp&version=0.1.10
                    
Install as a Cake Addin
#tool nuget:?package=SignalSharp&version=0.1.10
                    
Install as a Cake Tool

NuGet Version

SignalSharp

SignalSharp is a .NET library focused on time series analysis, change point detection, and signal smoothing/filtering tasks. It provides implementations of common algorithms optimized for clarity and efficiency.

Core Features

Change Point Detection

Algorithms to identify points in time where the statistical properties of a signal change.

  • PELT (Pruned Exact Linear Time):

    • Detects multiple change points efficiently.
    • Supports various cost functions to target specific types of changes, including mean, variance, event rate, and distribution shape.
    • Includes a PELTPenaltySelector for automatic penalty selection using BIC, AIC, or AICc for supported cost functions.
  • CUSUM (Cumulative Sum):

    • Detects shifts in the mean of a signal.
    • Works by accumulating deviations from an expected level and triggering when a threshold is exceeded.
Signal Smoothing

Methods to reduce noise from measurements.

  • Savitzky-Golay Filter: Smooths data by fitting successive sub-sets of adjacent data points with a low-degree polynomial. This helps preserve signal features better than a simple moving average.
  • Moving Average: A basic smoothing technique that calculates the average of data points within a sliding window.
Extrapolation

Methods for forecasting future values based on historical data.

  • Simple Exponential Smoothing (SES): A forecasting method for univariate time series without a clear trend or seasonal pattern. It computes future values based on a weighted average of past observations, with recent observations given more weight. The forecast is a constant value, which is the last smoothed level calculated from the data.
  • Holt's Linear Trend Method: Also known as Double Exponential Smoothing, this method is for data with a trend but no seasonality. It supports both additive and multiplicative trends and can include a "damped" trend to improve long-term forecast accuracy. The implementation can also automatically find optimal smoothing parameters via a built-in grid search.
  • Linear Extrapolation: Forecasts future values by fitting a simple linear trend to a recent window of data points and extending that line into the future. The size of the fitting window is configurable.
Optimization

Hyperparameter tuning methods to find the best-performing parameters for a model.

  • Grid Search: An exhaustive search method that systematically evaluates a grid of parameter combinations to find the one that yields the best performance. It supports parallel processing and an "adaptive refinement" feature that performs a second, more focused search around the best initial result.
  • Nelder-Mead: A direct search method that "crawls" toward the minimum of a function in a multi-dimensional space without requiring derivative information. This makes it well-suited for objective functions that are noisy or non-differentiable. It can be configured to perform multiple restarts from different starting points to increase the likelihood of finding a global minimum.
Utilities
  • Signal Padding: Methods for common padding modes (Constant, Mirror, Nearest, Periodic).
  • Statistical Functions: Basic statistics (Mean, Variance, StdDev, Median, Normalization, etc.).

Installation

Install the package via the dotnet CLI:

dotnet add package SignalSharp

Or use the NuGet Package Manager in your IDE.

Usage

For detailed examples and API documentation, please refer to the official documentation.

Here's a quick example of how to use the PELT algorithm for change point detection:

using SignalSharp.Detection.PELT;
using SignalSharp.CostFunctions.Cost;

// Create a sample signal
double[] signal = { 1, 1, 1, 5, 5, 5, 1, 1, 1 };

// Initialize PELT algorithm (using default L2 cost, MinSize=1, Jump=1)
var options = new PELTOptions(); 
var algo = new PELTAlgorithm(options);

// Detect change points with a manually chosen penalty
int[] breakpoints = algo.FitAndDetect(signal, penalty: 2.0); 
Console.WriteLine($"Manual Penalty Change Points: {string.Join(", ", breakpoints)}"); // Expected: [3, 6]

// --- Or use Automatic Penalty Selection (requires a likelihood cost function) ---

// Configure PELT with Gaussian Likelihood (supports BIC/AIC)
var likelihoodOptions = new PELTOptions { CostFunction = new GaussianLikelihoodCostFunction(), MinSize = 2 };
var likelihoodAlgo = new PELTAlgorithm(likelihoodOptions);

// Create the selector
var selector = new PELTPenaltySelector(likelihoodAlgo);

// Choose selection method (e.g., BIC)
var selectionOptions = new PELTPenaltySelectionOptions(PELTPenaltySelectionMethod.BIC);

// Fit data and select penalty
var result = selector.FitAndSelect(signal, selectionOptions);

Console.WriteLine($"Auto Penalty (BIC): {result.SelectedPenalty:F4}");
Console.WriteLine($"Auto Penalty Change Points: {string.Join(", ", result.OptimalBreakpoints)}"); 
// Expected: likely [3, 6], penalty will vary

Contributing

Contributions are welcome! If you have ideas, suggestions, or bug reports, feel free to open an issue or submit a pull request.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.10 141 7/1/2025
0.1.8 178 4/29/2025
0.1.7 152 4/29/2025
0.1.6 179 4/22/2025
0.1.5 182 4/20/2025
0.1.3 201 6/3/2024
0.1.2 118 6/3/2024
0.1.1 123 6/1/2024
0.1.0 125 5/30/2024
0.0.12 127 5/30/2024
0.0.11 124 5/30/2024
0.0.10 134 5/30/2024
0.0.7 146 5/30/2024
0.0.6 132 5/29/2024
0.0.5-ci14 113 5/29/2024
0.0.1 136 5/29/2024