<!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>Application of Sampling Algorithms in the Problem of Classification of User Requests*</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>National Research University "Moscow Power Engineering Institute”</institution>
          ,
          <addr-line>Krasnokazarmennaya 17, Moscow, 11250, Russian Federation</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>V.I. Vernadsky Crimean Federal University</institution>
          ,
          <addr-line>295007, Simferopol</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>1979</year>
      </pub-date>
      <fpage>0000</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>The article discusses the application of methods for reducing the size of majority classes (undersampling) in unbalanced samples to the problem of processing and classifying user requests sent to the technical support of the portal of the Center for Industry Information and Analytical Systems. Sampling methods are investigated, indicators of the classification quality are given - F1-measure for macro and micro averaging. The paper considers a sample consisting of user requests to the technical support service, which has a highly unbalanced form - volume of some classes in the sample exceeds the volume of others by several times. On this sample, various undersampling algorithms are used, a conclusion is made about the advisability of using certain algorithms. A study of the influence of undersampling and oversampling methods on the accuracy of classification of user requests to the portal's technical support service when using gradient boosting on decision trees was carried out. The results obtained showed that an increase in F1-measure compared to the base model was achieved only with the use of the Tomek Links undersampling method; other methods for reducing the size of majority classes did not give an increase inaccuracy, and in most cases even worsened the result.</p>
      </abstract>
      <kwd-group>
        <kwd>Data Mining</kwd>
        <kwd>Text Classification</kwd>
        <kwd>Machine Learning</kwd>
        <kwd>Data Sampling</kwd>
        <kwd>Undersampling</kwd>
        <kwd>Unbalanced Sampling</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Nowadays, due to the rapid development of computer technology, a section of data
science known as Machine Learning has gained popularity. One of the problems of
*
machine learning is the classification problem, which often has to be solved in
conditions of imbalanced classes. This situation arises in cases when the proportion of objects
of one or several classes in the training sample is significantly greater than 1/n, where
n is the number of classes. The consequence of such an imbalance in the data is both
the worse quality of the model's operation on objects of minority classes (in comparison
with the majority) and the bias of classification metrics, for example, accuracy (the
proportion of correct answers).</p>
      <p>
        To improve the quality of classification, there are sampling methods, which can be
divided into two main groups: oversampling (generation of additional objects of a
smaller (minority) class) and undersampling (removal of objects of a larger (majority)
class). In this paper, we consider a sample consisting of user requests to the technical
support service [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], which has a highly unbalanced form - the volume of some classes
in the sample exceeds the volume of others by several times. In this sample, various
under-sampling algorithms are used, a conclusion is made about the advisability of
using certain algorithms.
      </p>
      <p>The purpose of the article is to analyze the well-known sampling algorithms to
increase the accuracy of the classification of user requests to the technical support service.
2</p>
      <p>Description of samples
There are many requests from X users to the portal technical support. Each request,  =
1̅̅,̅2̅̅2̅̅0̅̅0̅0̅, belongs to one of 13 classes and is presented in text format with the following
structure: a greeting phrase - a description of the problem or the reason for contacting
a signature.</p>
      <p>The distribution of queries by class is shown in Table 1. It can be seen that the training
set has a highly uneven distribution of objects</p>
      <p>Class
State Tasks
CRRR
Miscellaneous
Performance reports
Standard costs
“Do the right thin” Portal
FM rating
Subsidies calculations
Advanced trainings and seminars
SOI
AC of FMCS
Salary monitoring
Budgeting and FEAP
5.427
46.130
0.616
1.012
0.510
The solution to the problem is divided into 3 stages.</p>
      <p>Data preprocessing Building a basic model (on the original sample) Building and
