Class PELTPenaltySelector
- Namespace
- SignalSharp.Detection.PELT
- Assembly
- SignalSharp.dll
Provides methods to automatically select a penalty for the PELT algorithm using various criteria like BIC, AIC, or AICc.
public class PELTPenaltySelector
- Inheritance
-
PELTPenaltySelector
- Inherited Members
Remarks
Penalty selection is crucial for controlling the number of change points detected by PELT. This class implements common information criteria for model selection based on likelihood principles.
Note that likelihood-based criteria (BIC, AIC, AICc) require the cost function used in the PELT algorithm
to implement ILikelihoodCostFunction correctly and set SupportsInformationCriteria
to true.
The PELT algorithm instance provided to this selector must be fitted with the signal data *before* calling
the `SelectPenaltyInternal` method (or implicitly via `FitAndSelect`).
Constructors
PELTPenaltySelector(IPELTAlgorithm)
Initializes a new instance of the PELTPenaltySelector class.
public PELTPenaltySelector(IPELTAlgorithm peltAlgorithm)
Parameters
peltAlgorithm
IPELTAlgorithmThe PELT algorithm instance to use. Its internal state (e.g., fitted cost function) will be used.
Exceptions
- ArgumentNullException
Thrown if peltAlgorithm, its Options, or its CostFunction is null.
- ArgumentOutOfRangeException
Thrown if MinSize or Jump in peltAlgorithm.Options are invalid.
Properties
PELTAlgorithm
Gets the PELT algorithm instance used for penalty selection.
public IPELTAlgorithm PELTAlgorithm { get; }
Property Value
Methods
FitAndSelect(double[,], PELTPenaltySelectionOptions)
Fits the internal PELT algorithm to the multi-dimensional signal matrix and selects the optimal penalty based on the specified options.
public PELTPenaltySelectionResult FitAndSelect(double[,] signalMatrix, PELTPenaltySelectionOptions selectionOptions)
Parameters
signalMatrix
double[,]The multi-dimensional signal data (rows=dimensions, cols=time) used to fit the PELT algorithm.
selectionOptions
PELTPenaltySelectionOptionsConfiguration for the penalty selection process (method, range, etc.).
Returns
- PELTPenaltySelectionResult
A PELTPenaltySelectionResult containing the selected penalty and corresponding breakpoints.
Exceptions
- ArgumentNullException
Thrown if signalMatrix or selectionOptions are null.
- InvalidOperationException
Thrown if a likelihood-based selection method is requested but the cost function does not support it.
- PELTAlgorithmException
If an error occurs during the selection process or if no suitable penalty is found.
FitAndSelect(double[], PELTPenaltySelectionOptions)
Fits the internal PELT algorithm to the 1D signal and selects the optimal penalty based on the specified options.
public PELTPenaltySelectionResult FitAndSelect(double[] signal, PELTPenaltySelectionOptions selectionOptions)
Parameters
signal
double[]The 1D signal data used to fit the PELT algorithm.
selectionOptions
PELTPenaltySelectionOptionsConfiguration for the penalty selection process (method, range, etc.).
Returns
- PELTPenaltySelectionResult
A PELTPenaltySelectionResult containing the selected penalty and corresponding breakpoints.
Exceptions
- ArgumentNullException
Thrown if signal or selectionOptions are null.
- InvalidOperationException
Thrown if a likelihood-based selection method is requested but the cost function does not support it.
- PELTAlgorithmException
If an error occurs during the selection process or if no suitable penalty is found.