Coder Social home page Coder Social logo

kalmanjs's Introduction

KalmanJS

Javascript based Kalman filter for 1D data. Sometimes you need a simple noise filter without any dependencies; for those cases Kalman.js is perfect.

Kalman filter applied to a noisy dataset.

Background

I wrote two blog posts on explaining Kalman filters in general and applying them on noisy data in particular:

Questions?

Please see the blog post (KalmanJS, Lightweight Javascript Library for Noise filtering) for more information about using this library. Any questions can be posted there as comments.

Installation

The KalmanJS library is a small javascript library and can easily be integrated in to your project manually. Alternatively, the library can be included using npm.

Node (es6)

npm install kalmanjs

import KalmanFilter from 'kalmanjs';

const kf = new KalmanFilter();
kf.filter(2);

Node (es5)

npm install kalmanjs

var KalmanFilter = require('kalmanjs').default;

var kf = new KalmanFilter();
kf.filter(2);

Applying the filter on a dataset

Using the filter is simple. First we create a simple dataset with random noise:

//Generate a simple static dataset
var dataConstant = Array.apply(null, {length: dataSetSize}).map(function() {
  return 4;
});
//Add noise to data
var noisyDataConstant = dataConstant.map(function(v) {
  return v + randn(0, 3);
});

Then we apply the filter iteratively on each data element:

//Apply kalman filter
var kalmanFilter = new KalmanFilter({R: 0.01, Q: 3});

var dataConstantKalman = noisyDataConstant.map(function(v) {
  return kalmanFilter.filter(v);
});

See this blog post for screenshots and more examples.

Reference

This project was part of my research on indoor localization. Please see my paper or this presentation for more information. You can use the following reference if you want to cite my paper:

W. Bulten, A. C. V. Rossum and W. F. G. Haselager, "Human SLAM, Indoor Localisation of Devices and Users," 2016 IEEE First International Conference on Internet-of-Things Design and Implementation (IoTDI), Berlin, 2016, pp. 211-222. doi: 10.1109/IoTDI.2015.19 URL

Or, if you prefer in BibTeX format:

@INPROCEEDINGS{7471364, 
author={W. Bulten and A. C. V. Rossum and W. F. G. Haselager}, 
booktitle={2016 IEEE First International Conference on Internet-of-Things Design and Implementation (IoTDI)}, 
title={Human SLAM, Indoor Localisation of Devices and Users}, 
year={2016}, 
pages={211-222}, 
keywords={RSSI;data privacy;indoor environment;ubiquitous computing;FastSLAM;RSSI update;SLAC algorithm;device RSSI;device indoor localisation;device location;device position;environment noise;human SLAM;nontrivial environment;received signal strength indicator;simultaneous localisation and configuration;smart space;user indoor localisation;user motion data;user privacy;Estimation;Performance evaluation;Privacy;Simultaneous localization and mapping;Privacy;Simultaneous localization and mapping;Smart Homes;Ubiquitous computing;Wireless sensor networks}, 
doi={10.1109/IoTDI.2015.19}, 
month={April},}

Other languages

Kalman filters can be useful in a broad range of projects. Regularly I get questions whether KalmanJS is available in other languages than Javascript and sometimes another library is available. I would encourage searching for it if you require another implementation. For convenience, this repository contains a contrib folder with user-submitted implementations in other languages.

Copyright

Copyright (C) 2015 Wouter Bulten

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

kalmanjs's People

Contributors

wouterbulten avatar sye8 avatar

Watchers

James Cloos avatar

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.