Skip to content

Unofficial Implementation of RobustPeriod: Time-Frequency Mining for Robust Multiple Periodicities Detection

Notifications You must be signed in to change notification settings

ariaghora/robust-period

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial Implementation of RobustPeriod: Time-Frequency Mining for Robust Multiple Periodicities Detection.

Please note that I could not fully replicate the paper, especially the optimization part. In fact, I used a different optimization method rather than the said ADMM (the timing result will be greatly different from ones presented in the paper). It is either the details in paper are insufficient or my understanding was lacking. I welcome any contribution.

Installation

pip install --upgrade git+https://github.com/ariaghora/robust-period.git

Usage example

import numpy as np
import matplotlib.pyplot as plt
from robustperiod import robust_period, robust_period_full, plot_robust_period
from robustperiod.utils import sinewave, triangle
from statsmodels.datasets.co2.data import load_pandas

m = 1000
y1 = sinewave(m, 20, 1)
y2 = sinewave(m, 50, 1)
y3 = sinewave(m, 100, 1)
tri = triangle(m, 10)
noise = np.random.normal(0, 0.1, m)
y = y1+y2+y3+tri+noise
y[m // 2] += 10  # sudden spike

plt.plot(y)
plt.title('Dummy dataset')
plt.show()

lmb = 1e+6
c = 2
num_wavelets = 8
zeta = 1.345

periods, W, bivar, periodograms, p_vals, ACF = robust_period_full(
    y, 'db10', num_wavelets, lmb, c, zeta)
plot_robust_period(periods, W, bivar, periodograms, p_vals, ACF)

Input

Output

Please note that I hacked some parts of result presentation code so the results match the paper as close as possible.

About

Unofficial Implementation of RobustPeriod: Time-Frequency Mining for Robust Multiple Periodicities Detection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages