torcharrow.functional.sigrid_hash¶
- torcharrow.functional.sigrid_hash(value_col: NumericalColumn, salt: int, max_value: int)¶
將雜湊函數應用於索引或索引列表。這是推薦系統領域中常見的操作,以便為縮減的嵌入表提供有效的輸入。
- 參數:
value_col (定義索引的數值欄位) –
salt (用於初始化隨機雜湊過程的值) –
max_value (值將在 [0, max_value) 範圍內雜湊) –
範例
>>> import torcharrow as ta >>> from torcharrow import functional >>> a = ta.column([1, 2, 3, 5, 8, 10, 11]) >>> functional.sigrid_hash(a, 0, 100) 0 60 1 54 2 54 3 4 4 67 5 2 6 25 dtype: Int64(nullable=True), length: 7, null_count: 0