Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A small library implementing the principle of Kalman filters, without any dependencies, to filter out noise in 1D systems.
Javascript based Kalman filter for 1D data. Sometimes you need a simple noise filter without any dependencies; for those cases Kalman.js is perfect.
I wrote two blog posts on explaining Kalman filters in general and applying them on noisy data in particular:
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.
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.
Include the kalman.js
or kalman.min.js
from the dist
folder on your webpage, the filter can then be used directly.
<script src="kalman.min.js" type="text/javascript"></script>
<script type="text/javascript">
var kf = new KalmanFilter();
console.log(kf.filter(3));
console.log(kf.filter(2));
console.log(kf.filter(1));
</script>
Should output (with default settings):
3
2.3333333333333335
1.5000000000000002
npm install kalmanjs
import KalmanFilter from 'kalmanjs';
const kf = new KalmanFilter();
console.log(kf.filter(3));
console.log(kf.filter(2));
console.log(kf.filter(1));
Should output (with default settings):
3
2.3333333333333335
1.5000000000000002
npm install kalmanjs
var KalmanFilter = require('kalmanjs');
var kf = new KalmanFilter();
console.log(kf.filter(3));
console.log(kf.filter(2));
console.log(kf.filter(1));
Should output (with default settings):
3
2.3333333333333335
1.5000000000000002
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.
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},}
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.
MIT License
Copyright (c) 2018 Wouter Bulten
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A small library implementing the principle of Kalman filters, without any dependencies, to filter out noise in 1D systems.
We found that kalmanjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.