CrostonClassicHyperparams
chronax.croston_classic_model.CrostonClassicHyperparams · inherits PydanticBaseModel
(No prose summary provided in docstring.)
__init__(self, ...)
(Pydantic initialization based on fields.)
| Parameter | Type | Default | Description |
|---|---|---|---|
alpha |
float |
- | Smoothing parameter for demand level (must be > 0 and < 1). |
gamma |
float |
- | Smoothing parameter for interval level (must be > 0 and < 1). |
CrostonClassicModel
chronax.croston_classic_model.CrostonClassicModel · inherits BaseModel
Croston's Classic Model implementation for intermittent demand forecasting.
__init__(self, params: Dict[str, Any], settings: Dict[str, Any])
(No prose summary provided in docstring.)
| Parameter | Type | Default | Description |
|---|---|---|---|
params |
Dict[str, Any] |
- | (undocumented) |
settings |
Dict[str, Any] |
- | (undocumented) |
train(self, y_context: np.ndarray, y_target: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, **kwargs: dict) -> "CrostonClassicModel"
Train the Croston's Classic model on the given time series data.
Decomposes the series into non-zero demand values and the intervals between them, and applies Simple Exponential Smoothing (SES) to both.
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | Past target values for training (shape: [n_timesteps, n_variates]). |
y_target |
np.ndarray |
- | Ignored; included for interface compatibility. |
timestamps_context |
np.ndarray |
- | Ignored. |
timestamps_target |
np.ndarray |
- | Ignored. |
x_context |
Optional[np.ndarray] |
None |
(undocumented) |
x_target |
Optional[np.ndarray] |
None |
(undocumented) |
**kwargs |
dict |
- | Expected to include 'alpha' and 'gamma'. |
Returns: CrostonClassicModel (Trained model.)
predict(self, y_context: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, **kwargs: dict) -> np.ndarray
Predict future values using the trained Croston's Classic model.
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | Ignored. |
timestamps_context |
np.ndarray |
- | Ignored. |
timestamps_target |
np.ndarray |
- | Used to determine forecast horizon. |
x_context |
Optional[np.ndarray] |
None |
(undocumented) |
x_target |
Optional[np.ndarray] |
None |
(undocumented) |
**kwargs |
dict |
- | Ignored. |
Returns: np.ndarray (Predictions with shape (forecast_horizon, num_targets).)
Raises: ValueError
get_model_summary(self) -> Dict[str, Any]
Returns a summary of the Croston's Classic model.
Returns: Dict[str, Any] (The summary dictionary.)