Skip to main content

chronix_analytics/multivariate/
error.rs

1//! Error types for multivariate analysis.
2
3use thiserror::Error;
4
5/// Errors produced by multivariate analysis operations.
6#[derive(Debug, Error)]
7pub enum MultivariateError {
8    /// Too few observations to perform the analysis.
9    #[error("insufficient data: need at least {min}, got {got}")]
10    InsufficientData {
11        /// Minimum number of data points required.
12        min: usize,
13        /// Number of data points actually provided.
14        got: usize,
15    },
16
17    /// Series lengths or matrix dimensions do not match.
18    #[error("dimension mismatch: expected {expected}, got {got}")]
19    DimensionMismatch {
20        /// Expected dimension size.
21        expected: usize,
22        /// Actual dimension size.
23        got: usize,
24    },
25
26    /// The derived-series dependency graph contains a cycle.
27    #[error("cycle detected in derived series dependency graph")]
28    CycleDetected,
29
30    /// The requested series name was not found.
31    #[error("series not found: {0}")]
32    SeriesNotFound(String),
33
34    /// The covariance matrix is singular (data may be collinear).
35    #[error("singular covariance matrix — data may be collinear")]
36    SingularMatrix,
37
38    /// A user-supplied parameter is invalid.
39    #[error("invalid parameter: {0}")]
40    InvalidParameter(String),
41
42    /// A general computation error.
43    #[error("compute error: {0}")]
44    Compute(String),
45
46    /// The model has not been fitted yet.
47    #[error("not fitted — call fit() before predict/detect")]
48    NotFitted,
49}