# tfr.keras.losses.NDCGLambdaWeightV2

<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#L149-L167) |

Keras serializable class for NDCG LambdaWeight V2 for topn.

    tfr.keras.losses.NDCGLambdaWeightV2(
        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,
        **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. |

<br />

## Methods

### `get_config`

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

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