torcharrow.functional¶
速腾核心功能¶
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列表之间的重叠数量 |
|
如果有输入ID和匹配ID之间有重叠的部分,那么将重叠的ID实例数量贡献到最大计数中。 |
|
返回输入ID和匹配ID之间的jaccard相似度。 |
|
返回由输入ID加权的向量与匹配ID加权的向量之间的余弦值。 |
|
返回匹配_id_scores中所有匹配_id的总和,其中匹配_id在input_ids中也有对应的id。 |
|
返回匹配_id_scores 中所有匹配_id 的最小值,其中匹配_id 在 input_ids 中也有对应的 id。 |
|
返回匹配_id_scores 中所有匹配_id 的最小值,其中匹配_id 在 input_ids 中也有对应的 id。 |
高级操作¶
将列数据缩放到范围 [0,1]。 |