Hi Sean,

Thanks for the reply. I did run up a sample database with some time weighted 
samples and unfortunately the moving average ignores the time that the data is 
stored so doesn't help.

I also had a look at pull 6113 and there is a lot of code in a language & 
platform I'm unfamiliar with, and its difficult to work out what routines to 

There are 2 ways to implement a time weighted average, firstly to interpolate 
like how openTSDB does it, which for some IoT sensor scenarios is useful if 
there is lost data or data resolution needs to be more granular. However the 
other common IoT scenario I'm trying to solve for is when the sensor reacts to 
changes - a better model as it reduces network bandwidth, storage and CPU usage 
as well as increases battery life for remote sensors compared to regular time 
interval data collection.

To implement a time weighted average from irregular time samples shouldn't be 
that tough, I have it implemented previously at the application layer, 
1) You want the <window> parameter in the moving average query function to be 
time based, not number of points. 
2) Each sample is weighted by the time delta between itself and the previous 
sample as a proportion to the time window size.
3) Add up these weighted samples to get the average.
4) Would also work as continuous query.

Keep up the good work on influxdb - I like the approach you have taken. I will 
be using it for my IoT solution that will be open sourced soon although I need 
to find an alternative solution to the time weighted average at some point. 
Hopefully you can see the benefit in a time weighted average function for a 
time series database targeted for IoT scenarios - I would have a try at writing 
this function but would need help with Go & your platform code.


Remember to include the version number!
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to influxdb+unsubscr...@googlegroups.com.
To post to this group, send email to influxdb@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to