捷徑

torcharrow.functional.bucketize

torcharrow.functional.bucketize(value_col: NumericalColumn, borders: Union[ListColumn, List[Union[int, float]]]) NumericalColumn

對輸入特徵應用桶化。這是推薦領域中常見的操作,用於將密集特徵轉換為稀疏特徵。

參數:
  • value_col (定義密集特徵的數值欄位) –

  • borders (離散化稀疏特徵的邊界值) –

範例

>>> import torcharrow as ta
>>> from torcharrow import functional
>>> a = ta.column([1, 2, 3, 5, 8, 10, 11])
>>> functional.bucketize(a, [2, 5, 10])
0  0
1  0
2  1
3  1
4  2
5  2
6  3
dtype: Int32(nullable=True), length: 7, null_count: 0

文件

取得 PyTorch 完整的開發者文件

查看文件

教學

取得適用於初學者和進階開發者的深入教學課程

查看教學課程

資源

尋找開發資源並取得問題解答

查看資源