smedegaard

smedegaard

Kalman Filter - implemented in Elixir

Kalman Filter

The Kalman Filter is often used to filter data where you expect some noise. It does so by looking at the previous data point and how certain we are about that data point to decide how much the current measurement should weigh in.

It was formalised by R.E Kalman in 1960 in his paper.

Or as Wikipedia explains it:

The Kalman Filter (…) is an algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement alone…

A Good Explanation

If you are like me the math is not as intuitive as a verbal explanation. A good video on the subject is Lachlan Blackhall’s 2016 talk on the filter and an implementation in Python. I used his implementation as the foundation for my implementation in Elixir.

My Implementation

The algorithm as described in the original paper is recursive. Being a functional language, Elixir lends itself very well to solving problems recursively. So instead of using an agent or GenServer to store state I implemented the filter in a strictly functional manner.

The Result

I’ve barely tested the code, and it comes with no warranties. But if you can find some use for it, it’s licensed under the MIT license and can be found on my Gitlab.

It’s published as a Hex package and the documentation is available on hexdocs.pm.

All contributions and comments are welcome.
Enjoy!

Where Next?

Popular in Announcing Top

zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: GitHub - devonestes/assertions: Helpful a...
New
mindok
What is ContEx? A pure Elixir server-side data plotting/charting library outputting SVG. It has nice barcharts in particular and works g...
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement