<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>PROBLEM OF DATA ANALYSIS AND FORECASTING USING DECISION TREES METHOD</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>T.I. Lytvynenko</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Taras Shevchenko National University of Kiyv, Faculty of Cybernetics, Department of Applied Statistics</institution>
          ,
          <addr-line>Academician Glushkov Avenue, 4D, 03680, Kyiv, Ukraine. Phone: (093) 391 1509</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2016</year>
      </pub-date>
      <fpage>220</fpage>
      <lpage>226</lpage>
      <abstract>
        <p>Розглянуто застосування методу дерев рішень до проблеми аналізу даних та прогнозування. Обробка даних базується на реальних спостереженнях рівня продажу груп товарів протягом 2006-2009 рр. R (мова програмування та програмне середовище) застосовано як інструмент для статистичних обчислень. Робота містить порівняння з загальновідомими підходами та можливі шляхи покращення точності отриманих висновків. Ключові слова: інтелектуальний аналіз даних, прогнозування, прийняття рішень, дерева рішень, мова R. Рассмотрено применение метода деревья решений к проблеме анализа данных и прогнозирования. Обработка данных базируется на реальных наблюдениях уровня продаж групп товаров на протяжении 2006-2009 гг. R (язык программирования и программная среда) используется в качестве инструмента для статистических вычислений. Работа содержит сравнение с общеизвестными подходами и возможные пути повышения точности полученных результатов. Ключевые слова: интеллектуальный анализ данных, прогнозирование, принятие решений, деревья решений, язык R. This study describes an application of the decision tree approach to the problem of data analysis and forecasting. Data processing bases on the real observations that represent sales level in the period between 2006 and 2009. R (programming language and software environment) is used as a tool for statistical computing. Paper includes comparison of the method with well-known approaches and solutions in order to improve accuracy of the gained consequences.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Problem formalization</p>
      <p>
        As is stated in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], the predictive methods make forecast based on the statistical relationships between input
