Code, tips, thoughts and opinions by voracity

Menu

Make-Believe: A Web-based Bayes Net Thingamajig

It’s been a year and a half since my last and first blog post — I think it’s safe to say I’m not obsessive about updating this blog! In any event, I now have something to write about.

On and off (and mostly off) for the past couple of years I’ve been spare-time hacking on a html-js Bayes net (BN) viewer. While it’s still pretty fragile, I think it’s in an OK enough state to put something out. I’m releasing it under an MIT License (i.e. do what you want with it, just don’t sue me or claim it’s yours) and I’ll be putting the source code (which is also the run code) up on Github shortly. I’m also hosting it and will always have the latest version of it right here:

One of the reasons I’m releasing it now is that I’ve started adding ‘non-core’ features to it (namely, a subset of GeNIe’s DBN viewer functionality), and it didn’t seem that difficult to do. That’s given me the hope (hopefully not false) that I might be able to make useful improvements to it in my spare time. So to spur me on, I’m releasing it publicly and committing to fortnightly updates. Now, fortnightly updates doesn’t mean something exciting every 2 weeks; it just means at least something changed every 2 weeks. That’s also why I’ll be using release numbers rather than version numbers. But hopefully it’s enough to get me into the routine of updating it and making useful additions to it over the long term.

Here’s some notes on the current version:

It’s 100% client-side html-js. In future, there will be plugins that will allow calling into server-side code, but these won’t ever be essential. So if you want to run Make-Believe from file: (and don’t have a browser with a crappy security policy), you’ll get the full non-plugin experience.

It currently only reads GeNIe .xdsl files. More formats will be added in future, but .xdsl will be the best supported format unless I decide there’s an extremely good reason to switch focus to another format. If you need to convert your net to work with it right now, you can try converting it with GeNIe.

It is currently limited to viewing a BN and performing belief updating. The aim is to have it do much more in future, hence the ‘thingamajig’ in the title of this post.

Discrete variables only for now. This is a limitation I’m eager to remove…

It only performs stochastic updating (using likelihood-weighting). This will likely remain true, but I will make the engine easy to swap out. Conversely, it will eventually be easy to use just the engine. Right now, the engine, file loader and viewer are a bit tangled up.

It supports some GeNIe DBNs. Namely, those which have all their nodes in the ‘Transition Step’ of the temporal plate. Wider support to come.

There is no support for decision networks or other BN extensions. Again, this is likely to change.

I’ve spent a fair bit of time optimising the engine. I haven’t benchmarked it properly, but it works fast and accurately enough on some of my real BNs, that I can use it in place of desktop BN packages for inference. (With recent browsers, of course.) I have more to do, though, as I intend to use workers (threads) and SIMD.js to improve things still further.

Please fork and improve it. Just don’t expect me to keep up. I’d love to see others take the code and turn it into something great. But that doesn’t mean I’ll bring those changes into my version. This is a hobby for me, and I don’t want to spend all my time assessing the implications of and merging in other people’s cool changes — I just want to hack around and have fun. 🙂