Scale¶
This pages contains classes defined in hakowan.scale
module.
ScaleLike: TypeAlias = float | Scale
module-attribute
¶
Type alias for scale-like objects.
- A scalar value will be converted to
Uniform
scale with the scalar value as the factor. - A Scale object will be unchanged.
Affine
dataclass
¶
Bases: Scale
Scale the data using an affine transformation.
Attributes:
Name | Type | Description |
---|---|---|
matrix |
NDArray
|
The affine transformation matrix. |
Source code in hakowan/grammar/scale/scale.py
Clip
dataclass
¶
Bases: Scale
Clip the data to the range [min, max].
Attributes:
Name | Type | Description |
---|---|---|
domain |
tuple[float, float]
|
The clip minimum and maximum values. |
Source code in hakowan/grammar/scale/scale.py
Custom
dataclass
¶
Bases: Scale
Scale the data using a custom function.
Attributes:
Name | Type | Description |
---|---|---|
function |
Callable
|
The scaling function. E.g. |
Source code in hakowan/grammar/scale/scale.py
Log
dataclass
¶
Bases: Scale
Logarithmic scale.
Attributes:
Name | Type | Description |
---|---|---|
base |
float
|
The base of the logarithm. |
Source code in hakowan/grammar/scale/scale.py
Normalize
dataclass
¶
Bases: Scale
Normalize the data so that the box defined by domain_min
and domain_max
is scaled to the box
defined by range_min
and range_max
.
Attributes:
Name | Type | Description |
---|---|---|
range_min |
ArrayLike
|
The minimum value of the output range. |
range_max |
ArrayLike
|
The maximum value of the output range. |
domain_min |
ArrayLike | None
|
The minimum value of the input range. If not specified, the minimum value of the input data will be used. |
domain_max |
ArrayLike | None
|
The maximum value of the input range. If not specified, the maximum value of the input data will be used. |
Source code in hakowan/grammar/scale/scale.py
Scale
dataclass
¶
Base class for all scales.
Source code in hakowan/grammar/scale/scale.py
__imul__(other)
¶
Combine the current scale with the other
scale in place. The current scale will be applied
before the other
scale.
Source code in hakowan/grammar/scale/scale.py
__mul__(other)
¶
Combine the current scale with the other
scale in a new scale. Both the current and
the other
scale is not modified. In the new scale, the current scale will be applied
before the other
scale.