Scalarizes multple objectives by a linear combination.
Inherits From: Scalarizer
tf_agents.bandits.multi_objective.multi_objective_scalarizer.LinearScalarizer(
weights: Sequence[tf_agents.bandits.multi_objective.multi_objective_scalarizer.ScalarFloat
]
)
Args |
weights
|
A Sequence of weights for linearly combining the objectives.
|
Raises |
TypeError
|
if not isinstance(weights, Sequence) .
|
Methods
call
View source
call(
multi_objectives: tf.Tensor
) -> tf.Tensor
Implementation of scalarization logic by subclasses.
set_parameters
View source
set_parameters(
weights: tf.Tensor
)
Set the scalarization parameter of the LinearScalarizer.
Args |
weights
|
A a rank-2 tf.Tensor of weights shaped as
[batch_size, self._num_of_objectives], where batch_size should match
the batch size of the multi_objectives passed to the scalarizer call.
|
Raises |
ValueError
|
if the weights tensor is not rank-2, or has a last dimension
size that does not match self._num_of_objectives .
|
__call__
View source
__call__(
multi_objectives: tf.Tensor
) -> tf.Tensor
Returns a single reward by scalarizing multiple objectives.
Args |
multi_objectives
|
A Tensor of shape [batch_size, number_of_objectives],
where each column represents an objective.
|
Returns: A Tensor
of shape [batch_size] representing scalarized rewards.
Raises |
ValueError
|
if multi_objectives.shape.rank != 2 .
|
ValueError
|
if
multi_objectives.shape.dims[1] != self._num_of_objectives .
|