# Transformations


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L18"
target="_blank" style="float:right; font-size:smaller">source</a>

### box_cox_transform

``` python

def box_cox_transform(
    x, # The input data to be transformed.
    shift:bool=False, # Whether to shift the data by 1 before transformation to handle zeros.
    box_cox_lmda:float=None, # The lambda parameter for the Box-Cox transformation. If None, it will be estimated from the data.
): # The Box-Cox transformed data and the lambda used for transformation.

```

*Applies a Box-Cox transformation to a series x.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
<td></td>
<td></td>
<td>The input data to be transformed.</td>
</tr>
<tr>
<td>shift</td>
<td>bool</td>
<td>False</td>
<td>Whether to shift the data by 1 before transformation to handle
zeros.</td>
</tr>
<tr>
<td>box_cox_lmda</td>
<td>float</td>
<td>None</td>
<td>The lambda parameter for the Box-Cox transformation. If None, it
will be estimated from the data.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td><strong>The Box-Cox transformed data and the lambda used for
transformation.</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L59"
target="_blank" style="float:right; font-size:smaller">source</a>

### back_box_cox_transform

``` python

def back_box_cox_transform(
    y_pred:np.ndarray, # The Box-Cox transformed forecast to be back-transformed.
    lmda:float, # The lambda parameter used in the Box-Cox transformation.
    shift:bool=False, # Whether the original data was shifted by 1 before transformation.
    box_cox_biasadj:bool=False, # Whether to apply bias adjustment to the back-transformed forecast.
)->np.ndarray: # The back-transformed forecast.

```

*Inverse Box-Cox transform.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>y_pred</td>
<td>np.ndarray</td>
<td></td>
<td>The Box-Cox transformed forecast to be back-transformed.</td>
</tr>
<tr>
<td>lmda</td>
<td>float</td>
<td></td>
<td>The lambda parameter used in the Box-Cox transformation.</td>
</tr>
<tr>
<td>shift</td>
<td>bool</td>
<td>False</td>
<td>Whether the original data was shifted by 1 before
transformation.</td>
</tr>
<tr>
<td>box_cox_biasadj</td>
<td>bool</td>
<td>False</td>
<td>Whether to apply bias adjustment to the back-transformed
forecast.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>np.ndarray</strong></td>
<td></td>
<td><strong>The back-transformed forecast.</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L110"
target="_blank" style="float:right; font-size:smaller">source</a>

### fourier_terms

``` python

def fourier_terms(
    index:Union[pd.Index, tuple], # Either a pandas Index directly (recommended), or a (start, end) tuple of integers or datetime strings.
    period:Union[int, float], # The period of the seasonality (e.g., 365.25/7 for weekly yearly seasonality).
    num_terms:int, # The number of Fourier term pairs (sin + cos) to generate.
    frequency:Optional[str]=None, # Frequency string (e.g., "W-SAT", "D", "M", "W"). Only relevant when index is a (start, end) tuple.
    t_start:Optional[int]=None, # Starting position of t. Only used when index is a (start, end) tuple. Use len(train_index) to ensure continuity between train and test.
)->pd.DataFrame: # DataFrame of Fourier terms aligned to the provided index.

```

*Generate Fourier terms for a given index or (start, end) tuple.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>index</td>
<td>Union[pd.Index, tuple]</td>
<td></td>
<td>Either a pandas Index directly (recommended), or a (start, end)
tuple of integers or datetime strings.</td>
</tr>
<tr>
<td>period</td>
<td>Union[int, float]</td>
<td></td>
<td>The period of the seasonality (e.g., 365.25/7 for weekly yearly
seasonality).</td>
</tr>
<tr>
<td>num_terms</td>
<td>int</td>
<td></td>
<td>The number of Fourier term pairs (sin + cos) to generate.</td>
</tr>
<tr>
<td>frequency</td>
<td>Optional[str]</td>
<td>None</td>
<td>Frequency string (e.g., “W-SAT”, “D”, “M”, “W”). Only relevant when
index is a (start, end) tuple.</td>
</tr>
<tr>
<td>t_start</td>
<td>Optional[int]</td>
<td>None</td>
<td>Starting position of t. Only used when index is a (start, end)
tuple. Use len(train_index) to ensure continuity between train and
test.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>pd.DataFrame</strong></td>
<td></td>
<td><strong>DataFrame of Fourier terms aligned to the provided
index.</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L182"
target="_blank" style="float:right; font-size:smaller">source</a>

### rolling_mean

``` python

def rolling_mean(
    window_size:int, # The size of the rolling window.
    shift:int=1, # The number of periods to shift the data before applying the rolling mean (default is 1).
    min_samples:int=1, # The minimum number of observations in the window required to have a value (default is 1).
):

```

