# tfr.keras.losses.DCGLambdaWeight

<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/losses.py#L123-L146) |

Keras serializable class for DCG.

    tfr.keras.losses.DCGLambdaWeight(
        topn: Optional[int] = None,
        gain_fn: Optional[https://www.tensorflow.org/ranking/api_docs/python/tfr/keras/utils/GainFunction] = None,
        rank_discount_fn: Optional[https://www.tensorflow.org/ranking/api_docs/python/tfr/keras/utils/GainFunction] = None,
        normalized: bool = False,
        smooth_fraction: float = 0.0,
        **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `topn` | (int) The topn for the DCG metric. |
| `gain_fn` | (function) Transforms labels. |
| `rank_discount_fn` | (function) The rank discount function. |
| `normalized` | (bool) If True, normalize weight by the max DCG. |
| `smooth_fraction` | (float) parameter to control the contribution from LambdaMART. |

<br />

## Methods

### `get_config`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/losses.py#L139-L146)

    get_config() -> Dict[str, Any]

### `individual_weights`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/losses_impl.py#L281-L296)

    individual_weights(
        labels, ranks
    )

See `_LambdaWeight`.

### `pair_weights`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/losses_impl.py#L255-L279)

    pair_weights(
        labels, ranks
    )

See `_LambdaWeight`.