towhee.hub.builtin.operators.feature_engineer.standard_scaler

class towhee.hub.builtin.operators.feature_engineer.standard_scaler(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.range(10).map(lambda x: Entity(a=x))
...         .set_training()
...         .standard_scaler['a', 'b'](name='standard_scaler')
... )
>>> [int(x.b*10) for x in dc.to_list()]
[-15, -12, -8, -5, -1, 1, 5, 8, 12, 15]

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.

__init__(name: Optional[str] = None)[source]

Init operator, before a graph starts, the framework will call Operator __init__ function.

Args:

Raises:

An exception during __init__ can terminate the graph run.