Model Selection
ROLCH
employs online model selection based on information criteria (IC). We calculate the IC based on the Residual Sum of Squares (RSS), which can be tracked online.
API Reference
rolch.information_criterion
information_criterion(n_observations: Union[int, np.ndarray], n_parameters: Union[int, np.ndarray], rss: Union[float, np.ndarray], criterion: Literal['aic', 'bic', 'hqc'] = 'aic') -> Union[float, np.ndarray]
Calcuate the information criteria.
The information criteria are calculated from the Resdiual Sum of Squares \(RSS\). The function provides the calculation of Akaikes IC, the bayesian IC and the Harman-Quinn IC.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_observations
|
Union[int, ndarray]
|
Number of observations |
required |
n_parameters
|
Union[int, ndarray]
|
Number of parameters |
required |
rss
|
Union[float, ndarray]
|
Residual sum of squares |
required |
criterion
|
Literal['aic', 'bic', 'hqc']
|
Information criteria to calculate. Defaults to "aic". |
'aic'
|
Raises:
Type | Description |
---|---|
ValueError
|
Raises if the criterion is not one of |
Returns:
Type | Description |
---|---|
Union[float, ndarray]
|
Union[float, np.ndarray]: The value of the IC for given inputs. |
rolch.select_best_model_by_information_criterion
select_best_model_by_information_criterion(n_observations: float, n_parameters: np.ndarray, rss: np.ndarray, criterion: Literal['aic', 'bic', 'hqc', 'max']) -> int
Calculates the information criterion and returns the model with the best (lowest) IC.
Note
The information criterion max
will always return the largest model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_observations
|
float
|
Number of observations |
required |
n_parameters
|
ndarray
|
Number of parameters per model |
required |
rss
|
ndarray
|
Residual sum of squares per model |
required |
criterion
|
Literal['aic', 'bic', 'hqc', 'max']
|
Information criterion. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Raises if the criterion is not one of |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Index of the model with the best (lowest) IC. |