baybe.targets.transforms.triangular_transform¶
- baybe.targets.transforms.triangular_transform(arr: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], lower: float, upper: float)[source]¶
Map values to the interval
[0, 1]in a “triangular” fashion.The shape of the function is “triangular” in that is 0 outside a specified interval and linearly increases to 1 from both interval ends, reaching the value 1 at the center of the interval.
- Parameters:
arr (
Union[_SupportsArray[dtype[Any]],_NestedSequence[_SupportsArray[dtype[Any]]],bool,int,float,complex,str,bytes,_NestedSequence[Union[bool,int,float,complex,str,bytes]]]) – The values to be mapped.lower (
float) – The lower end of the triangle interval. Below, the mapped values are 0.upper (
float) – The upper end of the triangle interval. Above, the mapped values are 0.
- Return type:
- Returns:
A new array containing the transformed values.