0
$\begingroup$

I am working on traffic data analytics, where I need to predict the number of vehicles passing through each traffic junctions.

Shape of my dataset is something like this :

Road A-Junction B-Junction   Date       Hour  CarCount
X         a          b      2000-06-09   7       10
Y         b          c      2000-06-09   7       20
  • Road – this is the road name (for instance M25 or A3).
  • A-Junction – The road name of the start junction of the link
  • B-Junction – The road name of the end junction of the link
  • Hour - time in 24 hour format
  • CarCount - actual car count

I want to find out the correlation between A-Junction and B-Junction. Or in simple words , let's say in the given example for road X and Y , can we correlate between a , b and c roads ?

$\endgroup$
  • $\begingroup$ Would you also have the data for a, b, c in the Road column? I feel that the data might need to be slightly restructured to get the insight you want, but the example seems a bit unclear right now. So, for both Road X and Y, each road would be intersecting with road a, b, c, etc.? $\endgroup$ – The Lyrist Jun 11 '18 at 17:47
  • $\begingroup$ Hi @TheLyrist : Road column will contain a , b ,c . $\endgroup$ – DukeLover Jun 11 '18 at 17:50
1
$\begingroup$

Sorry to be posting as an answer, but the comment section doesn't allow me to place preformatted text. Using your example above, is the graphic representation similar to the one below?

X=== a -10- b ---- c
     |      |      |
     |      |      |
Y=== a ---- b -20- c

So you are wondering if the 10 (Road X, junction a - b) and 20 (Road Y, junction b - c) are correlated?


Update: Thank you for confirming. Sorry I am totally not in the traffic domain, but I will give my 2 cents given the little I know about ML in general.

I assume that you want to understand the correlation between 10 and 20 to help you build a prediction model. If you unpack the question a bit, I think perhaps we can restructure the question to.

(If you are simply looking at all the available combination of and their correlations, it will probably take forever, and it might not be as actionable unless you normalize the information into your prediction model)

Label = number of cars

Features = date, Road, junction a, junction b, [Number of cars in nearby intersections] + other related features

If it is the case, perhaps we can try to normalize the data to the Road, junction a, b through feature engineering.

Expanding on the diagram

W z-4--a --6- b --8- c
  |    |     |      |        
  3    20    28     9 
  |    |     |      |
X-z-1- a -10-b -19- c
       |     |      |
       15    12     7 
       |     |      |
Y--10- a -14-b -20- c

For Road X, junction a - b, we have 10 as the Label

Reconsider the nearby roads as:

level 0 -- Immediate connecting segments

level 1 -- Immediate connecting segments to level 0 roads

level 2 -- Immediate connecting segments to level 1 roads (if required)

W z-1--a -1-- b --1- c
  |    |     |      |        
  1    0     0      1 
  |    |     |      |
X-z-0- a -**-b -0- c
       |     |      |
       0     0      1 
       |     |      |
Y--1-- a -1 -b --1- c
  1. You will know best how further away you want your output to be counted. you just create the necessary number of features to accommodate that. Perhaps distance to the junction in question, etc. Whatever makes more sense for your model
  2. You will know best the necessary granularity. To start, perhaps you can count the number of level 0 and 1, recording each with the average in your model, etc.

Example:

Road     Jun A     Jun B    L0 Connection  L0 Avg Car    L1 Connection   L1 Avg
   X         a         b                6        17.5                9    [you get the idea]
  1. Not sure how to handle bidirectional traffic. does the order of a and b imply direction already?
  2. Your model will probably take care of the influence of your level 0 and level 1 (and level 2, etc.) connections.

Sorry for the long-winded response; hopefully it helps brainstorm some ways to tackle your problem.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Hi @The Lyrist , yes you are absolutely correct. +1 for the diagram . $\endgroup$ – DukeLover Jun 11 '18 at 18:11
  • $\begingroup$ Thanks @DukeLover, I have updated my response. Hope it helps! $\endgroup$ – The Lyrist Jun 11 '18 at 19:04

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.