Git Product home page Git Product logo

particlefilter's Introduction

SMCPF

This repository contains a templated header-only dependency-free Particle Filter library written in C++.

Requirements

The library is written in C++17 and thus requires a C++17 compatible compiler, i.e. GCC 7 or newer/ Clang 5 or newer. Some parts of the library can be configured to run in parallel by setting a preprocessor constant PF_USE_PARALLEL before including the header particlefilter.hh:

#define PF_USE_PARALLEL
#include <particlefilter.hh>

This uses the C++ header <execution> which itself depends on Intel's TBB Library. If the constant PF_USE_PARALLEL is not set, however, the library itself is completely dependency-free (i.e. depends only on the C++ standard library).

Running the examples

The repository contains three examples located in the folder apps. They can be easily compiled using CMake. Example 2 and 3 depend on third-party libraries. The first example can be used as-is.

Example 1 (Simple nonlinear non-Gaussian example)

The first example does not have any dependencies. To compile and run it, first clone the repository

git clone https://github.com/nilsfriess/ParticleFilter.git

and set up the CMake project. In the root directory of the cloned repository, run

cmake -S . -B build

to generate the build files in the directory build. After that, cd into the build directory and compile the example by running

make example1

The executable is saved to the folder build/apps. Before executing it, we have to provide a .csv file containing the observations that the particle filter can then use. In the folder data/example1 a Python script to generate test data is provided. A file that already contains sample observations is also given there. The program expects the file to be located in the same folder from which it is called, so we copy the observation file obs_ex1.csv to the build folder (assuming we are still inside the build folder)

cp ../data/example1/obs_ex1.csv .

We can now run the program

./apps/example1

The program writes its results to a file output_ex1.csv. A few exemplar plots of showing the initial data and the simulated results can be found in the folder data/example1, e.g.

Exemplar run using 100 particles

Examples 2 and 3 (Lotka-Volterra equations, Predator-Prey model)

Setting up and running these examples is similar to above. However, these examples both depend on third-party libraries that both programs get linked against, namely

Additionally, the header-only libraries StatsLib and GCEM are required. They are both included in the apps/include folder.

After installing the missing dependencies, the programs can be compiled as above by running make example2 and make example3 inside the build directory. Again, an input file containing the observations has to be provided. A sample file is provided as obs.csv.

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.