I have a dataset that contains occurrences of the Kettle in a single-occupancy house for the duration of a month. In this dataset, ‘ts’ column indicates the unix-timestamp (this can be converted to date and time) that the kettle was turned ON; and the ‘second’ column indicates the duration in seconds that the kettle was ON.

My requirement - Find routines in the data, evaluate their periodicities and variabilities. For instance, a routine could be “breakfast”, its periodicity might be every day at a certain time and variability might be a time window within the routine occurred.

What I've tried and I'm a bit unsure of - I plotted the autocorrelation of the virgin signal with different amounts of lag and found there was no significant correlation with any of its lagged versions. But on looking at the plot of this signal, I see there are peaks every day- morning time. Also, I've tried autocorrelation on the denoised(denoised using KNN) version and the under-sampled versions(retaining just first and last samples for each day of the month) and found that the denoised signal also isn't correlated with its lagged versions, but the under-sampled signal is.

I'm unsure first of all about how to find periodicity of a signal like this, and if the autocorrelation plot lets us make any conclusions about periodicity.

from statsmodels.tsa.stattools import acf
from statsmodels.graphics.tsaplots import plot_acf

# Compute the acf array 
acf_array = acf(q4['seconds'])

# Plot the acf function

More code showing what I've read can be found at - this link. enter image description here


One option could be applying the Fourier transform which transforms time to the frequency domain. It is often easy to find recurring patterns when signals are represented in the frequency domain.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.