analyzing models on modified samples Data processing is the extraction of
Russianlanguage terms from the query text, their normalization (reduction to the initial form),
and removal of stop words. In this task, the stop word dictionary included auxiliary
parts of speech, names of people, and terms most frequently used in greeting phrases.</p>
      <p>
        Figure 1 shows the visualization of the sample using the T-SNE method [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The
imbalance of classes is most clearly expressed in the yellow, blue and red colors
prevailing in the figure. Many classes, due to their small number, turned out to be hardly
noticeable on visualization. Moreover, the data are rather strongly mixed, but, at the
same time, a cluster structure can be distinguished.
      </p>
      <p>
        As a basic model for classifying queries, we will consider a classifier built based on
gradient boosting on decision trees (XGBClassifier) without using sampling methods.
The choice of the XGBClassifier is based on the best classification results in
comparison with other classifiers [
        <xref ref-type="bibr" rid="ref2 ref6 ref7">2,6,7</xref>
        ].
      </p>
      <p>The f1-measure with micro and macro-class averaging will be used as an indicator
of quality.</p>
      <p>recall =
=</p>
      <p>
        +

 +
(2)
where TP (True Positive), FP (False Positive), FN (False Negative) - error matrix
indicators (confusion matrix) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
(3)
 1 =
2∗

∗
+
      </p>
      <p>Micro-averaging does not take into account the belonging of an object to a class, i.e.
each object contributes equally to the calculation of the measure. The total values TP,
FP, FN, TN are calculated as the sum of the components for each class, and then the F1
measure itself is calculated from the total values</p>
      <p>With macro averaging, the value of the F1-measure is calculated as the average F1
for all classes, each class equally participates in the calculation of the measure.</p>
      <p>The choice of the preferred averaging is based on the task at the given moment. The
calculation of the F1-measure for micro-averaging is carried out using absolute scales,
while for macro-averaging - using relative scales. Having received the general
indicators of the error matrix in the first case, a large contribution will be made by the objects
of the majority classes (due to their numerical superiority). In the second case, we
equalize the contribution of each of the classes, ignoring their numbers. Thus, if the
value of identifying minority objects in the problem turns out to be higher than the value
of majority objects, then it is worth focusing on macro-averaging (for example,
identifying “unreliable” bank customers in the problem of credit scoring).</p>
      <p>In our task, the value of each class turned out to be equal, therefore, more attention
was paid to micro-homogenization. Next, we investigated several sampling methods
based on reducing the size of majority classes. As is known, with an uneven distribution
of objects across the sample classes, the classifier model is trained unevenly on different
classes, and therefore there is a shift in training towards majority classes, and in the
extreme case, it is more profitable for the classifier to assign all objects to the majority
class than to try to allocate objects of the minority class.</p>
      <p>
        In studies, we will reduce those classes whose share exceeds 1/n, where n is the
number of classes in the sample. In the literature, there are quite a few sampling
methods associated with reducing the size of classes [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]:
 Tomek Links method,
 Neighbourhood Cleaning Rule,
 Random UnderSampler,
 Near Miss,
 Condensed Nearest Neighbour.
      </p>
      <p>
        From Table 2 it can be seen that sampling methods associated with reducing the size of
majority classes in most cases do not increase the classification accuracy. A slight
increase in accuracy was achieved only with the use of Tomek Links, the success of which
can be justified by its algorithm, which removes objects of the majority class located
near objects of the minority class. Other methods are likely to reduce the majority class
too much, which leads to the underfitting of the model [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
─ Calculate the ratio of the number of minority objects to the number of majority ones:
d = m_s / m_l, m_s is the number of minority objects, m_ (l) is the number of
majority objects. If d is below a certain limit, go to the next steps of the algorithm.
─ Calculate the total number of objects to generate: G = (m_l- m_s) β, where β = 1
means a fully balanced dataset.
─ Find k nearest neighbors for each minority object and calculate
      </p>
      <p>r_i = 〖majority〗 _i / k,
where majority i is the number of majority objects and k neighbors of the ith minority
object.
─ Normalize</p>
      <p>(r_i) ̂ = r_i / (∑r_i)
─ For each neighborhood, calculate the number of generated objects</p>
      <p>G_i=G*(r_i ) ̂
─ New Gi objects are generated according to the formula:</p>
      <p>s_i = x_i + (x_zi-x_i) α,
x_i is an object relative to which new examples are generated.
x_zi is a randomly selected example of a minority class in the x_i neighborhood.
α is a random number in the range from 0 to 1.</p>
      <p>If there are no examples of a minority class out of k neighbors, then either no new
objects are created for xi, or xi is duplicated Gi times.</p>
      <p>RandomOverSampler – random selection of objects with the return.</p>
      <p>SMOTE can link internal and external values, while ADASYN can focus exclusively
on outliers, which in both cases can lead to suboptimal decision functions. In this
regard, SMOTE offers two additional sample generation options (SVMSMOTE,
BorderlineSMOTE). These methods focus on samples near the border of the optimal decision
function. A visual illustration is shown in Table 3 and Fig. 2.
The deterioration in the quality of the model can be explained by the low linear
separation of the sample, since all methods, except for RandomOverSampler, use the
algorithm of nearest neighbors, which can lead to the generation of new objects belonging
to the majority class.</p>
      <p>A study was carried out of the influence of undersampling and oversampling
methods on the accuracy of the classification of user requests to the portal technical support
service when using gradient boosting on decision trees. The results obtained showed
that an increase in accuracy compared to the baseline model was achieved only with
the use of the Tomek Links undersampling method, other methods for reducing the size
of majority classes did not give an increase inaccuracy, and in most cases even
worsened the result. The use of oversampling methods did not give results on this sample,
which is most likely due to the poor linear separability of the sample. A further direction
of research is to study the possibility of improving the accuracy of classification by
simultaneously increasing the minority classes and reducing the majoritarian ones.</p>
      <p>This method is aimed at reducing the error and shows good results when applied in
various applied calculations.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Van der Maaten</surname>
            ,
            <given-names>L.J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hinton</surname>
          </string-name>
          , G.E.:
          <article-title>Visualizing Data Using t-SNE</article-title>
          .
          <source>Journal of Machine Learning Research</source>
          .
          <year>2008</year>
          . V.
          <volume>9</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Tianqi</surname>
            , Chen, Carlos, Guestrin, Boost,
            <given-names>X.G.</given-names>
          </string-name>
          :
          <article-title>A Scalable Tree Boosting System</article-title>
          .
          <source>Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining</source>
          ,
          <year>August 2016</year>
          , pp.
          <fpage>785</fpage>
          -
          <lpage>794</lpage>
          . DOI:
          <volume>10</volume>
          .1145/2939672.2939785
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. 3.
          <string-name>
            <surname>Manning</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Raghavan</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schütze</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          :
          <article-title>An Introduction to Information Retrieval</article-title>
          .
          <string-name>
            <given-names>M.</given-names>
            <surname>Williams</surname>
          </string-name>
          ,
          <year>2014</year>
          .528 p.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Under-sampling.
          <article-title>Imbalanced-learn user-guide</article-title>
          . Электронный доступ: https://imbalancedlearn.readthedocs.io/en/stable/under_sampling.html
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Tahir</surname>
            ,
            <given-names>M.A.U.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Asghar</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Manzoor</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Noor</surname>
            ,
            <given-names>M.A.</given-names>
          </string-name>
          :
          <article-title>A Classification Model for Class Imbalance Dataset Using Genetic Programming</article-title>
          .
          <source>IEEE Access</source>
          .
          <year>2019</year>
          . V.
          <article-title>7</article-title>
          . С.
          <volume>71013</volume>
          -
          <fpage>71037</fpage>
          . DOI:
          <volume>10</volume>
          .1109/ACCESS.
          <year>2019</year>
          .2915611
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Bobryakov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuryliov</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mokhov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stefantsov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Approaches to Automation Processing of User Requests in a Multi-Level Support Service Using Featured Models</article-title>
          .
          <source>Proceedings of the 30th DAAAM International Symposium</source>
          , pp.
          <fpage>0936</fpage>
          -
          <lpage>0944</lpage>
          , B.
          <string-name>
            <surname>Katalinic</surname>
          </string-name>
          (Ed.),
          <source>Published by DAAAM International, ISBN 978-3-902734-22-8, ISSN 1726-9679</source>
          , Vienna, Austria DOI:
          <volume>10</volume>
          .2507/30th.daaam.
          <source>proceedings.130</source>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Batura</surname>
          </string-name>
          , T.V.:
          <article-title>Metodi Avtomaticheskoy Klassifikacii Tekstov</article-title>
          .
          <source>Software &amp; Systems. №1</source>
          (
          <issue>30</issue>
          ), pp.
          <fpage>85</fpage>
          -
          <lpage>89</lpage>
          , DOI: 10.15827/
          <fpage>0236</fpage>
          -
          <lpage>235X</lpage>
          .
          <fpage>117</fpage>
          .
          <fpage>085</fpage>
          -
          <lpage>099</lpage>
          . (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Alashkevich</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bobryakov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Klimenko</surname>
          </string-name>
          , А.,
          <string-name>
            <surname>Stefantsov</surname>
          </string-name>
          , А.:
          <article-title>Automation and InformationalSupport of Budgetary Institution Financing Processes</article-title>
          , Chapter 27 in DAAAM International Scientific Book,
          <year>2015</year>
          . - Pp.
          <fpage>319</fpage>
          -
          <lpage>328</lpage>
          . B.
          <string-name>
            <surname>Katalinic</surname>
          </string-name>
          (Ed),
          <source>Published by DAAAM International,ISBN: 978-3-902734-05-1, ISSN 1726-9687</source>
          , Vienna, Austria. DOI:
          <volume>10</volume>
          .2507/daaam.scibook.
          <year>2015</year>
          .
          <volume>27</volume>
          . (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Chawla</surname>
          </string-name>
          , Nitesh V., et al.
          <article-title>SMOTE: Synthetic Minority Over-Sampling Technique</article-title>
          .
          <source>Journal of artificial intelligence research 16</source>
          , pp.
          <fpage>321</fpage>
          -
          <lpage>357</lpage>
          . (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. Fithria Siti Hanifah, Hari Wijayanto, Anang Kurnia:
          <article-title>SMOTE Bagging Algorithm for Imbalanced Data Set in Logistic Regression Analysis</article-title>
          .
          <source>Applied Mathematical Sciences</source>
          , Vol.
          <volume>9</volume>
          , No.
          <volume>138</volume>
          , pp.
          <fpage>6857</fpage>
          -
          <lpage>6865</lpage>
          . (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>