Bayesian NNs#3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces Bayesian Neural Networks (BNNs) to the PT-MELT framework along with enhancements for hyperparameter tuning capabilities. The implementation adds probabilistic layers and uncertainty quantification features.
Key changes include:
- Added new BayesianNeuralNetwork model with Bayesian layers using flipout technique
- Enhanced hyperparameter tuning with new dependencies and model builder utility
- Improved mixture density loss computation and visualization flexibility
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Added hyperparameter tuning dependencies and version bump |
| ptmelt/utils/hp_tuning.py | New model builder utility for hyperparameter optimization |
| ptmelt/utils/visualization.py | Made R² and RMSE parameters optional in plotting function |
| ptmelt/nn_utils.py | Added new activation functions and loss function utilities |
| ptmelt/models.py | Added BayesianNeuralNetwork class and refactored training loop |
| ptmelt/losses.py | Improved mixture density loss with numerical stability |
| ptmelt/layers.py | Added Bayesian flipout layer implementation |
| ptmelt/blocks.py | Added BayesianBlock and enhanced output layers with seed support |
Comments suppressed due to low confidence (1)
ptmelt/layers.py:273
- Commented out code should be removed rather than left in the codebase. If num_points is not needed, remove the parameter and the comment.
self.register_buffer("dmax", torch.tensor(dmax))
nickwimer
commented
Jul 31, 2025
Collaborator
Author
nickwimer
left a comment
There was a problem hiding this comment.
Incorporated appropriate changes from review. Looks good now.
|
|
||
| return model, optimizer, criterion | ||
|
|
||
| elif arch_type == "resnet": |
Collaborator
Author
There was a problem hiding this comment.
fixing this in next commit...
nickwimer
added a commit
that referenced
this pull request
Oct 8, 2025
* Bayesian NNs (#3) * adding support for hyperparameter tuning using Ray * remove manditory r2 and rmse from plot text * WIP; initial code for ptBNN replicating tf flipout * adding in updates to BNN working tests for iaps... * adjusting the clamping for the MDN output to try to avoid NaNs * updates to MDN output for stability * adding in seed for reproduction testing * cleaning up before PR * fixing typos and adding in conditions for partial bayes blocks * removing pass for unsupported architectures...todo to fully implement * RNN models and LR Schedulers (#4) * moving utility functions into class files...might deprecate soon * making the mixture density loss have mse regularization * adding in schedulers and early stopping * fixing mse addition loss term for MDNs * updating regression notebook * adding in support for LSTM model from time series modeling work * cleaning up old commented code * removing commented code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.