tensorflow / tensorflow/probability
KL Divergence for PlackettLuce throws an error
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Ok, so I'm trying to replicate the listnet and listmle loss functions (link) in keras/tensorflow, and in the above-mentioned link it says those loss functions rely on the Plackett Luce model, so that is how I got here. Now the docs say there should be support to calculate kl_divergence (see here), however when I try to calculate it, it throws me the following error::
NotImplementedError: No KL(distribution_a || distribution_b) registered for distribution_a type PlackettLuce and distribution_b type PlackettLuce
Code snippet:
`
def kl_loss(y_true, y_pred):
a_distr = tfp.distributions.PlackettLuce(y_true, tensorflow.float32)
b_distr = tfp.distributions.PlackettLuce(y_pred, tensorflow.float32)
return a_distr.kl_divergence(b_distr)`
So, I wonder has it not been implemented yet or am I doing something horribly wrong?
PS: Excuse me for any possible ignorance, I'm relatively new to tensorflow and still figuring things out
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tfp.distributions.PlackettLuce and the documented kl_divergence API; reproduce the reported NotImplementedError with the provided snippet. Determine whether KL support is intended for two PlackettLuce distributions, and consider the work complete when the documented call succeeds or the API documentation clearly states the limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100