# tfr.keras.pipeline.PipelineHparams

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/pipeline.py#L261-L334) |

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.

<br />

<br />

<br />

| ## 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`](https://www.tensorflow.org/api_docs/python/tf/keras/losses/Reduction) to specify the reduction method. |
| `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. |
| `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. |

<br />

## Methods

### `__eq__`

    __eq__(
        other
    )

<br />

<br />

<br />

| ## 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` |

<br />