Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

cumulative_aggregate: 현재 관측까지 누적 집계

foundryts.functions.cumulative_aggregate(aggregate)는 숫자형 시계열 하나의 각 관측에서 처음부터 현재 점까지 포함하여 집계하는 함수를 반환합니다. 입력과 출력은 FunctionNode입니다.

집계 종류

aggregate에는 다음 String 값 또는 time_weighted가 반환한 명세를 전달합니다.

aggregate계산
min현재 점까지의 최솟값
max현재 점까지의 최댓값
count현재 점을 포함한 관측 수
sum현재 점까지의 값 합
product현재 점까지의 값 곱
mean현재 점까지 관측값들의 평균
standard_deviation현재 점까지 관측값들의 표준편차
difference현재 값에서 첫 값을 뺀 차이
percent_change첫 값을 기준으로 현재 값의 변화 비율
first첫 관측값
last현재 관측값
time_weighted("average")값이 유지되는 시간을 반영한 누적 평균
time_weighted("integral")현재 시각까지 곡선 아래 넓이

마지막 두 항목은 문자열 이름 대신 time_weighted의 반환값을 사용합니다. 예를 들어 F.cumulative_aggregate(F.time_weighted("average"))로 구성합니다. 범주형 시계열에는 이 집계 함수를 적용하지 않습니다.

가상 관측의 누적 평균

import foundryts.functions as F

series = F.points(
    (2, 10.0),
    (5, 20.0),
    (6, 30.0),
    (7, 40.0),
    (8, 50.0),
    (12, 60.0),
    name="series-1",
)
cumulative_mean = F.cumulative_aggregate("mean")(series)
mean_df = cumulative_mean.to_pandas()

정수 시각은 나노초입니다. mean은 관측 하나마다 같은 가중치를 주므로 불규칙한 관측 간격과 관계없이 다음 값을 만듭니다.

timestamp현재 입력 값출력 value
1970-01-01 00:00:00.00000000210.010.0
1970-01-01 00:00:00.00000000520.015.0
1970-01-01 00:00:00.00000000630.020.0
1970-01-01 00:00:00.00000000740.025.0
1970-01-01 00:00:00.00000000850.030.0
1970-01-01 00:00:00.00000001260.035.0

출력은 timestamp와 value 열을 가진 시계열입니다. 공통 시계열 스키마는 timestamp를 pandas.Timestamp, value를 float 또는 str로 표현하며 이 집계는 숫자형 입력에 사용합니다.

최근 시간 구간만 집계하려면 rolling_aggregate, 겹치지 않는 일정 구간별로 집계하려면 periodic_aggregate를 사용합니다.