Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
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。
Args |
n_times
|
時間點的數值。
|
knot_locations
|
0, 1, 2,..., (n_times-1) 內的節數位置。 |
傳回 |
權重陣列,其維度為 (n_knots, n_times) ,當加總節點時,每個時間範圍的值加總為 1。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-06 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-11-06 (世界標準時間)。"],[],["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,[]]