Giter Club home page Giter Club logo

Comments (2)

danielkorzekwa avatar danielkorzekwa commented on August 24, 2024

bayes-scala doesn't provide any high-level api at the moment, so it would be improvement. It provides implementations of different bayesian techniques, e.g.:

  • separate scala code for cluster graphs in a discrete space
  • separate code for factor graph in a hybrid space,
  • some examples for Gaussian Processes, LDS learning and few others

Basically, I was implementing these algorithms over time when I needed them for my work, but I never really attempted creating more high level API, although I have some ideas I can share with you now.

I presume you attempt creating API for bayesian-networks, which conceptually looks similar to a graphical SamIam tool. Creating nodes and dependencies, hiding details of underlying implementation, removing varIds, explicit edges, and so on. If so, then it looks good, however consider the following:

  1. Your API supports Bayesian Networks only, it can't really create markov networks, which are supported by cluster graphs. Transforming Bayesian Network to cluster graph is not an obvious task, there are multiple cluster graphs possible for the same Bayesian Network. Think how the API will be actually implemented, do you want to support just bayesian nets in discrete space or any probabilistic models.

  2. If the purpose of this API is more for learning and playing with small and simple Bayesian Networks, then of course it doesn't really matter what form of cluster graph or factor graph you use for representing it, it still will be fine from the performance point of view, but creating such API for large scale and efficient inference in both discrete and continuous space is a challenge and it likely needs lots of time to design and implement it.

  3. Different form of API I was thinking my self follows more a probabilistic programming paradigm, e.g.

val winter = Bern(0.2)
val sprinkler = Mixture(winter, Bern(0,2), Bern(0.75))

or differently:

val sprinkler = winter match {
case true => Bern(0,2)
case false => Bern(0.75)
}

Basically working purely with variables like in programming, instead of explicitly using factors or nodes

from bayes-scala.

BertrandDechoux avatar BertrandDechoux commented on August 24, 2024

Thanks for your feedback.

I have reworked a bit the POC as it can be seen for SprinklerBN.

val rain = P('rain | winter) follows (0.1, 0.9, 0.3, 0.7)

which is quite nice for a simple example. The name of the Var/val is duplicated but it is a useful information for later in order to generate an export and/or a visualisation of the network.

I am at ease with Bayesian networks but I clearly will need to go back to my books for the details of cluster graph and factor graph. In that regard, your documentation seems really good because I know the references you have been using.

My roadmap is

  • almost done : a simple API for discrete Bayesian network
  • next : a flexible way to create cluster graph
  • later : support for 'non-discrete' network and Markov network

Your examples are interesting. I really could see a simple evolution in order to support various factor types.

val rain = P('rain | winter) is (0.1, 0.9, 0.3, 0.7)
# same as above but with normalization
val rain = P('rain | winter) is Raw(1, 9, 30, 70)
# same as above but more explicit
val rain = P('rain | winter) is Mixture(Bern(0.1), Bern(0.3))

I am not a fan of pattern matching/switch statement for the configuration but I know a few APIs are doing that (in Python). I will see how it goes step by step. Ideally, the compiler should check as much as possible that the configuration is correct. That might be a secondary challenge.

from bayes-scala.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.