1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
use gamlss_core::ModelError;
use gamlss_spline::{FourierError, SplineError};
use thiserror::Error;
/// Errors returned by the typed formula/builder layer.
#[derive(Debug, Clone, PartialEq, Error)]
pub enum FormulaError {
/// Requested column is not available in the data view.
#[error("unknown column `{0}`")]
UnknownColumn(String),
/// A column returned by [`crate::DataView`] has a length different from
/// [`crate::DataView::nrows`].
#[error("column `{name}` has {actual} rows, expected {expected}")]
ColumnLength {
/// Column name.
name: String,
/// Expected number of rows.
expected: usize,
/// Actual number of rows.
actual: usize,
},
/// Requested column type is not supported by this data view.
#[error("column `{name}` does not support requested type `{requested}`")]
UnsupportedColumnType {
/// Column name.
name: String,
/// Requested logical type.
requested: &'static str,
},
/// Numeric input contains a non-finite value.
#[error("column `{name}` contains non-finite value at row {row}")]
NonFiniteValue {
/// Column name.
name: String,
/// Row index.
row: usize,
},
/// Observation weight is not finite or is negative.
#[error("weights column `{name}` has invalid value at row {row}")]
InvalidWeight {
/// Column name.
name: String,
/// Row index.
row: usize,
},
/// Response value is outside the family domain.
#[error("response column `{name}` has invalid {family} value at row {row}")]
InvalidResponseDomain {
/// Column name.
name: String,
/// Family name.
family: &'static str,
/// Row index.
row: usize,
},
/// Prediction data contains a categorical level not seen during training.
#[error("column `{name}` has unknown category `{level}` at row {row}")]
UnknownCategoryLevel {
/// Column name.
name: String,
/// Unknown level.
level: String,
/// Row index.
row: usize,
},
/// The model spec did not include a response column.
#[error("model spec is missing a response column")]
MissingResponse,
/// The data view has no rows.
#[error("data view must contain at least one row")]
EmptyData,
/// A model parameter was configured more than once.
#[error("parameter `{0}` terms were specified more than once")]
DuplicateParameter(&'static str),
/// Spline term construction failed.
#[error(transparent)]
Spline(#[from] SplineError),
/// Fourier term construction failed.
#[error(transparent)]
Fourier(#[from] FourierError),
/// Compiled core model validation failed.
#[error(transparent)]
Model(#[from] ModelError),
}