> ## Documentation Index
> Fetch the complete documentation index at: https://systematica.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Selection

> systematica.preprocessing.model_selection

## `get_aic_nb`

```python theme={null}
get_aic_nb(
    arr: numpy.ndarray,
) ‑> float
```

Calculate the Akaike Information Criterion (AIC) from a log-likelihood array.

The AIC is defined as:

$$
 AIC = -2 * loglikelihood + 2 * k
$$

where:

* log-likelihood is the sum of the log-likelihood values in the input array,
* `k` is the number of estimated parameters (assumed to be `1` in this implementation).

**Parameters**:

| Name  | Type         | Default | Description                                               |
| ----- | ------------ | ------- | --------------------------------------------------------- |
| `arr` | `tp.Array1d` | `--`    | A one-dimensional array containing log-likelihood values. |

**Returns**:

| Type    | Description                                                              |
| ------- | ------------------------------------------------------------------------ |
| `float` | The computed AIC value if the input contains valid data; otherwise, NaN. |

## `get_bic_nb`

```python theme={null}
get_bic_nb(
    arr: numpy.ndarray,
) ‑> float
```

Calculate Bayesian Information Criterion (BIC) from a log-likelihood
array.

The BIC is defined as:

$$
BIC = -2 * loglikelihood + k * log(n)
$$

where:

* `loglikelihood` is the sum of the log-likelihood values in the input array,
* `k` is the number of estimated parameters (assumed to be `1` in this implementation),
* `n` is the number of observations (length of the input array).

**Parameters**:

| Name  | Type         | Default | Description                                     |
| ----- | ------------ | ------- | ----------------------------------------------- |
| `arr` | `tp.Array1d` | `--`    | A 1-dimensional array of log-likelihood values. |

**Returns**:

| Type    | Description                                                                                                 |
| ------- | ----------------------------------------------------------------------------------------------------------- |
| `float` | The BIC value if valid data is provided. Returns NaN if the input array is empty or contains no valid data. |

## `get_aicc_nb`

```python theme={null}
get_aicc_nb(
    arr: numpy.ndarray,
) ‑> float
```

Calculate Corrected Akaike Information Criterion (AICc) from a log-likelihood
array.

The AICc is defined as:

$$
AICc = AIC + 2k \frac{k + 1}{n - k - 1}
$$

where:

* `AIC` is the Akaike Information Criterion,
* `k` is the number of estimated parameters (assumed to be `1` in this implementation),
* `n` is the number of observations (length of the input array).

**Parameters**:

| Name  | Type         | Default | Description                                     |
| ----- | ------------ | ------- | ----------------------------------------------- |
| `arr` | `tp.Array1d` | `--`    | A 1-dimensional array of log-likelihood values. |

**Returns**:

| Type    | Description                                                                                                  |
| ------- | ------------------------------------------------------------------------------------------------------------ |
| `float` | The AICc value if valid data is provided. Returns NaN if the input array is empty or contains no valid data. |
