Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] API for BNNODE #724

Merged
merged 42 commits into from
Sep 15, 2023
Merged

[WIP] API for BNNODE #724

merged 42 commits into from
Sep 15, 2023

Conversation

AstitvaAggarwal
Copy link
Contributor

for issue #719

Copy link

@ai-maintainer ai-maintainer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-Maintainer Review for PR - [WIP] API for BNNODE

Title and Description ⚠️

Title and Description Need More Detail
The title of the pull request suggests that the changes are related to implementing an API for the BNNODE class. However, the description, which simply states "for issue #719," does not provide much context or explanation about the purpose of the changes. It would be helpful to have a more detailed description that explains the motivation behind the API implementation and how it addresses the specific issue.

Scope of Changes ❓

Scope of Changes May Be Too Broad
Based on the provided diff, it appears that the changes are focused on implementing the API for the BNNODE class. However, there is also a mention of the BNNPDE class and some related functions. It is not clear whether these additional changes are part of the same issue or if they are addressing multiple issues simultaneously. It would be helpful to have more information or context to determine if the changes are narrowly focused or if they encompass multiple issues.

Documentation ⚠️

Missing Docstrings
The following functions, classes, or methods do not have docstrings:
  • struct BNNODE <: NeuralPDEAlgorithm
  • struct BNNPDE <: NeuralPDEAlgorithm
  • function DiffEqBase.__solve(prob::DiffEqBase.AbstractODEProblem, alg::BNNODE,args...; )

These entities should have docstrings added to describe their behavior, arguments, and return values.

Testing ⚠️

No Information on Testing
The description does not mention anything about how the author tested the changes. It would be beneficial to include information about the testing approach, such as the specific test cases used, the testing environment, and any relevant test results or observations. This would provide transparency and help reviewers understand the extent of testing performed on the changes.

Suggested Changes

  • Please provide a more detailed description of the changes and how they address issue API for BNNODE. #719.
  • If the changes related to the BNNPDE class and related functions are addressing a different issue, please consider separating them into a different pull request.
  • Add docstrings to the BNNODE and BNNPDE structs and the DiffEqBase.__solve function to describe their behavior, arguments, and return values.
  • Include information about how you tested the changes, including specific test cases used, the testing environment, and any relevant test results or observations.

Reviewed with AI Maintainer

@AstitvaAggarwal AstitvaAggarwal marked this pull request as draft August 18, 2023 06:03
@AstitvaAggarwal AstitvaAggarwal marked this pull request as ready for review August 20, 2023 14:35
Copy link

@ai-maintainer ai-maintainer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-Maintainer Review for PR - [WIP] API for BNNODE

Title and Description ⚠️

Title and Description Need More Detail
The title of the pull request indicates that the changes are related to implementing an API for BNNODE. However, the description is not detailed and does not provide enough context about the changes. Please provide a more comprehensive description that explains the purpose of the changes, how they address the issue, and any other relevant information.

Scope of Changes 👍

Changes are Narrowly Focused
The changes appear to be narrowly focused on implementing the API for BNNODE. However, without additional context or information, it is difficult to determine if the changes are addressing multiple issues simultaneously or if they are solely focused on one specific issue. Please clarify this in the description.

Testing ⚠️

No Information on Testing
The description does not provide any information about how the changes were tested. Please include details about the testing approach, including any unit tests, integration tests, or specific scenarios that were tested to validate the changes.

Documentation ⚠️

Missing Docstrings
The following functions, classes, or methods do not have docstrings:
  • struct BNNODE <: NeuralPDEAlgorithm
  • struct BNNPDE <: NeuralPDEAlgorithm
  • function DiffEqBase.__solve(prob::DiffEqBase.AbstractODEProblem, alg::BNNODE,args...; )

Please add docstrings to these entities to describe their behavior, arguments, and return values.

Code Changes ⚠️

Missing Newline at End of File
Please add a newline at the end of the file as per standard coding conventions.

Potential Issues ⚠️

Check for Neural Network Type
The code checks if `BNNODE.chain` is a `Lux.AbstractExplicitLayer` or a `Flux.Chain`, and throws an error if it is neither. However, it would be better to check this at the start of the function and exit early if the condition is not met. This would avoid unnecessary computation and make the code more efficient.

Reviewed with AI Maintainer

@xtalax
Copy link
Member

xtalax commented Aug 21, 2023

Looking good, I wanna see your tests passing and documentation with an example then lgtm

@AstitvaAggarwal
Copy link
Contributor Author

AstitvaAggarwal commented Aug 29, 2023

@Vaibhavdixit02 @xtalax on my local machine all tests pass(v1.9.3) but for the v1 and v1.6 marginal errors crop up, what should I do? Using earlier versions affects performance. Also the v1.6 logging CI tests gives the statistics compat error as the AHMC version I'm using(NeuralPDE allows v0.5) works only with the latest Julia versions(refer https://julialang.slack.com/archives/CN04R7WKE/p1693333431525009?thread_ts=1693333431.525009&cid=CN04R7WKE).

@Vaibhavdixit02
Copy link
Member

Maybe we can drop 1.6 for this test group (it wouldn't be straightforward though). I don't recall why the compat was needed, is it possible to get rid of that?

@Vaibhavdixit02
Copy link
Member

Looking at test failures the values seem to be in the right ballpark so my guess is this is just a numerical difference between your local runs and the CI machine. You are probably not on the same OS (linux)? Relax the tolerances of the tests

@AstitvaAggarwal
Copy link
Contributor Author

AstitvaAggarwal commented Aug 30, 2023

Maybe we can drop 1.6 for this test group (it wouldn't be straightforward though). I don't recall why the compat was needed, is it possible to get rid of that?

was done here by @ChrisRackauckas .

@AstitvaAggarwal
Copy link
Contributor Author

whoa! after this update in Build to the latest Julia version the tests are almost exactly how i wanted them to be!

@AstitvaAggarwal
Copy link
Contributor Author

AstitvaAggarwal commented Sep 1, 2023

@Vaibhavdixit02 ive added the "missing" Likelihood term i was talking about, if you want to run it with the regular tests just uncomment line 53 in the file "advancedHMC_MCMC.jl", ive tried, it works!

test/BPINN_Tests.jl Outdated Show resolved Hide resolved
@xtalax
Copy link
Member

xtalax commented Sep 15, 2023

@Vaibhavdixit02 lgtm?


function BNNODE(chain, Kernel = HMC; strategy = nothing,
draw_samples = 2000,
priorsNNw = (0.0, 2.0), param = [nothing], l2std = [0.05],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this [nothing] and not just nothing?

phystd = [0.05], dataset = [nothing],
init_params = nothing,
physdt = 1 / 20.0, nchains = 1,
autodiff = false, Integrator = Leapfrog,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the NUTS kwargs should go into a struct or a namedtuple

@Vaibhavdixit02
Copy link
Member

Vaibhavdixit02 commented Sep 15, 2023

A couple of minor things, but they can be addressed in a different PR since this one's quite big already. So LGTM

@xtalax xtalax merged commit c0d6eef into SciML:master Sep 15, 2023
14 of 18 checks passed
@AstitvaAggarwal
Copy link
Contributor Author

Thank you 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants