sklearn_transformer
- class SkLearnTransformerProtocol(*args, **kwds)[source]
Bases:
typing_extensions.Protocol
- inverse_transform(arr: Union[numpy.ndarray, Sequence[Sequence[Any]]]) numpy.ndarray
- transform(arr: Union[numpy.ndarray, Sequence[Sequence[Any]]]) numpy.ndarray
- fit(arr: Union[numpy.ndarray, Sequence[Sequence[Any]]])
- __init__(*args, **kwargs)
- class ManualScaler(*args, **kwds)[source]
Bases:
sensai.data_transformation.sklearn_transformer.SkLearnTransformerProtocol
A scaler whose parameters are not learnt from data but manually defined
- __init__(centre: Optional[float] = None, scale: Optional[float] = None)
- 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)
- transform(arr: Union[numpy.ndarray, Sequence[Sequence[Any]]]) numpy.ndarray
- inverse_transform(arr: Union[numpy.ndarray, Sequence[Sequence[Any]]]) numpy.ndarray
- class SkLearnTransformerFactoryFactory[source]
Bases:
object
- static MaxAbsScaler() Callable[[], sklearn.preprocessing.MaxAbsScaler]
- static MinMaxScaler() Callable[[], sklearn.preprocessing.MinMaxScaler]
- static StandardScaler(with_mean=True, with_std=True) Callable[[], sklearn.preprocessing.StandardScaler]
- static RobustScaler(quantile_range=(25, 75), with_scaling=True, with_centering=True) Callable[[], sklearn.preprocessing.RobustScaler]
- 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[[], sensai.data_transformation.sklearn_transformer.ManualScaler]
- 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.