Abstract classes

class detroit.scale.Scaler

Protocol class which represents Scaler class

abstractmethod __call__(x: U) V

Scales a value.

Parameters:

x (U) – Value to transform

Returns:

Scaled value

Return type:

V

abstractmethod get_domain() list[U]

Returns the domain values.

Returns:

Domain values

Return type:

list[U]

abstractmethod get_range() list[V]

Returns the range values.

Returns:

Range values

Return type:

list[V]

abstractmethod set_domain(domain: list[U]) Scaler[U, V]

Sets the domain and returns the scaler updated.

Parameters:

domain (list[U]) – Domain values to set

Returns:

Itself

Return type:

Scaler[U, V]

abstractmethod set_range(range_vals: list[V]) Scaler[U, V]

Sets the range and returns the scaler updated.

Parameters:

range_vals (list[V]) – Range values to set

Returns:

Itself

Return type:

Scaler[U, V]

class detroit.scale.ContinuousScaler

Protocol class which represents Continuous Scaler class

abstractmethod invert(y: V) U

Makes the opposite operation of __call__.

Parameters:

y (V) – Scaled value

Returns:

Original value

Return type:

U

abstractmethod get_interpolate() Callable[[V, V], Callable[[float], V]]

Gets the interpolator function.

Returns:

Interpolate function

Return type:

Callable[[V, V], Callable[[float], V]]

abstractmethod get_clamp() bool

Returns if clamp is set on.

Returns:

Clamp status

Return type:

bool

abstractmethod get_unknown() Any

Returns the default value when __call__ takes a math.nan.

Returns:

Unknown value

Return type:

Any

abstractmethod set_interpolate(interpolate: Callable[[V, V], Callable[[float], V]]) ContinuousScaler[U, V]

Sets the interpolator function and returns the scaler updated.

Parameters:

interpolate (Callable[[V, V], Callable[[float], V]]) – Interpolate function

Returns:

Itself

Return type:

ContinuousScaler[U, V]

abstractmethod set_clamp(clamp: bool) ContinuousScaler[U, V]

Sets the clamp status and returns the scaler updated.

Parameters:

clamp (bool) – Clamp status

Returns:

Itself

Return type:

ContinuousScaler[U, V]

abstractmethod set_unknown(unknown: Any) ContinuousScaler[U, V]

Sets the unknown value when a math.nan is encountered and returns the scaler updated.

Parameters:

unknown (Any) – Unknown value to set

Returns:

Itself

Return type:

ContinuousScaler[U, V]

class detroit.scale.SequentialScaler

Protocol class which represents Sequential Scaler class

abstractmethod set_interpolator(interpolator: Callable[[U], V]) SequentialScaler[U, V]

Sets the interpolator function and returns the scaler updated.

Parameters:

interpolator (Callable[[U], V]) – Interpolator function

Returns:

Itself

Return type:

SequentialScaler[U, V]