用法:
class cuml.ExponentialSmoothing(endog, *, seasonal='additive', seasonal_periods=2, start_periods=2, ts_num=1, eps=0.00224, handle=None, verbose=False, output_type=None)
實施HoltWinters時間序列分析模型,用於預測時間序列中的未來條目以及提供 index 平滑,其中權重分配給曆史數據,影響呈 index 下降。這是通過分析數據的三個組成部分來完成的:水平、趨勢和季節性。
- endog:array-like(設備或主機)
可接受的格式:cuDF DataFrame cuDF 係列、NumPy ndarray、Numba 設備 ndarray、cuda 數組接口兼容數組,如 CuPy 注意:cuDF DataFrame 類型假定數據在列中,而所有其他數據類型假定數據在行中.要操作的內生數據集。
- seasonal:‘additive’, ‘add’, ‘multiplicative’, ‘mul’(默認 = ‘additive’)
季節性趨勢是應該加法還是乘法計算。
- seasonal_periods:int(默認值=2)
數據的季節性(重複頻率)。對於每月數據,這應該是 12,對於每周數據,這應該是 7。
- start_periods:int(默認值=2)
用於季節性種子值的季節數
- ts_num:int(默認值=1)
在 endog 參數中傳遞的不同時間序列的數量。
- eps:np.number > 0(默認=2.24e-3)
梯度下降應該達到的準確度。請注意,更改此值可能會影響預測結果。
- handle:cuml.Handle
指定 cuml.handle 保存用於此模型中計算的內部 CUDA 狀態。最重要的是,這指定了將用於模型計算的 CUDA 流,因此用戶可以通過在多個流中創建句柄在不同的流中同時運行不同的模型。如果為 None,則創建一個新的。
- verbose:int 或布爾值,默認=False
設置日誌記錄級別。它必須是
cuml.common.logger.level_*
之一。有關詳細信息,請參閱詳細級別。- output_type:{‘input’, ‘cudf’, ‘cupy’, ‘numpy’, ‘numba’},默認=無
用於控製估計器的結果和屬性的輸出類型的變量。如果為 None,它將繼承在模塊級別設置的輸出類型
cuml.global_settings.output_type
。有關詳細信息,請參閱輸出數據類型配置。
參數:
注意:
Known Limitations:
與statsmodels.holtwinters.ExponentialSmoothing
模型相比,此版本的ExponentialSmoothing 目前僅提供有限數量的函數。值得注意的是,它缺少:- 預測不支持in-sample 預測。
- 黑森州不支持返回 Hessian 矩陣。
- 信息不支持返回 Fisher 矩陣。
- 類似日誌的不支持返回Log-likelihood。
此外,請注意,此模型中可能存在浮點不穩定問題。 endog 中的小值可能會導致錯誤的結果。有關詳細信息,請參閱https://github.com/rapidsai/cuml/issues/888。
Known Differences:
此版本的ExponentialSmoothing 在其他一些小方麵與 statsmodel 不同:- 不能通過趨勢分量或阻尼趨勢分量
- 此版本可以采用附加參數
eps
、start_periods
、ts_num
和handle
- 分數返回 SSE 而不是梯度 logL https://github.com/rapidsai/cuml/issues/876
- 此版本提供get_level()、get_trend()、get_season()
例子:
from cuml import ExponentialSmoothing import cudf import numpy as np data = cudf.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], dtype=np.float64) cu_hw = ExponentialSmoothing(data, seasonal_periods=12) cu_hw.fit() cu_pred = cu_hw.forecast(4) print('Forecasted points:', cu_pred)
輸出:
Forecasted points : 0 4.000143766093652 1 5.000000163513641 2 6.000000000174092 3 7.000000000000178
- SSE:
- forecasted_points:
- level:
- season:
- trend:
屬性:
相關用法
- Python cuml.ElasticNet用法及代碼示例
- Python cuml.metrics.pairwise_distances.pairwise_distances用法及代碼示例
- Python cuml.neighbors.KNeighborsClassifier用法及代碼示例
- Python cuml.ensemble.RandomForestRegressor用法及代碼示例
- Python cuml.svm.SVC用法及代碼示例
- Python cuml.svm.SVR用法及代碼示例
- Python cuml.Lasso用法及代碼示例
- Python cuml.tsa.ARIMA.predict用法及代碼示例
- Python cuml.multiclass.OneVsRestClassifier用法及代碼示例
- Python cuml.preprocessing.LabelBinarizer用法及代碼示例
- Python cuml.random_projection.GaussianRandomProjection用法及代碼示例
- Python cuml.MBSGDRegressor用法及代碼示例
- Python cuml.experimental.preprocessing.PolynomialFeatures用法及代碼示例
- Python cuml.PCA用法及代碼示例
- Python cuml.feature_extraction.text.HashingVectorizer用法及代碼示例
- Python cuml.DBSCAN用法及代碼示例
- Python cuml.dask.feature_extraction.text.TfidfTransformer用法及代碼示例
- Python cuml.TruncatedSVD用法及代碼示例
- Python cuml.common.memory_utils.using_output_type用法及代碼示例
- Python cuml.preprocessing.text.stem.PorterStemmer用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cuml.ExponentialSmoothing。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。