pownet.stochastic package
Submodules
pownet.stochastic.demand module
demand.py: Model for solar time series data
pownet.stochastic.kirsch_nowak module
kirsch_nowak.py
- pownet.stochastic.kirsch_nowak.KNN_identification(Z, Qtotals, month, k=None)[source]
Identifies K-nearest neighbors of Z in the historical annual data and computes the associated weights W.
- Parameters:
Z – Synthetic datum (scalar)
Qtotals – Total monthly flows at all sites for all historical months within +/- 7 days of the month being disaggregated
month – Month being disaggregated
k – Number of nearest neighbors (by default k=n_year^0.5 according to Lall and Sharma (1996))
- Returns:
- Indices of the first K-nearest neighbors of Z in the
historical annual data z
- W: Nearest neighbors weights, according to Lall and Sharma (1996):
W(i) = (1/i) / (sum(1/i))
- Return type:
KNN_id
pownet.stochastic.solar module
solar.py: Model for solar time series data
pownet.stochastic.timeseries_model module
timeseries_model.py: Abstract class for time series models.
- class pownet.stochastic.timeseries_model.TimeSeriesModel[source]
Bases:
ABC- find_best_model(target_column, exog_vars=None, month_to_use=1, seed=None, suppress_warnings=False)[source]
Find the best model for the time series data
- Parameters:
target_column (str) – Target column to fit the model
exog_vars (list[str], optional) – List of exogenous variables. Defaults to None.
month_to_use (int, optional) – Month to use for finding the best model. Defaults to 1.
seed (int, optional) – Random seed. Defaults to 112.
suppress_warnings (bool, optional) – Suppress warnings. Defaults to False.
- Returns:
Best model SARIMA parameters
- Return type:
tuple[tuple[int, int, int], tuple[int, int, int, int]]
- Raises:
ValueError – If data is not loaded
- fit(target_column, arima_order, seasonal_order=None, exog_vars=None)[source]
Fit the model to the data
- Parameters:
target_column (str) – Target column to fit the model
arima_order (tuple[int, int, int]) – ARIMA order
seasonal_order (tuple[int, int, int, int]) – Seasonal order
exog_vars (list[str], optional) – List of exogenous variables. Defaults to None.
- Return type:
None
- get_synthetic(exog_data=None, seed=None)[source]
Create synthetic time series.
- Parameters:
exog_data (pd.DataFrame, optional) – Exogenous variables. Defaults to None.
seed (int, optional) – Random seed. Defaults to None.
- Returns:
Synthetic time series data.
- Return type:
pd.Series
- Raises:
ValueError – If the model is not fitted.
ValueError – If exogenous variables are not in the data.
ValueError – If exogenous data index is not equal to the time series data index.
- abstract property monthly_models: dict
- abstract property pred_residuals: pandas.Series
- abstract property predictions: pandas.Series
pownet.stochastic.timeseries_utils module
timeseries_utils.py: Utility functions for timeseries data
- pownet.stochastic.timeseries_utils.inverse_yeojohnson(y_pred, B1_y, initial_value, power_transformer)[source]
Invert the Yeo-Johnson transformation
- Return type:
Series
Module contents
stochastic module.