tf_agents.bandits.multi_objective.multi_objective_scalarizer.ChebyshevScalarizer
Stay organized with collections
Save and categorize content based on your preferences.
Implement the Chebyshev Scalarization.
Inherits From: Scalarizer
tf_agents.bandits.multi_objective.multi_objective_scalarizer.ChebyshevScalarizer(
weights: Sequence[tf_agents.bandits.multi_objective.multi_objective_scalarizer.ScalarFloat
],
reference_point: Sequence[tf_agents.bandits.multi_objective.multi_objective_scalarizer.ScalarFloat
]
)
Given a vector of (at least two) objectives M, a weight vector W, and a
reference point Z, all having the same dimension, the Chebyshev scalarization
is defined as:
min_{i} W_i * (M_i - Z_i).
Note that reference point Z is expected to be dominated by all Pareto-optimal
objective vectors.
Args |
weights
|
A Sequence of weights.
|
reference_point
|
A Sequence of coordinates for the reference point.
|
Raises |
ValueError
|
if len(weights) != len(reference_point) .
|
Methods
set_parameters
View source
set_parameters(
weights: tf.Tensor, reference_point: tf.Tensor
)
Set the scalarization parameters for the ChebyshevScalarizer.
Args |
weights
|
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.
|
reference_point
|
A tf.Tensor of coordinates for the reference point that
must satisfy the same rank and shape requirements as weights .
|
Raises |
ValueError
|
if any input scalarization parameter 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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.bandits.multi_objective.multi_objective_scalarizer.ChebyshevScalarizer\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/multi_objective/multi_objective_scalarizer.py#L265-L330) |\n\nImplement the Chebyshev Scalarization.\n\nInherits From: [`Scalarizer`](../../../../tf_agents/bandits/multi_objective/multi_objective_scalarizer/Scalarizer) \n\n tf_agents.bandits.multi_objective.multi_objective_scalarizer.ChebyshevScalarizer(\n weights: Sequence[../../../../tf_agents/bandits/multi_objective/multi_objective_scalarizer/ScalarFloat],\n reference_point: Sequence[../../../../tf_agents/bandits/multi_objective/multi_objective_scalarizer/ScalarFloat]\n )\n\nGiven a vector of (at least two) objectives M, a weight vector W, and a\nreference point Z, all having the same dimension, the Chebyshev scalarization\nis defined as:\n\n`min_{i} W_i * (M_i - Z_i).`\n\nNote that reference point Z is expected to be dominated by all Pareto-optimal\nobjective vectors.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|------------------------------------------------------|\n| `weights` | A `Sequence` of weights. |\n| `reference_point` | A `Sequence` of coordinates for the reference point. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|--------------------------------------------|\n| `ValueError` | if `len(weights) != len(reference_point)`. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `set_parameters`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/multi_objective/multi_objective_scalarizer.py#L312-L330) \n\n set_parameters(\n weights: tf.Tensor, reference_point: tf.Tensor\n )\n\nSet the scalarization parameters for the ChebyshevScalarizer.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `weights` | A rank-2 [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/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. |\n| `reference_point` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of coordinates for the reference point that must satisfy the same rank and shape requirements as `weights`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `ValueError` | if any input scalarization parameter tensor is not rank-2, or has a last dimension size that does not match `self._num_of_objectives`. |\n\n\u003cbr /\u003e\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/multi_objective/multi_objective_scalarizer.py#L135-L161) \n\n __call__(\n multi_objectives: tf.Tensor\n ) -\u003e tf.Tensor\n\nReturns a single reward by scalarizing multiple objectives.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------------|------------------------------------------------------------------------------------------------------|\n| `multi_objectives` | A `Tensor` of shape \\[batch_size, number_of_objectives\\], where each column represents an objective. |\n\n\u003cbr /\u003e\n\nReturns: A `Tensor` of shape \\[batch_size\\] representing scalarized rewards.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|-----------------------------------------------------------------|\n| `ValueError` | if `multi_objectives.shape.rank != 2`. |\n| `ValueError` | if `multi_objectives.shape.dims[1] != self._num_of_objectives`. |\n\n\u003cbr /\u003e"]]