Applying Data Mining in Prediction and Classification of Urban Traffic
Applying Data Mining in Prediction and Classification of Urban Traffic
Applying Data Mining in Prediction and Classification of Urban Traffic
675
resulted decision tree can be used in the real world for
classification tasks [7]. This classification can be Apply ss to D to find the splitting criterion
If n split
prediction of new situations and also decision making
Use best split to partition D to D1 and D2
about them. Generally in a decision tree the root is on Build tree(n1,D1,ss)
the top and leaf nodes are situated in the lowest level. Build tree(n2,D2,ss)
A new record enters the root and tested there, related to End if
the result of the test it is sent to one of its branches to
the next test node. This process continues until the There are different methods to choose the break
record reaches a leaf node. The leaf node is the class of (separation) point which make methods of tree creation
that record. All records which reach a same leaf node distinctive. Some of these methods are:
are grouped in a same class; moreover it is important to • Gini Index
know that there is a unique path to a leaf node and that • Entropy
path is actually the rules which have defined to map • CART
the record to that class. • 2Pj
Effectiveness of a tree must be measured after its • Min(Pj)
creation. Employing testing data accuracy percent of • C4.5
each branch can be measured. As it is said each path
from the root to a leaf is actually a rule that should be In Gini Index, function runs for each of parameters
measured for its accuracy. In most cases removing and the parameter with the minimum result will be
inaccurate branches can increase the prediction power chosen as the test field for making new branches. To
of the tree. Removing branches to make the tree more select the divergence point first the training data set (S)
precise is called “Pruning”. must be sorted based on the selected field then the
Now we are going to explain learning and following formula1 must be calculated for each form
prediction of decision trees with a simple example. A of making branches, in other words set S should be
tiny data set is shown in table1 is considered as the divided into two sets S1 and S2. Finally divergence
training data. point which makes I(S) minimum is selected.
Records of this data set have two variable fields: Table 2. training data set sorted by the time.
time of sampling and temperature of environment at Time Temperature Traffic level
sampling time. Class of this data set indicates the
7 20 3
traffic condition at that time which has three values of
7:30 -2 3
1, 2, and 3. Number 1 shows very light traffic, 2 shows
light traffic and 3 shows heavy traffic. As it is said in 8:30 15 2
this example the data set just has two variable fields to 8:30 6 2
simplify the example, however in real world and real 9 15 2
cases so many parameters must be considered 9 -2 1
furthermore the classes can be more than this too. 9:30 -5 1
Creation of a tree or in other words learning and 10 -2 1
pattern discovery, consists of two phases:
• Creation and Growing the tree phase To calculate I(S) for each point a structure like
• Pruning of the tree phase table3 must be created.
General creation algorithm for a binary tree is as it Table 3. Defined structure to calculate I(S)
follows: Class 1 2 3
676
Lower a b c Table6 contains of I(S) test results based on
Higher d e f temperature parameter for data on the right branch.
In table3 the first row is filled by the classes, second Table 6. I(S) result for temperature parameter
row indicates the quantity of samples (records) of each Temperature ≤ -5 ≤ -2 ≤ 6 ≤ 15
class which their selected parameter value is less than I(S) 0.4 0 0.25 0.5
the value which table is based on. At last in the third
row the number of records of each class which their
value is more than the table value is shown. After Minimum result of I(S) in this test is 0 which
creation of this structure we will have: derived from temperature -2, so this temperature will
be the divergence point of the right branch. From the
data in this stage three of records whose class
(2) is 1 after
I (S1) = 1− (a /(a + b + c))2 − (b /(a + b + c))2 − (c /(a + b + c))2
the test go to the left branch; they will make a leaf
node because they are all from a same class, and other
I (S2) =1 − (d /(d + e + f ))2 − (e /(d + e + f ))2 + ( f /(d + e + f ))2 (3) The right
three records are going to the right branch.
branch will become a leaf node too because all its three
I (S) = (a + b + c) /(a + b + c + d + e + f ) ∗ I (S1) + members are from second class. As it is (4)visible all the
(d + e + f ) /(a + b + c + d + e + f ) ∗ I (S2) incoming records are placed in leaf nodes so the tree is
completed now (figure4).
Regarding to these calculations and formulas table4
is made:
677
As we have argued in this paper we have tried to [2] Ruoming Jin, Gagan Agrawal, “Efficient Decision Tree
confirm that classification with decision trees which is Construction on Streaming Data”, KDD 03, 2003, pp. 571-
a data mining method is suitable and useful for traffic 576.
management and prediction of traffic. To proof our
[3] Nicholas R. Howe, Toni M. Rath, and R. Manmatha,
words and to avoid making this matter complicated “Boosted Secision Trees for Word Recognition in
with a simple example we explained the creation of a Handwritten Document Retrieval”, SIGIR, 2005, pp. 377-
decision tree. Moreover, using that example prediction 383.
with decision tree was described. To sum up all we
have mentioned above we have to say that data mining [4] Patrick Knab, Martin Pinzger, and Abraham Bernstein,
can be applied in traffic management and traffic “Predicting Defect Densities in Source Code Files with
prediction, and it can have a great, successful result in Decision Tree Learners”, MSR, 2006, pp. 119-125.
it.
Applying other classification methods and [5] Gehrke, V Ganti, R. Ramakrishnan, and W.-Y. Loh. ,
“BOAT - Optimistic Decision Tree Construction”, Proc.
comparing them is our future work Genetic algorithms ACM SIGMOD’99,Philadephia, USA, 1999, pp. 169-l 80.
and artificial neural networks can be used in traffic
management too. We can also combine some of these [6] J. Gehrke, R. Ramakrishnan, and V. Ganti. , “RainForest
methods and reach more accurate predictions. – A Framework for Fast Decision Tree Construction of Large
Datasets”, Proc. VLDB ‘98, New York, USA, 1998, pp. 416-
5. References 427.
[1] Qiang Ding, Qin Ding, William Perrizo, “Decision Tree [7] F. Seifi, H. Ahmadi, M. Kangavari, “Twins Decision Tree
Classification of Spatial Data StreamsUsing Peano Count Classification: A Sophisticated Approach to Decision Tree
Trees”, 2002, SAC 02: 413-417. Construction”, ICCSA’07, Florida USA, 2007, pp. 337-341.
678