Comments (5)
I think action is on me to come up with possible exceptions to throw.
from stanc3.
I would suggest using std::system_error
(introduced in C++11).
http://www.cplusplus.com/reference/system_error/system_error/
It takes a string and an error code. With pull request stan-dev/stan#2307, this should pass through and stop the samplers.
from stanc3.
This is a very small language change, but there are still a fair number of places in Stan where we are catching std::exception
generically and not re-throwing it. One is in base_hamiltonian
: https://github.com/stan-dev/stan/blob/develop/src/stan/mcmc/hmc/hamiltonians/base_hamiltonian.hpp#L65
So if your model initializes, no exception will cause it to stop. For example:
parameters {
real mu;
}
model {
mu ~ normal(0, 1);
if (mu < 0) {
array[1] int sigma;
print(sigma[2]);
}
}
If the indexing exception occurs during initialization, it will exit. But if initialization succeeds (e.g., keep re-running this program), you'll get a program which runs until sampling is complete, even though all these non-recoverable exceptions are thrown
from stanc3.
We could go in and fix the base Hamiltonian here. I don't like that it just swallows an exception without actually fixing it. At least it will cause a rejection.
from stanc3.
I've opened stan-dev/stan#3258 about the places I believe we would need changes in Stan.
from stanc3.
Related Issues (20)
- [Build] Investigate Melange as an alternative to Js_of_ocaml
- [BUG] atan2 listed as vectorised in manual, vectorised sigs not in stanc3
- Stan compiler Error when using the normal_cdf function HOT 16
- [BUG] Reporting example where new compiler failed HOT 1
- [BUG] stanc3 v. 2.33.1: build error with OCaml 4.14.1 and JaneStreet 0.16.x: `Error: This expression has type [ `Use_Sys_unix ] This is not a function; it cannot be applied`; `Error: Unbound value Set.Poly.union` HOT 4
- Typechecker: Allow predicate-based typechecking of library functions HOT 3
- [BUG] SoA request is ignored with external c++ HOT 5
- Release support for building against ocaml 5 HOT 9
- [BUG] Github action doesn't build static binary for linux platform
- Improve message and handling of internal compiler errors
- [BUG] Array declaration no longer canonicalizes from deprecated format HOT 1
- Iinformative error message for expired array syntax
- CI: Switch from the ghr script to the github CLI
- Namespacing with external C++ and `--standalone-functions` causes issues HOT 4
- [BUG] Bogus parsing error with Stanc3 JS >= 2.34 - but only with QuickJS HOT 3
- #include support in stancjs HOT 1
- New stan error in R version 4.3.3 HOT 7
- Internal compiler error: TypeError: not a function HOT 2
- Expose built-in constraint transforms as _jacobian functions
- [FR] Add `lower_upper` constrain HOT 5
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 stanc3.