towhee.hub.builtin.operators.feature_engineer.cate_one_hot_encoder¶
- class towhee.hub.builtin.operators.feature_engineer.cate_one_hot_encoder(name: Optional[str] = None)[source]¶
Bases:
StatefulOperator
Standardize numerical features by removing the mean and scaling to unit variance.
Examples:
>>> from towhee import DataCollection, Entity >>> dc = ( ... DataCollection(['a','b','c','a','b']).map(lambda x: Entity(a=x)) ... .set_training() ... .cate_one_hot_encoder['a', 'b'](name='one_hot_encoder') ... )
>>> [x.b.nonzero()[1][0] for x in dc.to_list()] [0, 1, 2, 0, 1]
Methods
feed
fit
predict
set_state
set_training
Attributes
flag
key
metainfo
shared_type
- __call__(*args, **kws)¶
The framework calls __call__ function repeatedly for every input data.
Args:
Returns:
- Raises:
An exception during __init__ can terminate the graph run. –