Skip to content

Commit 32c3234

Browse files
committed
[Docs] Documentation
1 parent 7776b09 commit 32c3234

17 files changed

Lines changed: 2007 additions & 0 deletions

docs/api.md

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
# API Reference
2+
3+
Complete reference for all public classes and functions.
4+
5+
---
6+
7+
## Models
8+
9+
All models follow the same interface:
10+
11+
```python
12+
model = ModelClass(**params) # configure
13+
model.fit(y, m=1, X=None) # fit to data → returns self
14+
fc = model.forecast(h=10, level=None) # forecast → ForecastResult
15+
```
16+
17+
### Properties (after fitting)
18+
19+
| Property | Type | Description |
20+
|----------|------|-------------|
21+
| `fitted_values` | `np.ndarray` | In-sample fitted values |
22+
| `residuals` | `np.ndarray` | In-sample residuals |
23+
| `summary` | `str` | Model summary string |
24+
| `coefficients` | `dict` | Model coefficients |
25+
26+
### Methods
27+
28+
| Method | Returns | Description |
29+
|--------|---------|-------------|
30+
| `.fit(y, m=1, X=None)` | `self` | Fit model to data |
31+
| `.forecast(h=10, level=None)` | `ForecastResult` | Generate forecasts |
32+
| `.predict(h=10, **kw)` | `ForecastResult` | Alias for `.forecast()` |
33+
| `.get_params()` | `dict` | Return model parameters |
34+
35+
---
36+
37+
### Exponential Smoothing
38+
39+
#### `SES(initial="optimal", alpha=None, lambda_=None, biasadj=False)`
40+
41+
Simple Exponential Smoothing. [User Guide](user-guide/exponential-smoothing.md#ses-simple-exponential-smoothing)
42+
43+
#### `Holt(damped=False, initial="optimal", exponential=False, alpha=None, beta=None, phi=None, lambda_=None, biasadj=False)`
44+
45+
Holt's linear trend method. [User Guide](user-guide/exponential-smoothing.md#holt-linear-trend-method)
46+
47+
#### `HoltWinters(seasonal="additive", damped=False, initial="optimal", exponential=False, alpha=None, beta=None, gamma=None, phi=None, lambda_=None, biasadj=False)`
48+
49+
Holt-Winters triple exponential smoothing. [User Guide](user-guide/exponential-smoothing.md#holtwinters-triple-exponential-smoothing)
50+
51+
#### `ETS(model="ZZZ", damped=None, alpha=None, beta=None, gamma=None, phi=None, additive_only=False, lambda_=None, biasadj=False, opt_crit="lik", ic="aicc", bounds="both", restrict=True, allow_multiplicative_trend=False)`
52+
53+
Error-Trend-Seasonal state space model. [User Guide](user-guide/exponential-smoothing.md#ets-error-trend-seasonal-state-space)
54+
55+
#### `Croston()`
56+
57+
Simple Croston method for intermittent demand. [User Guide](user-guide/exponential-smoothing.md#croston-intermittent-demand-simple)
58+
59+
---
60+
61+
### ARIMA
62+
63+
#### `ARIMA(order=(0,0,0), seasonal_order=None, include_mean=True, method="CSS-ML", transform_pars=True, lambda_=None, biasadj=None)`
64+
65+
ARIMA/SARIMA model. [User Guide](user-guide/arima.md#arima-manual-specification)
66+
67+
#### `AutoARIMA(d=None, D=None, max_p=5, max_q=5, max_P=2, max_Q=2, max_order=5, max_d=2, max_D=1, stationary=False, seasonal=True, stepwise=True, trace=False, approximation=True, ic="aicc", test="adf", seasonal_test="ocsb", allowmean=True, allowdrift=True, lambda_=None, biasadj=None)`
68+
69+
Automatic ARIMA selection. [User Guide](user-guide/arima.md#autoarima-automatic-selection)
70+
71+
---
72+
73+
### Naive Methods
74+
75+
#### `Naive(lambda_=None, biasadj=False)`
76+
77+
Naive forecast (last value). [User Guide](user-guide/naive.md#naive)
78+
79+
#### `SeasonalNaive(lambda_=None, biasadj=False)`
80+
81+
Seasonal naive forecast. [User Guide](user-guide/naive.md#seasonalnaive)
82+
83+
#### `RandomWalk(drift=False, lambda_=None, biasadj=False)`
84+
85+
Random walk with optional drift. [User Guide](user-guide/naive.md#randomwalk)
86+
87+
#### `MeanForecast(lambda_=None, biasadj=False)`
88+
89+
Mean forecast. [User Guide](user-guide/naive.md#meanforecast)
90+
91+
---
92+
93+
### BATS / TBATS
94+
95+
#### `BATS(use_box_cox=None, use_trend=None, use_damped_trend=None, use_arma_errors=True, bc_lower=0.0, bc_upper=1.0, biasadj=False)`
96+
97+
BATS model for complex seasonality. [User Guide](user-guide/bats.md#bats)
98+
99+
#### `TBATS(use_box_cox=None, use_trend=None, use_damped_trend=None, use_arma_errors=True, bc_lower=0.0, bc_upper=1.0, biasadj=False)`
100+
101+
Trigonometric BATS for non-integer periods. [User Guide](user-guide/bats.md#tbats)
102+
103+
---
104+
105+
### Theta
106+
107+
#### `Theta(model_type="OTM", alpha=None, theta_param=None, initial_level=None, nmse=3)`
108+
109+
Theta method. [User Guide](user-guide/theta.md#theta)
110+
111+
#### `AutoTheta(model=None, decomposition_type="multiplicative", alpha=None, theta_param=None, initial_level=None, nmse=3)`
112+
113+
Automatic Theta selection. [User Guide](user-guide/theta.md#autotheta)
114+
115+
---
116+
117+
### Diffusion
118+
119+
#### `Diffusion(model_type="Bass", cleanlead=True, loss=2, cumulative=True)`
120+
121+
Innovation diffusion model. [User Guide](user-guide/diffusion.md)
122+
123+
---
124+
125+
### ARAR / ARARMA
126+
127+
#### `ARAR(max_ar_depth=None, max_lag=None)`
128+
129+
ARAR model. [User Guide](user-guide/ararma.md#arar)
130+
131+
#### `ARARMA(max_ar_depth=26, max_lag=40, p=4, q=1)`
132+
133+
ARARMA model. [User Guide](user-guide/ararma.md#ararma)
134+
135+
#### `AutoARARMA(min_p=0, max_p=4, min_q=0, max_q=2, max_ar_depth=26, max_lag=40)`
136+
137+
Automatic ARARMA selection. [User Guide](user-guide/ararma.md#autoararma)
138+
139+
---
140+
141+
### Intermittent Demand
142+
143+
#### `CrostonClassic(init_strategy="mean", number_of_params=2, cost_metric="mar", optimize_init=True, rm_missing=False)`
144+
145+
Croston's classic method. [User Guide](user-guide/intermittent.md#crostonclassic)
146+
147+
#### `CrostonSBA(...)`
148+
149+
Syntetos-Boylan Approximation. Same parameters as `CrostonClassic`. [User Guide](user-guide/intermittent.md#crostonsba)
150+
151+
#### `CrostonSBJ(...)`
152+
153+
Shale-Boylan-Johnston variant. Same parameters as `CrostonClassic`. [User Guide](user-guide/intermittent.md#crostonsbj)
154+
155+
---
156+
157+
## ForecastResult
158+
159+
```python
160+
@dataclass
161+
class ForecastResult:
162+
mean: np.ndarray # point forecasts
163+
lower: dict[int, np.ndarray] # {80: [...], 95: [...]}
164+
upper: dict[int, np.ndarray] # {80: [...], 95: [...]}
165+
level: list[int] # [80, 95]
166+
fitted_values: np.ndarray # in-sample fitted
167+
residuals: np.ndarray # in-sample residuals
168+
method: str # model description
169+
x: np.ndarray # original data
170+
```
171+
172+
### Methods
173+
174+
| Method | Returns | Description |
175+
|--------|---------|-------------|
176+
| `.to_dataframe()` | `pd.DataFrame` | Columns: step, mean, lower_80, upper_80, ... |
177+
| `.plot(ax=None, show_history=True)` | matplotlib `Axes` | Plot forecast with intervals |
178+
179+
---
180+
181+
## compare()
182+
183+
```python
184+
compare(
185+
models: dict[str, BaseForecaster],
186+
y_train: array-like,
187+
y_test: array-like,
188+
m: int = 1,
189+
h: int | None = None,
190+
level: list[int] | None = None,
191+
) -> ComparisonResult
192+
```
193+
194+
[User Guide](user-guide/compare.md)
195+
196+
---
197+
198+
## ComparisonResult
199+
200+
| Attribute | Type | Description |
201+
|-----------|------|-------------|
202+
| `model_names` | `list[str]` | Model names |
203+
| `forecasts` | `dict[str, ForecastResult]` | Forecasts per model |
204+
| `metrics` | `dict[str, dict[str, float]]` | Metrics per model |
205+
206+
| Method | Returns | Description |
207+
|--------|---------|-------------|
208+
| `.to_dataframe()` | `pd.DataFrame` | One row per model, metric columns |
209+
| `.plot(ax=None)` | matplotlib `Axes` | Overlay all forecasts |
210+
211+
---
212+
213+
## PanelForecaster
214+
215+
```python
216+
PanelForecaster(model: BaseForecaster, groupby: str | list[str])
217+
```
218+
219+
| Method | Returns | Description |
220+
|--------|---------|-------------|
221+
| `.fit(data, y_col="y", m=1, date_col=None)` | `self` | Fit per group |
222+
| `.forecast(h=10, level=None)` | `PanelForecastResult` | Forecast all groups |
223+
224+
[User Guide](user-guide/panel.md)
225+
226+
---
227+
228+
## PanelForecastResult
229+
230+
| Attribute | Type | Description |
231+
|-----------|------|-------------|
232+
| `groups` | `dict[Any, ForecastResult]` | Results per group |
233+
234+
| Method | Returns | Description |
235+
|--------|---------|-------------|
236+
| `.to_dataframe()` | `pd.DataFrame` | Long-format with group column |
237+
238+
---
239+
240+
## Metrics
241+
242+
```python
243+
from durbyn.metrics import me, rmse, mae, mpe, mape, mase, acf1, accuracy
244+
```
245+
246+
| Function | Signature | Description |
247+
|----------|-----------|-------------|
248+
| `me(actual, predicted)` | `→ float` | Mean Error |
249+
| `rmse(actual, predicted)` | `→ float` | Root Mean Squared Error |
250+
| `mae(actual, predicted)` | `→ float` | Mean Absolute Error |
251+
| `mpe(actual, predicted)` | `→ float` | Mean Percentage Error (%) |
252+
| `mape(actual, predicted)` | `→ float` | Mean Absolute Percentage Error (%) |
253+
| `mase(actual, predicted, training_data)` | `→ float` | Mean Absolute Scaled Error |
254+
| `acf1(actual, predicted)` | `→ float` | Lag-1 autocorrelation of errors |
255+
| `accuracy(actual, predicted, training_data=None)` | `→ dict` | All metrics combined |
256+
257+
[User Guide](user-guide/metrics.md)
258+
259+
---
260+
261+
## Exceptions
262+
263+
```python
264+
from durbyn.exceptions import DurbynError, NotFittedError, JuliaNotAvailableError, DurbynNotInstalledError
265+
```
266+
267+
| Exception | Parent | Description |
268+
|-----------|--------|-------------|
269+
| `DurbynError` | `Exception` | Base exception |
270+
| `JuliaNotAvailableError` | `DurbynError, ImportError` | Julia runtime not found |
271+
| `DurbynNotInstalledError` | `DurbynError, ImportError` | Durbyn.jl not installed |
272+
| `NotFittedError` | `DurbynError, RuntimeError` | Model not fitted yet |

docs/assets/logo.png

69.3 KB
Loading

docs/assets/theme.css

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/* ===== durbyn custom theme — matches Durbyn.jl ===== */
2+
:root {
3+
--brand: #2e7dd7;
4+
--ink: #0b1324;
5+
--muted: #6b7280;
6+
--bg: #ffffff;
7+
--card: #f8fafc;
8+
}
9+
10+
/* Material theme color overrides */
11+
[data-md-color-scheme="default"] {
12+
--md-primary-fg-color: #2e7dd7;
13+
--md-primary-fg-color--light: #5a9be6;
14+
--md-primary-fg-color--dark: #1b5faa;
15+
--md-accent-fg-color: #2e7dd7;
16+
--md-typeset-a-color: #2e7dd7;
17+
}
18+
19+
[data-md-color-scheme="slate"] {
20+
--md-primary-fg-color: #2e7dd7;
21+
--md-primary-fg-color--light: #5a9be6;
22+
--md-primary-fg-color--dark: #1b5faa;
23+
--md-accent-fg-color: #5a9be6;
24+
--md-default-bg-color: #0b1324;
25+
--md-default-fg-color: #ebf0f6;
26+
--md-code-bg-color: #0f1a2b;
27+
}
28+
29+
/* HERO */
30+
.hero {
31+
padding: 3rem 0 2rem;
32+
text-align: center;
33+
}
34+
35+
.hero .logo {
36+
width: 96px;
37+
height: 96px;
38+
border-radius: 20px;
39+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
40+
}
41+
42+
.hero h1 {
43+
font-size: 2.4rem;
44+
margin: 0.75rem 0 0.25rem;
45+
}
46+
47+
.hero p {
48+
color: var(--muted);
49+
margin: 0 auto 1rem;
50+
max-width: 720px;
51+
}
52+
53+
/* CTA buttons */
54+
.cta-row {
55+
display: inline-flex;
56+
gap: 0.75rem;
57+
margin: 0.75rem 0 0;
58+
}
59+
60+
.btn {
61+
padding: 0.6rem 1rem;
62+
border-radius: 0.75rem;
63+
border: 1px solid rgba(0, 0, 0, 0.1);
64+
text-decoration: none;
65+
font-weight: 500;
66+
}
67+
68+
.btn.primary {
69+
background: var(--brand);
70+
color: white;
71+
border-color: var(--brand);
72+
}
73+
74+
.btn.ghost {
75+
background: transparent;
76+
}
77+
78+
/* BADGES */
79+
.badges {
80+
display: flex;
81+
gap: 0.5rem;
82+
justify-content: center;
83+
margin-top: 0.75rem;
84+
filter: saturate(0.9);
85+
}
86+
87+
/* GRID */
88+
.feature-grid {
89+
display: grid;
90+
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
91+
gap: 1rem;
92+
margin: 1.25rem 0;
93+
}
94+
95+
.card {
96+
background: var(--card);
97+
padding: 1rem;
98+
border-radius: 14px;
99+
border: 1px solid rgba(0, 0, 0, 0.06);
100+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
101+
}
102+
103+
.card h3 {
104+
margin-top: 0;
105+
}
106+
107+
[data-md-color-scheme="slate"] .card {
108+
background: #0f1a2b;
109+
border-color: rgba(255, 255, 255, 0.06);
110+
}
111+
112+
/* FOOTER */
113+
.footer {
114+
opacity: 0.7;
115+
text-align: center;
116+
font-size: 0.9rem;
117+
padding: 1rem 0 0;
118+
}

0 commit comments

Comments
 (0)