Dtype reduction
amltk.data.dtype_reduction
#
Reduce the dtypes of data.
reduce_dtypes
#
Reduce the dtypes of data.
When a dataframe, will reduce the dtypes of all columns. When applied to an iterable, will apply to all elements of the iterable.
For an int array, will reduce to the smallest dtype that can hold the minimum and maximum values of the array. Otherwise for floats, will reduce by one step, i.e. float32 -> float16, float64 -> float32.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The data to reduce.
TYPE:
|
reduce_int |
Whether to reduce integer dtypes.
TYPE:
|
reduce_float |
Whether to reduce floating point dtypes.
TYPE:
|
Source code in src/amltk/data/dtype_reduction.py
reduce_floating_precision
#
Reduce the floating point precision of the data.
For a float array, will reduce by one step, i.e. float32 -> float16, float64 -> float32.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The data to reduce.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
D
|
The reduced data. |
Source code in src/amltk/data/dtype_reduction.py
reduce_int_span
#
Reduce the integer span of the data.
For an int array, will reduce to the smallest dtype that can hold the minimum and maximum values of the array.
| PARAMETER | DESCRIPTION |
|---|---|
x |
The data to reduce.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
D
|
The reduced data. |