Comments (4)
Excellent idea! One the one hand, we must avoid the "catch everything" pitfall. On the other hand, we do not know what exactly to catch. So my preferred solution is to have a tuple of allowed exceptions in VBOptions
, essentially:
def f_with_value_error(x):
return int("I am not a number")
result = bayem.vba(f_with_value_error, ...) # fails
result = bayem.vba(f_with_value_error, ..., allowed_exceptions=(ValueError,)) # result.success = False, but you get some values
result = bayem.vba(f_with_value_error, ..., allowed_exceptions=(IndexError,)) # fails (which is important to find bugs!)
internally, this then simply
...
try:
k, J = self.p(self.m)
except self.options.allowed_exceptions as e:
self.result.success = False
self.result.exception = e # or logger.error(e)
# ... whatever cleanup
return self.result
from bayem.
I think, at this point we are not going to uncover the reason behind any exception. That would be the duty of the user, I suppose. I would say, the VB can stop iterating due to ANY exception emerging in the evaluation of the model error and its jacobian, however, the VB must return proper WARNING messages to the user; e.g. hey :) , something has gone wrong in the model evaluation and therefore I stopped iterations. Makes sense?
from bayem.
For me, it is very important to know how the code fails (and it also should for you). So if you expect VB to fail because of convergence issues in FEniCS, but it actually fails because of a typo (likely to result in an AttributeError), you should get a real, severe error. Not just a printed message that is likely lost in some logs.
But if you still want this behavior, you could always pass allowed_exceptions=RuntimeError
and catch everything...
from bayem.
Solved via #88
from bayem.
Related Issues (20)
- Remove sphinx from requirements HOT 2
- Proper VB scaling HOT 2
- Potential bug in our F formula HOT 6
- Prescribed correlation (in noise model) HOT 28
- Remove Gamma.Noninformative()? HOT 1
- Linearity check HOT 3
- Towards `bayem` HOT 6
- Failing visualization test
- Fancy readme
- Docstrings
- pre-commit hooks
- Check ARD implementation HOT 1
- VB `state` variable HOT 1
- VB_postprocess_per_iteration HOT 4
- Sub-optimal control flow HOT 1
- Visualization of marginalized posteriors HOT 3
- Changes in visualization somehow break the CI HOT 1
- levels are not always computed correctly
- remove python 3.7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bayem.