baybe.objectives.desirability.scalarize¶
- baybe.objectives.desirability.scalarize(values: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], scalarizer: Scalarizer, weights: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])[source]¶
Scalarize the rows of a 2-D array, producing a 1-D array.
- Parameters:
values (
Union
[_Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
]]) – The 2-D array whose rows are to be scalarized.scalarizer (
Scalarizer
) – The scalarization mechanism to be used.weights (
Union
[_Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
]]) – Weights for the columns of the input array.
- Raises:
ValueError – If the provided array is not two-dimensional.
NotImplementedError – If the requested scalarizer is not implemented.
- Returns:
A 1-D array containing the scalarized values.
- Return type:
np.ndarray