UnifiedTimeSeries¶
- class hana_ml.algorithms.pal.unified_timeseries.UnifiedTimeSeries(func, **kwargs)¶
The Python wrapper for SAP HANA PAL Unified Time Series function. The Unified Time Series algorithms include:
Additive Model Time Series Analysis (AMTSA)
Auto Regressive Integrated Moving Average (ARIMA)
Bayesian Structural Time Series (BSTS)
Exponential Smoothing (SMOOTH)
- Parameters
- funcstr
The name of a specified time series algorithm.
The following algorithms are supported:
'AMTSA': Additive Model Time Series Analysis
'ARIMA': Auto Regressive Integrated Moving Average
'BSTS': Bayesian Structural Time Series
'SMOOTH': Auto Exponential Smoothing
- **kwargskeyword arguments
Arbitrary keyword arguments and please referred to the responding algorithm for the parameters' key-value pair.
'AMTSA' :
AdditiveModelTimeSeriesAnalysisAMTSA in UnifiedTimeSeries has some additional parameters, please see the following section.target_type : str, optional, specify the type when converting the INT type of key column to other types.
start_point : str, optional, specify a start point in type conversion.
interval : int, optional, specify an interval in type conversion.
holiday : str, optional, add holiday to model in a json format, including name, timestamp, (optional) lower_window, and (optional) upper_window elements. For example: '{ "name": "New Year", "timestamp": "2025-01-01" }'.
'ARIMA' :
AutoARIMA'BSTS' :
TripleExponentialSmoothing'SMOOTH' :
AutoExponentialSmoothing
For more parameter mappings of hana_ml and HANA PAL, please refer to the doc page: Parameter Mappings
- Attributes
- model_DataFrame
Model information.
- statistics_DataFrame
Statistics.
- decompose_DataFrame
Decomposition values.
Methods
fit(data[, key, endog, exog])Fit function.
make_future_dataframe([data, key, periods, ...])Create a new dataframe for time series prediction.
predict(data[, key, exog])Predict function.
Examples
>>> uts = UnifiedTimeSeries(func='AMTSA')
Perform fit_predict():
>>> uts.fit_predict(data=df)
Output:
>>> uts.model_.collect() >>> uts.statistics_.collect() >>> uts.decompose_.collect()
- fit(data, key=None, endog=None, exog=None)¶
Fit function.
- Parameters
- dataDataFrame
Training data.
- keystr, optional
Name of ID column.
Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.
- endogstr, optional
The column of series to be fitted and predicted.
Defaults to the first non-ID column.
- exogstr or list of str, optional
The column(s) of exogenous variables to be used in the model.
Defaults to all non-ID, non-endog columns if not provided.
- make_future_dataframe(data=None, key=None, periods=1, increment_type='seconds')¶
Create a new dataframe for time series prediction.
- Parameters
- dataDataFrame, optional
The training data contains the index.
Defaults to the data used in the fit().
- keystr, optional
The index defined in the training data.
Defaults to the specified key in fit function or the data.index or the first column of the data.
- periodsint, optional
The number of rows created in the predict dataframe.
Defaults to 1.
- increment_type{'seconds', 'days', 'months', 'years'}, optional
The increment type of the time series.
Defaults to 'seconds'.
- Returns
- DataFrame
- predict(data, key=None, exog=None, **kwargs)¶
Predict function.
- Parameters
- dataDataFrame
Data for prediction.
- keystr, optional
Name of ID column.
Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.
- exogstr or list of str, optional
The column(s) of exogenous variables to be used in the model.
Defaults to all non-ID columns if not provided.
- **kwargskeyword arguments
Arbitrary keyword arguments and please referred to the responding algorithm for the parameters' key-value pair.
- Returns
- DataFrame 1
DataFrame containing the forecast values and other related statistics(like standard error estimation, upper/lower quantiles).
- DataFrame 2
DataFrame containing the trend/seasonal/regression components w.r.t. the forecast values.