columns in a dataset. The major idea is to interpret current data in a proper way in order to obtain the objective laws.
Input data is represented by a dataset. Three basic categories are considered to be processed: product name, sales and
period under consideration. The predictive approaches are applied to a dataset to obtain a probable prognosis for the
future period. A decision tree is a drawing [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], consisting of lines and boxes, that shows the different choices which
are available to people before they make a decision, and the possible results of these choices. Decision trees [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] are
produced by algorithms that identify various ways of splitting a data set into branch-like segments. These segments
form an inverted decision tree that originates with a root node at the top of the tree. Graphically a decision tree looks
like a flowchart-like structure in which each internal node represents a “test” on an attribute [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Commonly a
decision tree consists of three types of nodes: decision nodes, chance nodes and end nodes. Classification and
regression trees were originally introduces and investigated by Breiman [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] in 1984. As asserted in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], the main idea
behind tree methods is to recursively partition the data into smaller and smaller strata in order to improve the fit as
best as possible. Tree models where the target variable can take a finite set of values are called classification trees.
Decision trees where the target variable can take continuous values (typically real numbers) are called regression
trees [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Classification trees [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] are designed for dependent variables that take a finite number of unordered
values, with prediction error measured in terms of misclassification cost. Regression trees are for dependent
variables that take continuous or ordered discrete values, with prediction error typically measured by the squared
difference between the observed and predicted values [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In this study input data is represented by the table
including such categories as product name (or number, to facilitate), month (and year) and sales level (the number of
sold units). One of the goals of this research is to investigate seasonal dependencies, that is why primary attention is
paid to months, though year is also significant. The period under consideration is from January, 2006, to August,
2015. Statistical dataset may include products, which were not sold at all during the whole period. It is worth noting,
that results, based on the real observations, may differ from the ones, obtained by the usage of pseudorandom
number generators. The presence of the “zero sales level products”, mentioned above, is one of the most substantial
factors, which presupposes this phenomenon.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Existing approaches review</title>
      <p>
        The problem of data analysis and prediction is deeply investigated; nevertheless, a lot of questions are still open.
Numerous methods are listed in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], there they are divided into two principal groups: statistical and structural methods
correspondingly.
      </p>
      <p>
        The first group includes predictive models, which leverages statistics to predict outcomes [
        <xref ref-type="bibr" rid="ref1 ref11">1, 11</xref>
        ] – ultimate
model is represented by analytical formula. The second group consists of step-by-step methods, where terminate
algorithm looks like a definite set of stages. Widely used up-to-date statistical approaches are represented by linear
regression, exponential smoothing, ARIMA (autoregressive integrated moving average), GARCH ( generalized
autoregressive conditional heteroskedasticity). Concerning commercial packages, primary attention in this field is paid
to ARIMA, that implemented in such software solutions as SAS, SPSS, Mathematica, Matlab, Microsoft SQL Server
(Time Series Algorithm).
      </p>
      <p>
        The second group includes neural networks, Markov chains method and CART [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Generally, their advantages
and disadvantages are summarized in pic. 1.
      </p>
      <p>Class of methods</p>
      <p>Statistical</p>
      <sec id="sec-2-1">
        <title>Structural</title>
        <p>•
•
•
•
+</p>
      </sec>
      <sec id="sec-2-2">
        <title>Simplicity of implementation</title>
      </sec>
      <sec id="sec-2-3">
        <title>Flexibility</title>
      </sec>
      <sec id="sec-2-4">
        <title>Parallel computing Combination of categorical and numerical</title>
        <p>•
•
•
•
•</p>
      </sec>
      <sec id="sec-2-5">
        <title>Difficult to define the dependency between variables</title>
      </sec>
      <sec id="sec-2-6">
        <title>Difficult to define unknown parameters</title>
      </sec>
      <sec id="sec-2-7">
        <title>Strict dataset prerequisites</title>
      </sec>
      <sec id="sec-2-8">
        <title>Difficult learning algorithm choice</title>
      </sec>
      <sec id="sec-2-9">
        <title>Stopping criteria</title>
      </sec>
      <sec id="sec-2-10">
        <title>Picture 1. Comparison of statistic al and structural methods</title>
        <p>
          In [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] CART approach was chosen for the further investigations. In addition to R programming, IBM SPSS
Statistics was applied to the input data. This software package (originally Statistical Package for the Social Sciences by
SPSS Inc.) is adapted to health sciences and marketing, so, according to the character of input data, is appropriate to
predictive data mining techniques. SPSS is beneficial for managerial decision-making process due to its
businessoriented construction.
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Decision tree algorithm</title>
      <p>
        In CART (classification and regression tree) data are handled in their raw form; no binning is required or
recommended [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. CART splitting rules [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] are represented by the following construction: an instance goes left if
CONDITION, otherwise goes right.
      </p>
      <sec id="sec-3-1">
        <title>General algorithm includes the following steps:</title>
        <p>1) Start at the root node;
2) To each element, apply a condition split;
3) If a stopping criterion is reached, exit. Otherwise, apply step 2 to each child node in turn.</p>
        <p>
          CART is chosen due to its obvious advantages [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. The model is having a single meaning; the process is well-defined
and stepwise. This approach is clear for both understanding and implementation. Decision trees are simple
to understand and interpret. In [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ] it is noticed, that decision trees require relatively little effort from users for
data preparation. Moreover, it is worth noting, this approach is also able to cope with different types of data.
According to our problem formalization, observations combine categorical (months) and numerical (sales level) data.
As is stated in [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ], CART belongs to the most substantial data mining algorithms. Tree models where the target
variable can take a finite set of values are called classification trees [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. Decision trees where the target variable
can take continuous values (typically real numbers) are called regression trees [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. According to [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ], the basic
algorithm for decision tree is the greedy algorithm that constructs decision trees in a top-down recursive
divide-and-conquer manner. It takes a subset of data as input and evaluate all possible splits. The best split decision
is chosen to partition the data in two subsets and the method is called recursively. The best split decision is
traditionally the split with the highest information gain. He algorithm stops when the stop conditions are met [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. As
is in [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] stated, in machine learning and information theory, information gain is a synonym for Kullback-Leibler
divergence, though in the context of decision trees, the term is sometimes used synonymously with mutual
information, which is the expectation value of the Kullback-Leibler divergence of a conditional probability
distribution. Detailed information concerning information gain`s computation is provided by [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]. The number of
stopping conditions is listed in [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ]:
• All the samples belong to the same class, i.e. have the same label since the sample is already "pure";
• Stop if most of the points are already of the same class. This is a generalization of the first approach, with some
error threshold;
• There are no remaining attributes on which the samples may be further partitioned;
• There are no samples for the branch test attribute.
        </p>
        <p>Building of the both types is covered by the usage of programming language and environment R. In this paper
open-source user interface RStudio is applied to the input data.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Classification algorithm in R</title>
      <p>
        R language provides a great range of packages for data processing. Two of them – rpart and party are
the most appropriate for the given problem. Rpart (recursive partitioning and regression trees) is used for
classification by decision trees and generation of regression trees [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. According to [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], the rpart programs build
classification or regression models of a very general structure using a two stage procedure; the resulting models can
be represented as binary trees. The tree is built by the following process: first the single variable is found which
best splits the data into two groups ('best' is defined in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]). The data is separated, and then this process is applied
separately to each sub-group, and so on recursively until the subgroups either reach a minimum size (5 for this
data) or until no improvement can be made. The resultant model is, with certainty, too complex, and the
question arises as it does with all stepwise procedures of when to stop. The second stage of the procedure consists
of using cross-validation to trim back the full tree. To grow a tree, we use [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] command rpart (formula, data=,
method=, control=).
      </p>
    </sec>
    <sec id="sec-5">
      <title>Practical implementation and analysis of the outcome</title>
      <p>Firstly, the data concerning just the one position to be processed. It is represented by the following dataset
(fragmented in the pic. 2). ProductN is the number of a sales position. Period is the month under consideration. In this
particular case dataset covers the period between the years 2006 and 2009. Sales is the number of units, sold during the
corresponding month.</p>
      <sec id="sec-5-1">
        <title>Picture 2. Input dataset example</title>
        <p>The following R libraries are used:
•
•
•
•
library(rpart)
library(rpart.plot)
library(RColorBrewer)
library(rattle)</p>
      </sec>
      <sec id="sec-5-2">
        <title>Output is the following (pic. 3):</title>
      </sec>
      <sec id="sec-5-3">
        <title>Picture 3. Outcome binary tree Classification procedure creates the binary tree of possible outcomes, the figures in the nodes represent the number of elements in a dataset, which associate with with alternative, and the percentage of the corresponding observations. According to this tree, the structure of ProductN sales is (pic. 4):</title>
        <p>Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec</p>
      </sec>
      <sec id="sec-5-4">
        <title>Picture 4. Seasonal table of the sales level</title>
        <p>Tree states, that April, November and December belong to the node with the highest sales level (approximately
23000 units per month), though during 2006 their sales made up 18771, 19139 and 15164 respectively. That is why it is
worth noting, that decision trees method takes into account not only figures, but also tendencies. Then, application of
the approach to the several product positions is leading to the following outcomes (pic. 5):</p>
      </sec>
      <sec id="sec-5-5">
        <title>Picture 5. Binary tree outcome for a multi-dimensional case Pic. 6 illustrates the general structure of a decision tree and Picture R is a result of user-oriented transformation.</title>
      </sec>
      <sec id="sec-5-6">
        <title>Picture 6. Outcome decision tree</title>
        <p>It is evident from the binary tree, that computing accuracy is substantially worse than in the previous case.
Discrepancy between price levels of different products presupposes this phenomenon. Experiments demonstrate that the
same situation takes place in case of far greater number of products. Accuracy falls exponentially with the rise of
dimension.
That is why general results of the experimental modelling are the following. Major advantages of the method
are observed: it simplifies decision-making process because outcome is represented by the binary tree – clear
and easy to interpret. On the contrary, simplicity influences the quality, because not all data types may be represented
efficiently as a binary structure. CART uses classification and regression principles as a basis (as many
software solutions, particularly Microsoft SQL Server Time Series). According to the experimental data, the
common drawback of these approaches is their vulnerability in case of existence of abnormal external factors (e. g.
World Economic Crisis 2008 for the the data used above). Binary structure is unable to differ mathematically
abnormal periods (which may be detected through statistical tests) from practically abnormal ones (caused by
external factors). In addition to this, decision tree approach is much more efficient in case of “one-product-position”
computations because two branches split may be not structural enough to classify several products, those price
varies substantially. Analyzing just one product position prices, decision tree approach achieves the accuracy
of a traditional regression method, being simultaneously easier to use and interpret (especially for non-professionals).
In future paper I am intended to apply SPSS software package to the same datasets in order to compare results
and accuracy.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Consequences</title>
      <p>This work provides the description, explanation and result of the decision tree method and its application to the
real observations, using R programming language. It is compared with traditional approaches in order to define
common features and drawbacks. Effectiveness of the method checked experimentally. For all methods, both traditional
and prospective, computing accuracy is highly dependable on complexity, structure and quality of an input dataset. The
most significant disadvantage is vulnerability when it comes to external factors influence. It may be resolved by
combining two or more methods and using of machine learning techniques. These alternatives will be presented and
practically implemented in the future papers.</p>
      <p>LYTVYNENKO, T., PANCHENKO, T., REDKO,V. (pre-print) Sales Forecasting using Data Mining Methods. Bulletin of Taras
Information about author:
Lytvynenko Tetiana,
fourth year student at Taras Shevchenko National University of Kiyv,
Faculty of Cybernetics, Department of Applied Statistics.
1 Ukrainian paper.
http://orcid.org/0000-0003-1662-3379.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1. Shevchenko National University of Kyiv,
          <source>Series Physics &amp; Mathematics.</source>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>CHUGUEVA</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          (
          <year>2012</year>
          )
          <article-title>Compositional Methods for Software Systems Specification and Verification (PhD Thesis)</article-title>
          .
          <source>Kyiv</source>
          .
          <volume>177</volume>
          p.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>TreePlan</given-names>
            <surname>Software</surname>
          </string-name>
          .
          <article-title>Introduction to Decision Trees</article-title>
          . Available from: &lt;http://treeplan.com/ chapters/introduction-to
          <article-title>-decision-trees</article-title>
          .
          <source>pdf&gt;.</source>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>4. Cambridge Dictionaries Online: English Dictionary. Available from: &lt;http://dictionary. cambridge.org/dictionary/english/decision-tree&gt;.</mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>SAS</given-names>
            <surname>Institute. Decision Trees - What Are</surname>
          </string-name>
          They? Available from: &lt;http://support.sas.com/ publishing/pubcat/chaps/57587.pdf&gt;.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>PANDEY</surname>
            ,
            <given-names>A.K.</given-names>
          </string-name>
          and
          <string-name>
            <surname>GOYAL</surname>
            ,
            <given-names>N.K.</given-names>
          </string-name>
          (
          <year>2013</year>
          )
          <article-title>Early Software Reliability Prediction: A Fuzzy Logic Approach</article-title>
          . New Dehli: Springer India.
          <volume>153</volume>
          p.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>BREIMAN</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>FRIEDMAN</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , STONE,
          <string-name>
            <surname>C.J. and OLSHEN</surname>
          </string-name>
          ,
          <string-name>
            <surname>R.A.</surname>
          </string-name>
          (
          <year>1984</year>
          )
          <article-title>Classification and Regression Trees</article-title>
          .
          <source>Chapman and Hall/CRC</source>
          . 368 p.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>GORDON</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          (
          <year>2013</year>
          )
          <article-title>Using Classification and Regression Trees (CART) in SAS Enterprise Miner For Applications in Public Health</article-title>
          .
          <source>SAS Global Forum 2013. Paper 089-2013</source>
          . 8 p.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9. JOPP F.,
          <string-name>
            <surname>REUTER</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          <article-title>and</article-title>
          <string-name>
            <surname>BRECKLING</surname>
          </string-name>
          , B., Eds. (
          <year>2011</year>
          )
          <article-title>Modelling Complex Ecological Dynamics: An Introduction into Ecological Modelling for Students</article-title>
          ,
          <source>Teachers &amp; Scientists</source>
          . Springer-Verlag Berlin Heidelberg. 397 p.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. LOH W.-Y. (
          <year>2011</year>
          )
          <article-title>Classification and regression trees</article-title>
          .
          <source>WIREs Data Mining and Knowledge Discovery</source>
          , Vol.
          <volume>1</volume>
          . pp.
          <fpage>14</fpage>
          -
          <lpage>23</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>GEISSER</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          (
          <year>1993</year>
          )
          <article-title>Predictive inference: an introduction</article-title>
          .
          <source>Monographs on Statistics and Applied Probability</source>
          . NY, Chapman &amp; Hall. 265 p.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>WU</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>KUMAR</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>QUINLAN</surname>
          </string-name>
          ,
          <string-name>
            <surname>J.R.</surname>
          </string-name>
          ,
          <string-name>
            <surname>GHOSH</surname>
          </string-name>
          , J., et al. (
          <year>2008</year>
          )
          <article-title>Top 10 algorithms in data mining</article-title>
          .
          <source>Knowledge and Information Systems</source>
          , Vol.
          <volume>14</volume>
          , issue 1. pp.
          <fpage>1</fpage>
          -
          <lpage>37</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>DESHPANDE</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          <article-title>4 key advantages of using decision trees for predictive analytics</article-title>
          . Available from: &lt;http://www.simafore.com/blog/bid/ 62333/4
          <article-title>-key-advantages-of-using-decision-trees-for-predictive-analytics&gt;</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. Data Mining Algorithms in R. Classification.
          <article-title>Decision Trees</article-title>
          . Available from: &lt;https://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Classification/Decision_Trees&gt;.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>TU</given-names>
            <surname>Darmstadt</surname>
          </string-name>
          .
          <article-title>Decision Trees</article-title>
          . Available from &lt; http://www.ke.tu-darmstadt.de/lehre/archiv/ws0809/mldm/dt.pdf&gt;.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>