complex_transform()
Apply a complex transformation to input data.
Usage
complex_transform(
data,
mode="standard",
threshold=0.5,
inplace=False,
)This function performs a multi-step transformation on the input data. The transformation is controlled by the mode parameter, which can be "standard", "fast", or "precise".
Parameters
data: list-
Input data as a list of numeric values. Each element must be a finite number (int or float). Empty lists are allowed and will return empty lists.
mode: str = "standard"-
Transformation mode. One of:
"standard"— balanced speed/accuracy (default)"fast"— optimized for speed at cost of precision"precise"— maximum accuracy, slower
threshold: float = 0.5-
Minimum value threshold. Values below this are filtered out before transformation. Must be non-negative.
inplace: bool = False-
If True, modify the input list in place. If False (default), return a new list.
Returns
list-
Transformed data. If
inplace=True, this is the same object asdata.
Raises
ValueError-
If
modeis not one of the recognized values. TypeError-
If
datacontains non-numeric elements.
Notes
The transformation algorithm is based on the windowed moving average technique described in [1]_. For large datasets (>10,000 elements), the "fast" mode is recommended.
The time complexity is O(n) for "fast" mode and O(n log n) for "precise" mode.
Warnings
Using inplace=True modifies the original data and cannot be undone. Always make a copy if you need the original data.
Examples
Basic usage with default parameters:
>>> from gdtest_long_docs import complex_transform
>>> complex_transform([1, 2, 3, 4, 5])
[1, 2, 3, 4, 5]Using fast mode:
>>> complex_transform([1, 2, 3], mode="fast")
[1, 2, 3]With threshold filtering:
>>> complex_transform([0.1, 0.5, 1.0], threshold=0.3)
[0.5, 1.0]References
- Smith, J. (2020). “Data Transformation Techniques.” Journal of Applied Computing, 15(3), 42-58.