tensorflow / tensorflow/probability
Loss is automatically converted?
Open
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
From the bayesian_neural_network.py example-
# Model compilation.
optimizer = tf.keras.optimizers.Adam(lr=FLAGS.learning_rate)
# We use the categorical_crossentropy loss since the MNIST dataset contains
# ten labels. The Keras API will then automatically add the
# Kullback-Leibler divergence (contained on the individual layers of
# the model), to the cross entropy loss, effectively
# calcuating the (negated) Evidence Lower Bound Loss (ELBO)
model.compile(optimizer, loss='categorical_crossentropy',
metrics=['accuracy'], experimental_run_tf_function=False)
return model
How does TF know to automatically convert the loss to probability and is converting a loss to probability compatible just a matter of adding KL to whatever loss you want to use?
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 the bayesian_neural_network.py example and its model.compile block. Trace how the categorical_crossentropy loss and layer KL terms are handled, then document whether the example converts a loss to a probability and whether adding KL is generally valid; done means the explanation answers both questions clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100