Shortcuts

torcharrow.functional.bucketize

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

Apply bucketization for input feature. This is a common operation in recommendation domain to convert dense features into sparse features.

Parameters:
  • value_col (Numeric column that defines dense feature) –

  • borders (Border values for the discretized sparse features) –

Examples

>>> 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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources