Accord.Net Implementation of weather scenario - hidden-markov-models

I am trying to implement a prediction application for weather based on hidden markov models, using the accord framework. I am having some trouble on how to map the concepts into HMM structures and would like to get some insights. I am starting off with their sample application that can be found here: https://github.com/accord-net/framework/tree/master/Samples/Statistics/Gestures%20(HMMs)
Imagine the following scenario:
I am told every 6 hours what the weather is like: Cloudy, Sunny or Rainy. These would be my states in the framework correct?
Besides that, I have access to results of two different instruments, which are an air humidity meter and a wind speed meter. For simplicity, let's assume that both instruments provide a measure from 0 to 100, with 4 ranges. I would have something like 0, 1, 2 and 3 for observations regarding the humidity (0-25, 26-50, 51-75, 76-100) and the same ranges for wind would have values 4, 5, 6 and 7. These would be my observable values for sequences.
For a couple of days, I store the observations made regarding those two instruments, and based on that I will save the data for future usage, for learning purposes.
One of the questions I have is regarding timing. Since I plan to know states at every 6 hours, does it make sense or is it possible to store observations regarding instruments at a different rate? For example, if I stored observations of the instruments at every hour, I would end up with a 12 element sequence and the corresponding state, something like this for the first 12 hours:
0-4-0-5-0-4-1-7-1-6-0-4 - Cloudy
0-4-0-5-0-4-0-4-0-5-0-4 - Sunny
The 12 element sequence would be:
First hour observation of humidity - observation of wind speed (0-4)
Second hour observation of humidity - observation of wind speed (0-5)
and so on...
Should I, besides observation sequences and states, use labels for each of the instruments? Something like this:
0-0-0-1-1-0 - Humidity - Cloudy
4-5-4-4-5-4 - Wind Sp - Sunny
0-0-0-1-1-0 - Humidity - Cloudy
4-5-4-4-5-4 - Wind Sp - Sunny
The labels would be the instruments that were being measured, the sequences would be the observed values, and the states would be the state at the end of each 6 hours.
With this, I would like to be able to feed this information back to the model and predict the next state. Am I approaching this problem correctly? Would I be able to do what I need like this?
Thank you.

Related

Using each individual time step of the input as feature in a RNN

Suppose I want to create a RNN-model that will learn to predict 24 hours into the future, given 24 hours of the past. Traditionally, if I want to create such a multistep model, I would have an input like a time series (24 hours long) with one feature e.g. temperature. What if I regard each time step of the 24 hours in the time series as an individual feature so that I have 24 features with one input to predict 24 features with one output. Would such a model be superior to a traditional model?
If you always have a fixed number of inputs (like 24 hours of temperatures) it might be a good way to not use a RNN but instead go with a traditional feed forward structure. The main reason why one uses RNNs is that they can handle time series of variable length, so for all applications that need this property they are pretty much the only choice. In your case, a feed forward architecture will probably work fine, but it should not be that difficult to just try out both.

How can I combine two time-series datasets with different time-steps?

I want to train a Multivariate LSTM model by using data from 2 datasets MIMIC-1.0 and MIMIC-3. The problem is that the vital signs recorded in the first data set is minute by minute while in MIMIC-III the data is recorded hourly. There is a interval difference between recording of data in both data sets.
I want to predict diagnosis from the vital signs by giving streams/sequences of vital signs to my model every 5 minutes. How can I merge both data sets for my model?
You need to be able to find a common field using which you can do a merge. For e.g. patient_ids or it's like. You can do the same with ICU episode identifiers. It's a been a while since I've worked on the MIMIC dataset to recall exactly what those fields were.
Dataset
Granularity
Subsampling for 5-minutely
MIMIC-I
Minutely
Subsample every 5th reading
MIMIC-III
Hourly
Interpolate the 10 5-minutely readings between each pair of consecutive hourly readings
The interpolation method you choose to get the between hour readings could be as simple as forward-filling the last value. If the readings are more volatile, a more complex method may be appropriate.

