.. role:: raw-html-m2r(raw)
:format: html
forecasts
====================================================================================================
개요
----------------------------------------------------------------------------------------------------
주어진 데이터의 미래 시점 데이터를 예측합니다.
타입
----------------------------------------------------------------------------------------------------
설명
----------------------------------------------------------------------------------------------------
input dataframe의 데이터를 선택한 알고리즘을 이용하여 미래 시점 데이터를 예측합니다. 이 때 예측하는 데이터의 기간은 변경 가능합니다.
예를 들어 데이터가 다음과 같이 존재합니다.
.. list-table::
:header-rows: 1
* - DATETIME_10M
- CNT
* - 2018-11-04 05:20:00
- 300
* - 2018-11-04 05:30:00
- 301
* - 2018-11-04 05:40:00
- 302
* - ...
- ...
* - 2018-11-04 11:30:00
- 900
* - 2018-11-04 11:40:00
- 901
* - 2018-11-04 11:50:00
- 902
forecasts 명령어를 수행하면 기존 dataframe 에 예측 결과를 합쳐서 보여줍니다.
.. list-table::
:header-rows: 1
* - DATETIME_10M
- CNT
- Forecasts
* - 2018-11-04 05:20:00
- 300
- false
* - 2018-11-04 05:30:00
- 301
- false
* - 2018-11-04 05:40:00
- 302
- false
* - ...
- ...
- ...
* - 2018-11-05 05:20:00
- 1000
- true
* - 2018-11-05 05:30:00
- 1001
- true
* - 2018-11-05 05:40:00
- 1002
- True
seasonal 알고리즘의 경우 예측 신뢰구간( lower / upper ) 도 함께 반환됩니다.
.. list-table::
:header-rows: 1
* - DATETIME_10M
- CNT
- lower CNT
- upper CNT
- Forecasts
* - 2018-11-04 05:20:00
- 300
- 0.0
- 0.0
- false
* - 2018-11-04 05:30:00
- 301
- 0.0
- 0.0
- false
* - 2018-11-04 05:40:00
- 302
- 0.0
- 0.0
- false
* - ...
- ...
- ...
- ...
- ...
* - 2018-11-05 05:40:00
- 1000.02
- 989.11
- 1021.22
- true
Parameters
----------------------------------------------------------------------------------------------------
Alg = linear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: none
... | forecasts index target [alg=linear] [f_coeff=0] [index_type=timestamp|date]
linear regression 으로 예측을 수행 합니다. 디폴트 알고리즘입니다.
.. list-table::
:header-rows: 1
* - 이름
- 설명
- 필수/옵션
* - index
- 시계열 데이터를 가진 필드
- 필수
* - target
- 예측하고자 하는 target 필드
- 필수
* - alg
- 시계열 데이터 예측에 사용되는 알고리즘. default 로 linear 알고리즘
- 옵션
* - f_coeff
- 예측값이 계산되어 결과로 나오는 기간을 구하는 데 사용되는 계수(1 이상의 정수값). default: 입력 데이터의 기간의 1/2 를 예측합니다. :raw-html-m2r:`
`\ 원하는 기간이 있다면 단위 기간의 개수를 입력합니다.\ :raw-html-m2r:`
`\ 예) f_coeff = 12 이고, 입력데이터 시간 단위가 1분이면 입력값의 시간 이후 +12분의 시간을 예측합니다.
- 옵션
* - index_type
- index 로 지정되는 시계열 데이터가 시간데이터가 포함된 것인지(timestamp), day 단위 데이터인지 (date) 구분을 하여 입력, default = timestamp
- 옵션
Alg = seasonal
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: none
... | forecasts index target alg=seasonal [f_coeff=10] [index_type=timestamp|date]
계절성과 시간적 변화에 따라 예측을 수행 합니다. 내부적으로 ARIMA 알고리즘이 적용되며, AIC 를 최소화 하는 order 를 구해서 모델링합니다.
.. list-table::
:header-rows: 1
* - 이름
- 설명
- 필수/옵션
* - index
- 시계열 데이터의 time 필드
- 필수
* - target
- 예측하고자 하는 target 필드
- 필수
* - alg
- 시계열 데이터 예측에 사용되는 알고리즘. default 로 linear 알고리즘
- 옵션
* - f_coeff
- 예측값이 계산되어 결과로 나오는 기간을 구하는 데 사용되는 계수(1 이상의 정수값). default: 입력 데이터의 기간의 1/2 를 예측합니다. :raw-html-m2r:`
`\ 원하는 기간이 있다면 단위 기간의 개수를 입력합니다.\ :raw-html-m2r:`
`\ 예) f_coeff = 12 이고, 입력데이터 시간 단위가 1분이면 입력값의 시간 이후 +12분의 시간을 예측합니다.
- 옵션
* - index_type
- index 로 지정되는 시계열 데이터가 시간데이터가 포함된 것인지(timestamp), day 단위 데이터인지 (date) 구분을 하여 입력, default = timestamp
- 옵션
**검색어 사용예시**
.. code-block:: none
## alg=linear ##
# 디폴트옵션 : forecasts INDEX TARGET alg=linear f_coeff=0 index_type=timestamp
... | forecasts DATETIME CNT
# forecasts INDEX TARGET alg=linear f_coeff=3 index_type=timestamp
... | forecasts DATETIME CNT f_coeff=3 index_type=timestamp
# forecasts INDEX TARGET alg=linear f_coeff=3 index_type=date
... | forecasts YYYYMMDD CNT f_coeff=7 index_type=date
## alg=seasonal ##
# forecasts INDEX TARGET alg=seasonal f_coeff=0 index_type=timestamp
... | forecasts DATETIME CNT alg=seasonal
# forecasts INDEX TARGET alg=seasonal f_coeff=3 index_type=timestamp
... | forecasts DATETIME CNT alg=seasonal f_coeff=3 index_type=timestamp
# forecasts INDEX TARGET alg=seasonal f_coeff=3 index_type=date
... | forecasts YYYYMMDD CNT alg=seasonal f_coeff=7 index_type=date
Example
----------------------------------------------------------------------------------------------------
- 예제 데이터
.. list-table::
:header-rows: 1
* - DATETIME
- HOST
- CNT
* - 20200910144000
- gcs1
- 917
* - 20200910152000
- gcs1
- 909
* - 20200910121000
- gcs1
- 923
* - 20200910142000
- gcs1
- 920
* - 20200910140000
- gcs1
- 944
* - 20200910124000
- gcs1
- 920
* - 20200910141000
- gcs1
- 917
* - 20200910155000
- gcs1
- 909
* - 20200910125000
- gcs1
- 920
* - 20200910132000
- gcs1
- 915
* - 20200910154000
- gcs1
- 925
* - 20200910122000
- gcs1
- 917
* - 20200910120000
- gcs1
- 813
* - 20200910145000
- gcs1
- 933
* - 20200910143000
- gcs1
- 912
* - 20200910153000
- gcs1
- 923
* - 20200910150000
- gcs1
- 942
* - 20200910131000
- gcs1
- 917
* - 20200910130000
- gcs1
- 936
* - 20200910123000
- gcs1
- 909
* - 20200910134000
- gcs1
- 917
* - 20200910151000
- gcs1
- 917
* - 20200910133000
- gcs1
- 917
* - 20200910135000
- gcs1
- 923
- linear(선형회귀) 알고리즘을 이용하여 데이터 예측
.. code-block:: none
* | forecasts DATETIME CNT alg=linear
.. list-table::
:header-rows: 1
* - DATETIME
- CNT
- forecasts
* - 2020-09-10 12:00:00
- 813.0
- False
* - 2020-09-10 12:10:00
- 923.0
- False
* - 2020-09-10 12:20:00
- 917.0
- False
* - 2020-09-10 12:30:00
- 909.0
- False
* - 2020-09-10 12:40:00
- 920.0
- False
* - 2020-09-10 12:50:00
- 920.0
- False
* - 2020-09-10 13:00:00
- 936.0
- False
* - 2020-09-10 13:10:00
- 917.0
- False
* - 2020-09-10 13:20:00
- 915.0
- False
* - 2020-09-10 13:30:00
- 917.0
- False
* - 2020-09-10 13:40:00
- 917.0
- False
* - 2020-09-10 13:50:00
- 923.0
- False
* - 2020-09-10 14:00:00
- 944.0
- False
* - 2020-09-10 14:10:00
- 917.0
- False
* - 2020-09-10 14:20:00
- 920.0
- False
* - 2020-09-10 14:30:00
- 912.0
- False
* - 2020-09-10 14:40:00
- 917.0
- False
* - 2020-09-10 14:50:00
- 933.0
- False
* - 2020-09-10 15:00:00
- 942.0
- False
* - 2020-09-10 15:10:00
- 917.0
- False
* - 2020-09-10 15:20:00
- 909.0
- False
* - 2020-09-10 15:30:00
- 923.0
- False
* - 2020-09-10 15:40:00
- 925.0
- False
* - 2020-09-10 15:50:00
- 909.0
- False
* - 2020-09-10 16:00:00
- 930.46
- True
* - 2020-09-10 16:10:00
- 931.58
- True
* - 2020-09-10 16:20:00
- 932.7
- True
* - 2020-09-10 16:30:00
- 933.82
- True
* - 2020-09-10 16:40:00
- 934.94
- True
* - 2020-09-10 16:50:00
- 936.06
- True
* - 2020-09-10 17:00:00
- 937.18
- True
* - 2020-09-10 17:10:00
- 938.3
- True
* - 2020-09-10 17:20:00
- 939.42
- True
* - 2020-09-10 17:30:00
- 940.54
- True
* - 2020-09-10 17:40:00
- 941.66
- True
* - 2020-09-10 17:50:00
- 942.78
- True
- seasonal(ARIMA) 알고리즘을 이용하여 데이터 예측
.. code-block:: none
* | forecasts DATETIME CNT alg=seasonal
.. list-table::
:header-rows: 1
* - DATETIME
- CNT
- lower CNT
- upper CNT
- forecasts
* - 2020-09-10 12:00:00
- 813.0
- 0.0
- 0.0
- False
* - 2020-09-10 12:10:00
- 923.0
- 0.0
- 0.0
- False
* - 2020-09-10 12:20:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 12:30:00
- 909.0
- 0.0
- 0.0
- False
* - 2020-09-10 12:40:00
- 920.0
- 0.0
- 0.0
- False
* - 2020-09-10 12:50:00
- 920.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:00:00
- 936.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:10:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:20:00
- 915.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:30:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:40:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 13:50:00
- 923.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:00:00
- 944.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:10:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:20:00
- 920.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:30:00
- 912.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:40:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 14:50:00
- 933.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:00:00
- 942.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:10:00
- 917.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:20:00
- 909.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:30:00
- 923.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:40:00
- 925.0
- 0.0
- 0.0
- False
* - 2020-09-10 15:50:00
- 909.0
- 0.0
- 0.0
- False
* - 2020-09-10 16:00:00
- 930.15
- 885.73
- 974.56
- True
* - 2020-09-10 16:10:00
- 932.95
- 888.39
- 977.51
- True
* - 2020-09-10 16:20:00
- 934.27
- 889.71
- 978.83
- True
* - 2020-09-10 16:30:00
- 935.47
- 890.91
- 980.03
- True
* - 2020-09-10 16:40:00
- 936.66
- 892.1
- 981.23
- True
* - 2020-09-10 16:50:00
- 937.86
- 893.29
- 982.42
- True
* - 2020-09-10 17:00:00
- 939.05
- 894.48
- 983.61
- True
* - 2020-09-10 17:10:00
- 940.24
- 895.67
- 984.8
- True
* - 2020-09-10 17:20:00
- 941.43
- 896.87
- 985.99
- True
* - 2020-09-10 17:30:00
- 942.62
- 898.06
- 987.18
- True
* - 2020-09-10 17:40:00
- 943.81
- 899.25
- 988.37
- True
* - 2020-09-10 17:50:00
- 945.0
- 900.44
- 989.56
- True
**현재 시계열 컬럼의 시간 간격의 정도가 고려되지 않기 때문에, 소스데이터를 일정한 시간간격으로 그룹핑하여 전처리 한다.**