*A class to compute the rolling mean of a time series with specified
window size and shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>window_size</td>
<td>int</td>
<td></td>
<td>The size of the rolling window.</td>
</tr>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the rolling
mean (default is 1).</td>
</tr>
<tr>
<td>min_samples</td>
<td>int</td>
<td>1</td>
<td>The minimum number of observations in the window required to have a
value (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L243"
target="_blank" style="float:right; font-size:smaller">source</a>

### rolling_quantile

``` python

def rolling_quantile(
    window_size:int, # The size of the rolling window.
    quantile:float, # The quantile to compute (between 0 and 1).
    shift:int=1, # The number of periods to shift the data before applying the rolling quantile (default is 1).
    min_samples:int=1, # The minimum number of observations in the window required to have a value (default is 1).
):

```

*A class to compute the rolling quantile of a time series with specified
window size, quantile, and shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>window_size</td>
<td>int</td>
<td></td>
<td>The size of the rolling window.</td>
</tr>
<tr>
<td>quantile</td>
<td>float</td>
<td></td>
<td>The quantile to compute (between 0 and 1).</td>
</tr>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the rolling
quantile (default is 1).</td>
</tr>
<tr>
<td>min_samples</td>
<td>int</td>
<td>1</td>
<td>The minimum number of observations in the window required to have a
value (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L304"
target="_blank" style="float:right; font-size:smaller">source</a>

### rolling_std

``` python

def rolling_std(
    window_size:int, # The size of the rolling window.
    shift:int=1, # The number of periods to shift the data before applying the rolling standard deviation (default is 1).
    min_samples:int=1, # The minimum number of observations in the window required to have a value (default is 1).
):

```

*A class to compute the rolling standard deviation of a time series with
specified window size and shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>window_size</td>
<td>int</td>
<td></td>
<td>The size of the rolling window.</td>
</tr>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the rolling
standard deviation (default is 1).</td>
</tr>
<tr>
<td>min_samples</td>
<td>int</td>
<td>1</td>
<td>The minimum number of observations in the window required to have a
value (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L361"
target="_blank" style="float:right; font-size:smaller">source</a>

### rolling_min

``` python

def rolling_min(
    window_size:int, # The size of the rolling window.
    shift:int=1, # The number of periods to shift the data before applying the rolling minimum (default is 1).
    min_samples:int=1, # The minimum number of observations in the window required to have a value (default is 1).
):

```

*A class to compute the rolling minimum of a time series with specified
window size and shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>window_size</td>
<td>int</td>
<td></td>
<td>The size of the rolling window.</td>
</tr>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the rolling
minimum (default is 1).</td>
</tr>
<tr>
<td>min_samples</td>
<td>int</td>
<td>1</td>
<td>The minimum number of observations in the window required to have a
value (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L422"
target="_blank" style="float:right; font-size:smaller">source</a>

### rolling_max

``` python

def rolling_max(
    window_size:int, # The size of the rolling window.
    shift:int=1, # The number of periods to shift the data before applying the rolling maximum (default is 1).
    min_samples:int=1, # The minimum number of observations in the window required to have a value (default is 1).
):

```

*A class to compute the rolling maximum of a time series with specified
window size and shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>window_size</td>
<td>int</td>
<td></td>
<td>The size of the rolling window.</td>
</tr>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the rolling
maximum (default is 1).</td>
</tr>
<tr>
<td>min_samples</td>
<td>int</td>
<td>1</td>
<td>The minimum number of observations in the window required to have a
value (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L483"
target="_blank" style="float:right; font-size:smaller">source</a>

### expanding_mean

``` python

def expanding_mean(
    shift:int=1
):

```

*A class to compute the expanding mean of a time series with specified
shift.*

<table>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L510"
target="_blank" style="float:right; font-size:smaller">source</a>

### expanding_std

``` python

def expanding_std(
    shift:int=1, # The number of periods to shift the data before applying the expanding standard deviation (default is 1).
):

```

*A class to compute the expanding standard deviation of a time series
with specified shift.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the
expanding standard deviation (default is 1).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/mustafaslanCoto/peshbeen/blob/main/peshbeen/transformations.py#L535"
target="_blank" style="float:right; font-size:smaller">source</a>

### expanding_quantile

``` python

def expanding_quantile(
    shift:int=1, # The number of periods to shift the data before applying the expanding quantile (default is 1).
    quantile:float=0.5, # The quantile to compute (between 0 and 1) (default is 0.5).
):

```

*A class to compute the expanding quantile of a time series with
specified shift and quantile.*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>shift</td>
<td>int</td>
<td>1</td>
<td>The number of periods to shift the data before applying the
expanding quantile (default is 1).</td>
</tr>
<tr>
<td>quantile</td>
<td>float</td>
<td>0.5</td>
<td>The quantile to compute (between 0 and 1) (default is 0.5).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