HOW to train LSTM for Multiple time series data - both for Univariate and Multivariate scenario?

I have data for hundreds of devices(pardon me, I am not specifying much detail about device and data recorded for devices). For each device, data is recorded per hour basis.
Data recorded are of 25 dimensions.
I have few prediction tasks
time series forecasting
where I am using LSTM. As because I have hundreds of devices, and each device is a time series(multivariate data), so all total my data is a Multiple time series with multivariate data.
To deal with multiple time series - my first approach is to concatenate data one after another and treat them as one time series (it can be both uni variate or multi variate) and apply LSTM and train my LSTM model.
But by this above approach(by concatenating time series data), actually I am loosing my time property of my data, so I need a better approach.
Please suggest some ideas, or blog posts.
Kindly don't confuse with Multiple time series with Multi variate time series data.
You may consider a One-fits-all model or Seq2Seq as e.g. this Google paper suggests. The approach works as follows:
Let us assume that you wanna make a 1-day ahead forecast (24 values) and you are using last 7 days (7 * 24 = 168 values) as input.
In time series analysis data is time dependent, such that you need a validation strategy that considers this time dependence, e.g. by rolling forecast approach. Separate hold-out data for testing your final trained model.
In the first step you will generate out of your many time series 168 + 24 slices (see the Google paper for an image). The x input will have length 168 and the y input 24. Use all of your generated slices for training the LSTM/GRU network and finally do prediction on your hold-out set.
Good papers on this issue:
Foundations of Sequence-to-Sequence Modeling for Time Series
Deep and Confident Prediction for Time Series at Uber
more
Kaggle Winning Solution
Kaggle Web Traffic Time Series Forecasting
List is not comprehensive, but you can use it as a starting point.

Discrepancy in Azure SQL DTU reporting?

Refer to DTU graph below.
• Both graphs show DTU consumption for the same period, but captured at different times.
• Graph on the left was captured minutes after DTU-consuming event;
• Graph on the right was captured some 19 hrs after.
Why are the two graphs different?
The difference is in the scale of the data points: your graph shows the same scale on the bottom (likely through use of the 'custom' view of the DTU percentage and other metrics) but the granularity of the data has changed. This is a similar question - the granularity for the last hour of data is 5 seconds, whereas the scale for multiple hours is 5 minutes - and the average of the 100 datapoints is the value for that 5 minute data point.
I'll verify this with the engineering team and update if it is inaccurate.

Kinect normalize depth

I have some Kinect data of somebody standing (reasonably) still and performing sets of punches. I am given it in the format of an x,y,z co-ordinate for each joint of which they are 20, so I have 60 data points per frame.
I'm trying to perform a classification task on the punches however I'm having some problems normalising my data. As you can see from the graph there are sections with much higher 'amplitude' than the others, my belief is that this is due to how close that person was to the kinect sensor when the readings were taken. (The graph is actually the first principal coefficient obtained by PCA for each frame, multiple sequences of the same punch are strung together in this graph)
Looking back at the data files it looks like those that are 'out' have a z co-ordinate (depth from sensor) of ~2.7 where as the others tent to hover around 3.3-3.6.
How can I perform a normalization with the depth values to make them closer to each other for each sequence? I've already tried differentiation to get the velocity, although it helps to normalise the output actually ends up too similar and makes it very hard to classify.
Edit: I should mention I am already using a normalization method by subtracting the hip position from each joint in an attempt to make the co-ordinates relative.
The Kinect can output some strange values when the person that is tracked is standing near the edges of the view of the Kinect. I would either completly ignore these data or just replace the data with an average of the previous 2 and next 2.
For example:
1,2,1,12,1,2,3
Replace 12 with (2 + 1 + 1 + 2) / 4 = 1.5
You can basically do this with the whole array of values you have, this way you have a more normalised line/graph.
You can also use the clippedEdges value to determine if one or more joints is outside the view.