Skip to content

Commit

Permalink
Add rhine-bayes
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Feb 17, 2023
1 parent 566b317 commit 447ac2d
Show file tree
Hide file tree
Showing 18 changed files with 820 additions and 22 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,29 @@ jobs:
${{ runner.os }}-cabal-${{ matrix.ghc }}
- name: Cabal update
run: cabal update
- name: Cabal build dependencies except rhine-bayes
# Temporarily disable building rhine-bayes on GHC 9.4.4
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal build all --project-file cabal.9.4.4.project --enable-tests --only-dependencies
- name: Cabal build dependencies
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal build all --enable-tests --only-dependencies
- name: Cabal build packages except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal build all --enable-tests --only-dependencies
cabal build all --project-file cabal.9.4.4.project --enable-tests -fdev
- name: Cabal build packages
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal build all --enable-tests -fdev
- name: Cabal test all except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: |
cabal test all --project-file cabal.9.4.4.project --enable-tests --test-show-details=Always
- name: Cabal test
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: |
cabal test all --enable-tests --test-show-details=Always
build-stack:
Expand Down Expand Up @@ -95,7 +111,14 @@ jobs:
run: nix build .#rhine-examples
- name: Build default package (rhine-gloss)
run: nix build .#rhine-gloss
- name: Build default package (rhine-bayes)
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: nix build .#rhine-bayes
- name: Run tests except rhine-bayes
if: ${{ matrix.ghc == '9.4.4' }}
run: nix develop -c cabal test all --project-file cabal.9.4.4.project
- name: Run tests
if: ${{ matrix.ghc != '9.4.4' }} # Because dependency monad-bayes doesn't support it yet, see https://github.com/tweag/monad-bayes/issues/259
run: nix develop -c cabal test all
# nix flake check breaks on IFD in multi-platform flake https://github.com/NixOS/nix/issues/4265
# - run: nix flake check
4 changes: 3 additions & 1 deletion Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ In a pull request, do the following:
The repository is split into these packages:

* `rhine`: The main library
* `rhine-gloss` (and future packages `rhine-BACKEND`): Libraries connecting `rhine` to [`gloss`](http://hackage.haskell.org/package/gloss) (or some other backend)
* `rhine-gloss`: A library connecting `rhine` to [`gloss`](http://hackage.haskell.org/package/gloss)
* `rhine-bayes`: A library connecting `rhine` to [`monad-bayes`](https://hackage.haskell.org/package/monad-bayes)
* `rhine-examples`: A zoo of examples using the library and different backends.

If you have a contribution, and you are wondering where it should go, you can ask these questions to find the right place:
Expand Down Expand Up @@ -113,3 +114,4 @@ Thanks go to:
* https://github.com/freckletonj
* https://github.com/jmatsushita
* https://github.com/miguel-negrao
* https://github.com/reubenharry/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ would be:
## This repository

* `rhine/`: The main library, which is also mirrored on hackage.
* `rhine-gloss/`: A wrapper library to [gloss](https://hackage.haskell.org/package/gloss), a functional OpenGL library.
* `rhine-gloss/`: A wrapper library to [`gloss`](https://hackage.haskell.org/package/gloss), a functional OpenGL library.
* `rhine-bayes/`: A library for stochastic processes and online machine learning, using [`monad-bayes`](https://hackage.haskell.org/package/monad-bayes).
* `rhine-examples/`: Different examples as a starting point to learn Rhine.

## Documentation
Expand Down
6 changes: 6 additions & 0 deletions cabal.9.4.4.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Workaround because monad-bayes does not build on GHC 9.4.4 yet
packages:
rhine/rhine.cabal
rhine-gloss/rhine-gloss.cabal
rhine-terminal/rhine-terminal.cabal
rhine-examples/rhine-examples.cabal
9 changes: 8 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ outputs = { self, nixpkgs, flake-utils, haskell-flake-utils, flake-compat, ... }
"i686-linux"
];

hpPreOverrides = { pkgs, ... }: self: super:
with pkgs.haskell.lib;
with haskell-flake-utils.lib;
tunePackages pkgs super {
monad-bayes = [ (jailbreakUnbreak pkgs) dontCheck ];
};

name = "rhine";
packageNames = [ "rhine-gloss" "rhine-terminal" "rhine-examples" ];
packageNames = [ "rhine-gloss" "rhine-terminal" "rhine-examples" "rhine-bayes" ];
};
}
6 changes: 6 additions & 0 deletions rhine-bayes/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Revision history for rhine-gloss

## 0.8.1 -- 2023-02-16

* First version. Version numbers follow rhine.
* Introduces basic stochastic processes and Sequential Monte Carlo particle filter
30 changes: 30 additions & 0 deletions rhine-bayes/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2017, Manuel Bärenz

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Manuel Bärenz nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions rhine-bayes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# README

This package connects `rhine` to the [`monad-bayes`](hackage.haskell.org/package/monad-bayes) library for probabilistic programming and inference.
It provides:

* Some standard stochastic processes such as Brownian Motion and Levý processes
* A particle filter inference method called Sequential Monte Carlo

This allows you to do interactive probabilistic (i.e. involving randomness) programs,
and at the same time perform online inference, or realtime machine learning.
An example for this is given in `rhine-bayes/app/Main.hs`,
where inference is performed both on simulated values as well as external input given by the user.
2 changes: 2 additions & 0 deletions rhine-bayes/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
Loading

0 comments on commit 447ac2d

Please sign in to comment.