torcharrow.functional¶
Velox 核心功能¶
Velox核心函数包含在torcharrow.functional中。
以下是Velox字符串函数lpad的示例用法:
>>> import torcharrow as ta
>>> from torcharrow import functional
>>> col = ta.column(["abc", "x", "yz"])
# Velox's lpad function: https://facebookincubator.github.io/velox/functions/string.html#lpad
>>> functional.lpad(col, 5, "123")
0 '12abc'
1 '1231x'
2 '123yz'
dtype: String(nullable=True), length: 3, null_count: 0, device: cpu
这是Velox数组函数array_except的另一个使用示例:
>>> col1 = ta.column([[1, 2, 3], [1, 2, 3], [1, 2, 2], [1, 2, 2]])
>>> col2 = ta.column([[4, 5, 6], [1, 2], [1, 1, 2], [1, 3, 4]])
# Velox's array_except function: https://facebookincubator.github.io/velox/functions/array.html#array_except
>>> functional.array_except(col1, col2)
0 [1, 2, 3]
1 [3]
2 []
3 [2]
dtype: List(Int64(nullable=True), nullable=True), length: 4, null_count: 0
文本操作¶
将一系列标记/索引附加或前置到列中。 |
推荐操作¶
对输入特征应用分桶处理。 |
|
对索引或索引列表应用哈希。 |
|
返回输入列前x个值 |
|
如果两个输入列重叠,则返回1.0,否则返回0.0 |
|
返回两个ID列表之间的重叠次数 |
|
如果input_ids和matching_ids之间存在重叠项,则将重叠id的最大实例数贡献给最大计数。 |
|
返回input_ids和matching_ids之间的jaccard_similarity。 |
|
返回由input_ids加权定义的向量与由matching_ids加权定义的向量之间的余弦值 |
|
返回在matching_id_scores中所有分数的总和,这些分数对应的id在matching_ids中,并且也在input_ids中。 |
|
返回在matching_id_scores中所有分数的最小值,这些分数对应的id在matching_ids中,并且也在input_ids中。 |
|
返回在matching_id_scores中所有分数的最小值,这些分数对应的id在matching_ids中,并且也在input_ids中。 |
高级操作¶
返回缩放到范围 [0,1] 的列数据。 |