We are now at the point to choose the features we want to include in our model,
to identify the cars by their driving pattern.
Remember we have the choice of selecting different distances.
We also cleaned the data.
Now we are going to select features using distances sampled over time.
As we know from previous examples, this can be broken down
again into several iterations investigating what works best.
We will go through only a few steps to ensure we
are selecting features that can give us reasonable results.
Let's now head back to our iPython Notebook again.
And, see how we can identify our features.
Take a look at the code in this block.
Here, the get_sampling_intervals method takes the intervals of
time at which we are collecting the data.
We also divide the seconds by 60 to get our answers in minutes.
The method returns an array named sampling intervals.
Let's run this part of the code.
This part does not give you any output, since this merely defines the method.
In this part of the code, we are simply going to see
how many different unique driver ID's there are in our data.
Let's run this part of the code again.
You see we get an output of seven.
We have seven different unique drivers driving around in a given patterns.
Our goal is to look at these patterns and
see if we can distinguish between each driver.
Before we do so.
We want to make sure we have enough data for
the sampling intervals that we have in the data.
In the next line of code we make an array for
all the sampling intervals for all the people.
Next we want to make a scatter-plot of all the sampling intervals.
Let's first make the plot and then we will see what the plot is showing us.
Again, use the play button to run that piece of code.
If everything goes well.
You would get a plot that looks like this.
Let's take some time to investigate what this plot is showing us.
In the x axis we actually have the index of all the data points in our array.
In the y axis we are plotting the inter-sampling time now calculated in minutes.
So what this means is there are some data points that have
inter-sampling times that are quite high in time.
In this case 750 minutes.
In this case around 800 minutes.
However, notice most of the points have very short intersampling times.
In fact if we take about 60 minutes as our
intersampling time we will capture most of the data.
When building your features it is important to make sure
that after selecting the features, you have enough data to do your analysis.
So, by looking at the data, we concluded that a 60 minute or
one hour inter-sampling time will leave us with enough data.
This is an important point.
Whenever we have a time series data.
It is important to know at what intervals we are making these measurements.
Now we come to another question.
How many points or features should we select?
We have actually 24 choices.
If we take one hour inter-sampling times.
The 24 choices being location at the first hour of the day.
Second hour of the day.
Third hour of the day.
And so on and so forth.
Up to the 24th hour of the day.
Let's say we select four features.
That means we will collect the location of a person at four different
hours of the day, and use each of these locations as a feature.
Now, another question rises.
Will we have enough data for the chosen features?