sklearn_transformer#


to_2d_array(arr: Union[ndarray, Sequence[Sequence[Any]]]) ndarray[source]#
class SkLearnTransformerProtocol(*args, **kwargs)[source]#

Bases: Protocol

inverse_transform(arr: Union[ndarray, Sequence[Sequence[Any]]]) ndarray[source]#
transform(arr: Union[ndarray, Sequence[Sequence[Any]]]) ndarray[source]#
fit(arr: Union[ndarray, Sequence[Sequence[Any]]])[source]#
class ManualScaler(centre: Optional[float] = None, scale: Optional[float] = None)[source]#

Bases: SkLearnTransformerProtocol

A scaler whose parameters are not learnt from data but manually defined

Parameters:
  • centre – the value to subtract from all values (if any)

  • scale – the value with which to scale all values (after removing the centre)

fit(arr)[source]#
transform(arr: Union[ndarray, Sequence[Sequence[Any]]]) ndarray[source]#
inverse_transform(arr: Union[ndarray, Sequence[Sequence[Any]]]) ndarray[source]#
class SkLearnTransformerFactoryFactory[source]#

Bases: object

static MaxAbsScaler() Callable[[], sklearn.preprocessing.MaxAbsScaler][source]#
static MinMaxScaler() Callable[[], sklearn.preprocessing.MinMaxScaler][source]#
static StandardScaler(with_mean=True, with_std=True) Callable[[], sklearn.preprocessing.StandardScaler][source]#
static RobustScaler(quantile_range=(25, 75), with_scaling=True, with_centering=True) Callable[[], sklearn.preprocessing.RobustScaler][source]#
Parameters:
  • quantile_range – a tuple (a, b) where a and b > a (both in range 0..100) are the percentiles which determine the scaling. Specifically, each value (after centering) is scaled with 1.0/(vb-va) where va and vb are the values corresponding to the percentiles a and b respectively, such that, in the symmetric case where va and vb are equally far from the centre, va will be transformed into -0.5 and vb into 0.5. In a uniformly distributed data set ranging from min to max, the default values of a=25 and b=75 will thus result in min being mapped to -1 and max being mapped to 1.

  • with_scaling – whether to apply scaling based on quantile_range.

  • with_centering – whether to apply centering by subtracting the median.

Returns:

a function, which when called without any arguments, produces the respective RobustScaler instance.

static ManualScaler(centre: Optional[float] = None, scale: Optional[float] = None) Callable[[], ManualScaler][source]#
Parameters:
  • centre – the value to subtract from all values (if any)

  • scale – the value with which to scale all values (after removing the centre)

Returns:

a function, which when called without any arguments, produces the respective scaler instance.