tfr.keras.pipeline.PipelineHparams
Stay organized with collections
Save and categorize content based on your preferences.
Hyperparameters used in ModelFitPipeline
.
tfr.keras.pipeline.PipelineHparams(
model_dir: str,
num_epochs: int,
steps_per_epoch: int,
validation_steps: int,
learning_rate: float,
loss: Union[str, Dict[str, str]],
loss_reduction: str = tf.losses.Reduction.AUTO,
optimizer: str = 'adam',
loss_weights: Optional[Union[float, Dict[str, float]]] = None,
steps_per_execution: int = 10,
automatic_reduce_lr: bool = False,
early_stopping_patience: int = 0,
early_stopping_min_delta: float = 0.0,
use_weighted_metrics: bool = False,
export_best_model: bool = False,
best_exporter_metric_higher_better: bool = False,
best_exporter_metric: str = 'loss',
strategy: Optional[str] = None,
cluster_resolver: Optional[tf.distribute.cluster_resolver.ClusterResolver] = None,
variable_partitioner: Optional[tf.distribute.experimental.partitioners.Partitioner] = None,
tpu: Optional[str] = ''
)
Hyperparameters to be specified for ranking pipeline.
Attributes |
model_dir
|
A path to output the model and training data.
|
num_epochs
|
An integer to specify the number of epochs of training.
|
steps_per_epoch
|
An integer to specify the number of steps per epoch. When
it is None, going over the training data once is counted as an epoch.
|
validation_steps
|
An integer to specify the number of validation steps in
each epoch. Note that a mini-batch of data will be evaluated in each step
and this is the number of steps taken for validation in each epoch.
|
learning_rate
|
A float to indicate the learning rate of the optimizer.
|
loss
|
A string or a map to strings that indicate the loss to be used. When
loss is a string, all outputs and labels will be trained with the same
loss. When loss is a map, outputs and labels will be trained with losses
implied by the corresponding keys.
|
loss_reduction
|
An option in tf.keras.losses.Reduction to specify the
reduction method.
|
optimizer
|
An option in tf.keras.optimizers identifiers to specify the
optimizer to be used.
|
loss_weights
|
None or a float or a map to floats that indicate the relative
weights for each loss. When not specified, all losses are applied with the
same weight 1.
|
steps_per_execution
|
An integer to specify the number of steps executed in
each operation. Tuning this to optimize the training performance in
distributed training.
|
automatic_reduce_lr
|
A boolean to indicate whether to use
ReduceLROnPlateau callback.
|
early_stopping_patience
|
Number of epochs with no improvement after which
training will be stopped.
|
early_stopping_min_delta
|
Minimum change in the monitored quantity to
qualify as an improvement, i.e. an absolute change of less than
early_stopping_min_delta, will count as no improvement.
|
use_weighted_metrics
|
A boolean to indicate whether to use weighted metrics.
|
export_best_model
|
A boolean to indicate whether to export the best model
evaluated by the best_exporter_metric on the validation data.
|
best_exporter_metric_higher_better
|
A boolean to indicate whether the
best_exporter_metric is the higher the better.
|
best_exporter_metric
|
A string to specify the metric used to monitor the
training and to export the best model. Default to the 'loss'.
|
strategy
|
An option of strategies supported in strategy_utils . Choose from
["MirroredStrategy", "MultiWorkerMirroredStrategy",
"ParameterServerStrategy", "TPUStrategy"].
|
cluster_resolver
|
A cluster_resolver to build strategy.
|
variable_partitioner
|
Variable partitioner to be used in
ParameterServerStrategy.
|
tpu
|
TPU address for TPUStrategy. Not used for other strategy.
|
Methods
__eq__
__eq__(
other
)
Class Variables |
automatic_reduce_lr
|
False
|
best_exporter_metric
|
'loss'
|
best_exporter_metric_higher_better
|
False
|
cluster_resolver
|
None
|
early_stopping_min_delta
|
0.0
|
early_stopping_patience
|
0
|
export_best_model
|
False
|
loss_reduction
|
'auto'
|
loss_weights
|
None
|
optimizer
|
'adam'
|
steps_per_execution
|
10
|
strategy
|
None
|
tpu
|
''
|
use_weighted_metrics
|
False
|
variable_partitioner
|
None
|
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 2023-08-18 UTC.
[null,null,["Last updated 2023-08-18 UTC."],[],[],null,["# tfr.keras.pipeline.PipelineHparams\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/pipeline.py#L261-L334) |\n\nHyperparameters used in `ModelFitPipeline`. \n\n tfr.keras.pipeline.PipelineHparams(\n model_dir: str,\n num_epochs: int,\n steps_per_epoch: int,\n validation_steps: int,\n learning_rate: float,\n loss: Union[str, Dict[str, str]],\n loss_reduction: str = tf.losses.Reduction.AUTO,\n optimizer: str = 'adam',\n loss_weights: Optional[Union[float, Dict[str, float]]] = None,\n steps_per_execution: int = 10,\n automatic_reduce_lr: bool = False,\n early_stopping_patience: int = 0,\n early_stopping_min_delta: float = 0.0,\n use_weighted_metrics: bool = False,\n export_best_model: bool = False,\n best_exporter_metric_higher_better: bool = False,\n best_exporter_metric: str = 'loss',\n strategy: Optional[str] = None,\n cluster_resolver: Optional[tf.distribute.cluster_resolver.ClusterResolver] = None,\n variable_partitioner: Optional[tf.distribute.experimental.partitioners.Partitioner] = None,\n tpu: Optional[str] = ''\n )\n\nHyperparameters to be specified for ranking pipeline.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `model_dir` | A path to output the model and training data. |\n| `num_epochs` | An integer to specify the number of epochs of training. |\n| `steps_per_epoch` | An integer to specify the number of steps per epoch. When it is None, going over the training data once is counted as an epoch. |\n| `validation_steps` | An integer to specify the number of validation steps in each epoch. Note that a mini-batch of data will be evaluated in each step and this is the number of steps taken for validation in each epoch. |\n| `learning_rate` | A float to indicate the learning rate of the optimizer. |\n| `loss` | A string or a map to strings that indicate the loss to be used. When `loss` is a string, all outputs and labels will be trained with the same loss. When `loss` is a map, outputs and labels will be trained with losses implied by the corresponding keys. |\n| `loss_reduction` | An option in [`tf.keras.losses.Reduction`](https://www.tensorflow.org/api_docs/python/tf/keras/losses/Reduction) to specify the reduction method. |\n| `optimizer` | An option in [`tf.keras.optimizers`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers) identifiers to specify the optimizer to be used. |\n| `loss_weights` | None or a float or a map to floats that indicate the relative weights for each loss. When not specified, all losses are applied with the same weight 1. |\n| `steps_per_execution` | An integer to specify the number of steps executed in each operation. Tuning this to optimize the training performance in distributed training. |\n| `automatic_reduce_lr` | A boolean to indicate whether to use `ReduceLROnPlateau` callback. |\n| `early_stopping_patience` | Number of epochs with no improvement after which training will be stopped. |\n| `early_stopping_min_delta` | Minimum change in the monitored quantity to qualify as an improvement, i.e. an absolute change of less than early_stopping_min_delta, will count as no improvement. |\n| `use_weighted_metrics` | A boolean to indicate whether to use weighted metrics. |\n| `export_best_model` | A boolean to indicate whether to export the best model evaluated by the `best_exporter_metric` on the validation data. |\n| `best_exporter_metric_higher_better` | A boolean to indicate whether the `best_exporter_metric` is the higher the better. |\n| `best_exporter_metric` | A string to specify the metric used to monitor the training and to export the best model. Default to the 'loss'. |\n| `strategy` | An option of strategies supported in `strategy_utils`. Choose from \\[\"MirroredStrategy\", \"MultiWorkerMirroredStrategy\", \"ParameterServerStrategy\", \"TPUStrategy\"\\]. |\n| `cluster_resolver` | A cluster_resolver to build strategy. |\n| `variable_partitioner` | Variable partitioner to be used in ParameterServerStrategy. |\n| `tpu` | TPU address for TPUStrategy. Not used for other strategy. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__eq__`\n\n __eq__(\n other\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Class Variables --------------- ||\n|------------------------------------|----------|\n| automatic_reduce_lr | `False` |\n| best_exporter_metric | `'loss'` |\n| best_exporter_metric_higher_better | `False` |\n| cluster_resolver | `None` |\n| early_stopping_min_delta | `0.0` |\n| early_stopping_patience | `0` |\n| export_best_model | `False` |\n| loss_reduction | `'auto'` |\n| loss_weights | `None` |\n| optimizer | `'adam'` |\n| steps_per_execution | `10` |\n| strategy | `None` |\n| tpu | `''` |\n| use_weighted_metrics | `False` |\n| variable_partitioner | `None` |\n\n\u003cbr /\u003e"]]