加入新推出的
Discord 社区,展开实时讨论,获得同行支持,并直接与 Meridian 团队互动!
meridian.model.knots.l1_distance_weights
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
计算每个时间段在结处的权重。
meridian.model.knots.l1_distance_weights(
n_times: int, knot_locations: np.ndarray[int, np.dtype[int]]
) -> np.ndarray
相邻的两个结会影响特定时间段的权重估计值。两个相邻结对时间段的影响程度取决于它们与时间段的距离(L1 距离)。如果某个时间点与某个结位置一致,则该结的权重为 100%。如果时间点位于结范围之外,则最近的端点结将获得 100% 的权重。
此函数计算用于对趋势和季节性进行建模的 (n_knots, n_times)
权重数组。对于给定时间,该数组包含两个非零权重。权重与从给定时间点到相邻结的 L1 距离成反比。这两个权重经过归一化处理后,其总和为 1。
实参 |
n_times
|
时间点的数量。 |
knot_locations
|
结的位置,范围为 0, 1, 2,..., (n_times-1) 。
|
返回结果 |
一个权重数组,维度为 (n_knots, n_times) ,当对结求和时,每个时间段的权重总和为 1。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-25。
[null,null,["最后更新时间 (UTC):2025-01-25。"],[],["The `l1_distance_weights` function calculates weights for each time period based on neighboring knots. It outputs a `(n_knots, n_times)` array, where each time period's weight is influenced by the two closest knots. Weights are inversely proportional to the L1 distance from the time period to the knots and normalized to sum to 1. If a time point is at a knot, that knot gets 100% weight; outside the knot range, the nearest endpoint knot gets 100%.\n"],null,[]]