杰瑞发布于2025-10-15
- densify(x):
This operator converts a grouping field with many buckets into a lesser number of only the available buckets, making working with grouping fields computationally efficient. The example below will clarify the implementation. Example: Say a grouping field is provided as an integer (e.g., industry: tech -> 0, airspace -> 1, ...) and for a certain date, we have instruments with grouping field values among {0, 1, 2, 99}. Instead of creating 100 buckets and keeping 96 of them empty, it is better to just create 4 buckets with values {0, 1, 2, 3}. So, if the number of unique values in x is n, densify maps those values between 0 and (n-1). The order of magnitude need not be preserved.此运算符将具有许多桶的分组字段转换为只有较少数量的可用桶,从而提高了分组字段的计算效率。下面的例子将阐明实施。示例:假设分组字段以整数形式提供(例如,行业:技术->0,空域->1,…),对于某个日期,我们有分组字段值在{0,1,2,99}之间的仪器。与其创建100个桶并保持其中96个为空,不如只创建4个值为{0,1,2,3}的桶。因此,如果x中唯一值的数量为n,则将这些值映射到0和(n-1)之间。数量级不需要保留。- signed_power(x, y):
x raised to the power of y such that final result preserves sign of x; sign(x) * (abs(x) ^ y) x raised to the power of y such that final result preserves sign of x. For power of 2, x ^ y will be a parabola but signed_power(x, y) will be odd and one-to-one function (unique value of x for certain value of signed_power(x, y)) unlike parabola. Example: If x = 3, y = 2 ⇒ abs(x) = 3 ⇒ abs(x) ^ y = 9 and sign(x) = +1 ⇒ sign(x) * (abs(x) ^ y) = signed_power(x, y) = 9; If x = -9, y = 0.5 ⇒ abs(x) = 9 ⇒ abs(x) ^ y = 3 and sign(x) = -1 ⇒ sign(x) * (abs(x) ^ y) = signed_power(x, y)