

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

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

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

### pesh

``` python

def pesh(
    models:dict, # A dictionary of model instances to be used for forecasting. The keys should be string names for each model.
    weighting_scheme:Optional[Dict[str, float]]=None, # Optional dictionary specifying weights for each model's forecast. Default is None, which means equal weighting.
)->None:

```

*Initialize the pesh model with the specified parameters for hybrid
forecasting that combines forecasts from multiple models.*

<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>models</td>
<td>dict</td>
<td></td>
<td>A dictionary of model instances to be used for forecasting. The keys
should be string names for each model.</td>
</tr>
<tr>
<td>weighting_scheme</td>
<td>Optional[Dict[str, float]]</td>
<td>None</td>
<td>Optional dictionary specifying weights for each model’s forecast.
Default is None, which means equal weighting.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>None</strong></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

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

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

### pesh.fit

``` python

def fit(
    df:pd.DataFrame, # Training DataFrame containing the target and any feature columns.
)->None:

```

*Fit the specified models to the training data.*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>df</td>
<td>pd.DataFrame</td>
<td>Training DataFrame containing the target and any feature
columns.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>None</strong></td>
<td></td>
</tr>
</tbody>
</table>

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

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

### pesh.forecast

``` python

def forecast(
    H:int, # Forecast horizon.
    exog:Optional[pd.DataFrame]=None, # Optional dataframe of future regressors. Must have the same columns as the exogenous variables used during training and at least `H` rows.
)->np.ndarray: # Forecast values of length `H`.

```

*Recursive multi-step forecast.*

<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>H</td>
<td>int</td>
<td></td>
<td>Forecast horizon.</td>
</tr>
<tr>
<td>exog</td>
<td>Optional[pd.DataFrame]</td>
<td>None</td>
<td>Optional dataframe of future regressors. Must have the same columns
as the exogenous variables used during training and at least
<code>H</code> rows.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>np.ndarray</strong></td>
<td></td>
<td><strong>Forecast values of length <code>H</code>.</strong></td>
</tr>
</tbody>
</table>

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

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

### pesh.cross_validate

``` python

def cross_validate(
    df:pd.DataFrame, # The input DataFrame containing the target and any feature columns.
    cv_split:int, # The number of cross-validation splits.
    test_size:int, # The size of the test set for each split.
    metrics:List[Callable], # Metric functions (e.g. ``[MAE, RMSE]``) used to evaluate forecast accuracy across folds. Call ``.cv_summary()`` after cross-validation to retrieve the aggregated scores.
    step_size:int=1, # The step size for rolling the forecasting origin.
    metric_to_opt:Optional[Callable]=None, # An optional metric function to optimize when weighting_scheme is set to "optimize". If None, it defaults to the first metric in the metrics list.
    weighting_scheme:Optional[Union[Dict[str, float], str]]=None, # None: equal weights across models. dict: user-provided weights (must sum to 1). "optimize": optimize weights to minimize MSE via `scipy.optimize.minimize`.
    optimizer:str='SLSQP', # Optimization method to use when weighting_scheme is set to "optimize". Passed to `scipy.optimize.minimize`. Refer to SciPy documentation for available methods.
)->pd.DataFrame: # A DataFrame containing the performance metrics for each model and the combined forecast across all cross-validation splits. Also, optimized weights are stored in `self.optimal_weights_` if `weighting_scheme` is "optimize".

```

*Perform cross-validation for the pesh model using a rolling forecasting
origin approach.*

<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>df</td>
<td>pd.DataFrame</td>
<td></td>
<td>The input DataFrame containing the target and any feature
columns.</td>
</tr>
<tr>
<td>cv_split</td>
<td>int</td>
<td></td>
<td>The number of cross-validation splits.</td>
</tr>
<tr>
<td>test_size</td>
<td>int</td>
<td></td>
<td>The size of the test set for each split.</td>
</tr>
<tr>
<td>metrics</td>
<td>List[Callable]</td>
<td></td>
<td>Metric functions (e.g. <code>[MAE, RMSE]</code>) used to evaluate
forecast accuracy across folds. Call <code>.cv_summary()</code> after
cross-validation to retrieve the aggregated scores.</td>
</tr>
<tr>
<td>step_size</td>
<td>int</td>
<td>1</td>
<td>The step size for rolling the forecasting origin.</td>
</tr>
<tr>
<td>metric_to_opt</td>
<td>Optional[Callable]</td>
<td>None</td>
<td>An optional metric function to optimize when weighting_scheme is set
to “optimize”. If None, it defaults to the first metric in the metrics
list.</td>
</tr>
<tr>
<td>weighting_scheme</td>
<td>Optional[Union[Dict[str, float], str]]</td>
<td>None</td>
<td>None: equal weights across models. dict: user-provided weights (must
sum to 1). “optimize”: optimize weights to minimize MSE via
<code>scipy.optimize.minimize</code>.</td>
</tr>
<tr>
<td>optimizer</td>
<td>str</td>
<td>SLSQP</td>
<td>Optimization method to use when weighting_scheme is set to
“optimize”. Passed to <code>scipy.optimize.minimize</code>. Refer to
SciPy documentation for available methods.</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>pd.DataFrame</strong></td>
<td></td>
<td><strong>A DataFrame containing the performance metrics for each
model and the combined forecast across all cross-validation splits.
Also, optimized weights are stored in <code>self.optimal_weights_</code>
if <code>weighting_scheme</code> is “optimize”.</strong></td>
</tr>
</tbody>
</table>
