GithubHelp home page GithubHelp logo

dwervin / pyhampel Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 0.0 306 KB

Implementation of Hampel filter in Python, including multiprocessor support, and interactive plotting with plotly and IPywidgets.

License: MIT License

Python 100.00%
filtering hampel interactive-plots mad median-absolute-deviation median-filter multiprocessor-programming outlier rolling-median

pyhampel's People

Contributors

dwervin avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

pyhampel's Issues

suggestion: orders of magnitude speed-up using Numba JIT

In my machine, the following demonstrates more than 100x speed-up.

import pandas as pd
import numpy as np
import timeit
import hampel # assumes `pip install hampel`

def much_faster_hampel(series, window_length, threshold=3):
  # Please refer to [1] for `hampel_filter_forloop_numba` implementation.
  # [1] https://gist.github.com/adrianomitre/2ced5544421eca031180782cc30798af 
  result, outlier_indices = hampel_filter_forloop_numba(series.values, window_length, threshold)
  result[outlier_indices] = np.nan
  return result

ts_len = 2**8
win_sz = 7

ts = pd.Series(np.random.rand(ts_len))

# causes JIT compilation
much_faster_hampel(ts, win_sz)

timeit.timeit(lambda: hampel.hampel(ts, win_sz), number=100)
timeit.timeit(lambda: much_faster_hampel(ts, win_sz), number=100)

Please refer to this gist for hampel_filter_forloop_numba implementation.

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.