foundryts.functions.exponential_regression(foundryts.functions.exponential_regression(指数回归))¶
foundryts.functions.exponential_regression(include_multiple=True, time_unit='ns', start=None, end=None)¶
Returns a function that performs exponential regression on a single time series.
Exponential regression finds the parameters of the best-fit exponential curve over points of the input time series.
The regression is expressed as y = Ae^(Bx), where A is the initial value and B is the growth rate.
The returned function will provide the parameters A and B.
Exponential regression is particularly useful when the data exhibits exponential growth or decay patterns.
- Parameters:
- include_multiple (bool , optional) – Whether to include multiple regressions (default is True).
- time_unit (str , optional) – The time unit of the coefficients, must be one of “s”, “ms”, “us”, “ns” (default is “ns”).
- start (str | int | datetime.datetime , optional) – Starting point (inclusive) of the time series for computing the exponential regression.
- end (str | int | datetime.datetime , optional) – End point (exclusive) of the time series for computing the exponential regression.
- Returns: A function that accepts a single time series and provides parameters for the best-fit exponential curve for the time series.
- Return type:
(
FunctionNode) ->SummarizerNode
Dataframe schema¶
| Column name | Type | Description |
|---|---|---|
| max_bounds.first_value | float | Maximum value of the initial value (A) in y=Ae^(Bx). |
| max_bounds.second_value | float | Maximum value of the growth rate (B) in y=Ae^(Bx). |
| min_bounds.first_value | float | Minimum value of the initial value (A) in y=Ae^(Bx). |
| min_bounds.second_value | float | Minimum value of the growth rate (B) in y=Ae^(Bx). |
| regression_fit_function. exponential_regression_fit. aparameter |
float | Estimated parameter ‘A’ (initial value) of the exponential regression fit in y=Ae^(Bx). |
| regression_fit_function. exponential_regression_fit. bparameter |
float | Estimated parameter ‘B’ (growth rate) of the exponential regression fit in y=Ae^(Bx). |
:::callout{theme="success" title="See Also"}
linear_regression(), polynomial_regression()
:::
:::callout{theme="warning" title="Note"} This function is only applicable to numeric series. :::
Examples¶
>>> series = F.points(
... (10, 6.0), (20, 12.0), (30, 24.0), (40, 48.0), (50, 96.0), name="series"
... )
>>> series.to_pandas()
timestamp value
0 1970-01-01 00:00:00.000000010 6.0
1 1970-01-01 00:00:00.000000020 12.0
2 1970-01-01 00:00:00.000000030 24.0
3 1970-01-01 00:00:00.000000040 48.0
4 1970-01-01 00:00:00.000000050 96.0
>>> exponential_regr = F.exponential_regression()(series)
>>> exponential_regr.to_pandas()
max_bounds.first_value max_bounds.second_value min_bounds.first_value min_bounds.second_value regression_fit_function.exponential_regression_fit.aparameter regression_fit_function.exponential_regression_fit.bparameter
0 50.0 96.0 10.0 6.0 3.0 0.069315
中文翻译¶
foundryts.functions.exponential_regression(指数回归)¶
foundryts.functions.exponential_regression(include_multiple=True, time_unit='ns', start=None, end=None)¶
返回一个对单条时间序列执行指数回归的函数。
指数回归用于在输入时间序列的数据点上寻找最佳拟合指数曲线的参数。
回归表达式为 y = Ae^(Bx),其中 A 是初始值,B 是增长率。
返回的函数将提供参数 A 和 B。
当数据呈现指数增长或衰减模式时,指数回归尤为实用。
- 参数说明:
- include_multiple(bool , 可选)– 是否包含多重回归(默认值为 True)。
- time_unit(str , 可选)– 系数的时间单位,必须为 "s"、"ms"、"us"、"ns" 之一(默认值为 "ns")。
- start(str | int | datetime.datetime , 可选)– 用于计算指数回归的时间序列起始点(包含)。
- end(str | int | datetime.datetime , 可选)– 用于计算指数回归的时间序列结束点(不包含)。
- 返回值: 一个接受单条时间序列并返回该时间序列最佳拟合指数曲线参数的函数。
- 返回类型:
(
FunctionNode) ->SummarizerNode
数据框模式(Dataframe schema)¶
| 列名 | 类型 | 描述 |
|---|---|---|
| max_bounds.first_value | float | y=Ae^(Bx) 中初始值 (A) 的最大值。 |
| max_bounds.second_value | float | y=Ae^(Bx) 中增长率 (B) 的最大值。 |
| min_bounds.first_value | float | y=Ae^(Bx) 中初始值 (A) 的最小值。 |
| min_bounds.second_value | float | y=Ae^(Bx) 中增长率 (B) 的最小值。 |
| regression_fit_function. exponential_regression_fit. aparameter |
float | y=Ae^(Bx) 中指数回归拟合的估计参数 'A'(初始值)。 |
| regression_fit_function. exponential_regression_fit. bparameter |
float | y=Ae^(Bx) 中指数回归拟合的估计参数 'B'(增长率)。 |
:::callout{theme="success" title="另请参阅"}
linear_regression()(线性回归),polynomial_regression()(多项式回归)
:::
:::callout{theme="warning" title="注意"} 此函数仅适用于数值型序列。 :::
示例¶
>>> series = F.points(
... (10, 6.0), (20, 12.0), (30, 24.0), (40, 48.0), (50, 96.0), name="series"
... )
>>> series.to_pandas()
timestamp value
0 1970-01-01 00:00:00.000000010 6.0
1 1970-01-01 00:00:00.000000020 12.0
2 1970-01-01 00:00:00.000000030 24.0
3 1970-01-01 00:00:00.000000040 48.0
4 1970-01-01 00:00:00.000000050 96.0
>>> exponential_regr = F.exponential_regression()(series)
>>> exponential_regr.to_pandas()
max_bounds.first_value max_bounds.second_value min_bounds.first_value min_bounds.second_value regression_fit_function.exponential_regression_fit.aparameter regression_fit_function.exponential_regression_fit.bparameter
0 50.0 96.0 10.0 6.0 3.0 0.069315