Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.model.transformers.CenteringAndScalingTransformer
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將中心化和縮放轉換套用至張量。
沿用自:TensorTransformer
meridian.model.transformers.CenteringAndScalingTransformer(
tensor: tf.Tensor,
population: tf.Tensor,
population_scaling_id: (tf.Tensor | None) = None
)
這個類別會轉換張量,讓每個變數的平均值為零,標準差為一。您可以選擇在套用居中和縮放轉換作業前,先根據填入值來縮放每個變數。這個類別會儲存每個變數的平均值和標準差。
Args |
tensor
|
用來計算平均值和標準差的維度 (n_geos, n_times, n_channel) (張量)。 |
population
|
維度為 (n_geos,) 的張量,其中包含每個地理區域的人口,用於計算比例因數。 |
population_scaling_id
|
可選的布林值張量,其維度為 (n_channels,) ,指出要根據人數調整值的變數。 |
方法
forward
查看原始碼
forward(
tensor: tf.Tensor
) -> tf.Tensor
使用儲存的係數縮放指定的張量。
inverse
查看原始碼
inverse(
tensor: tf.Tensor
) -> tf.Tensor
使用儲存的係數縮減指定張量。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-14 (世界標準時間)。
[[["容易理解","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-14 (世界標準時間)。"],[],["This content describes a `CenteringAndScalingTransformer` class that transforms a tensor by centering (mean zero) and scaling (standard deviation one) its variables. It takes a tensor, population data, and an optional population scaling ID as input. The class stores the mean and standard deviation. It has two main methods: `forward`, which applies the scaling to a tensor, and `inverse`, which reverses the scaling using the stored coefficients. The transformations can be applied channel-wise with the `population_scaling_id`.\n"],null,[]]