<!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>The Efectiveness of PCA in Decision Tree and Random Forest for Raisin Dataset</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Agnieszka Polowczyk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alicja Polowczyk</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Applied Mathematics, Silesian University of Technology</institution>
          ,
          <addr-line>Kaszubska 23, 44-100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <fpage>9</fpage>
      <lpage>14</lpage>
      <abstract>
        <p>In machine learning we can emphasize models based on the such as supervised learning and unsupervised learning. Mainly algorithms based on learning without teacher are used to clustering process. This algorithms are used to split ours data to smaller groups, clusters with similar and comparable attributes. Guided learning is utilized to create many classifiers. On the basis of previously prepared training data, the classifier learns certain relations and dependencies so that it can correctly predict target values later. In our paper we will look at two rule-based models that use decision rules to classify data samples. Examples of models are Decision Tree and Random Forest which are created for diferent hyperparameters. We will also show how the reduction of dimensionality afects to efectiveness and eficiency our models by using PCA technique and correlation analysis to select the most relevant features.</p>
      </abstract>
      <kwd-group>
        <kwd>Machine learning</kwd>
        <kwd>pca</kwd>
        <kwd>decision tree</kwd>
        <kwd>random forest</kwd>
        <kwd>raisin</kwd>
        <kwd>classifiers</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        before training the algorithm is preparing data. This
preparing is based on standardization or normalization
Artificial intelligence is used in many areas. In image our dataset. In the case of high dimensionality of the
processing for example is applied in feature correction data, various dimensionality reduction techniques are
and encryption [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In the financial and economic sector often used [8, 9, 10] to reduce computational
complexAI is used to predict housing prices or even prices of ity and speed up the model training process. We can
products on the food market. We can also find applica- also find various applications to data classification and
tions in recommendation systems, ie. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] proposed crop recommendation systems by using models of machine
recommender for agriculture by the use of XAI-driven learning. In [11] was proposed model of neural network
model. There are many types of models in machine learn- for imbalanced data collection on the input of classifier.
ing, they are for example: Linear Regression, Gaussian Very often computation models are used for positioning,
Naive Bayes Classifier, Decision Tree, Random Forest, ie. power electric systems [12, 13], or for human behavior
Support Vector Machine or model based on neural net- understanding [14, 15]
works [
        <xref ref-type="bibr" rid="ref3 ref4 ref5">3, 4, 5</xref>
        ]. Every classifier has another method to
determine the predicted values which means that not every In this paper, we will compare two rule-based models:
model will have high efectiveness for each dataset. Better Decision Tree and Random Forest, which were built for
accuracy for image classification is achieved by models three diferent dataset:
such as CNN [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], but for simple and low-dimensional • model uses PCA to reduce the dimensionality of
data, where distance between points is important in clas- the data
sification using KNN is a good idea. We should always • model uses two features selected after data
analchoose a model after the initial analysis of the data. Every ysis
model is equipped with many hyperparameters that we • model uses all the features
can adjust and self-change.
      </p>
      <p>We will also check the efectiveness of above, our models.</p>
      <p>
        In the case of KNN model we can establish number of In the case of Decision Tree for diferent measure:
ennearest neighbors. However, often the problem is to de- tropy and gini, and for various depths. For the Random
termine the optimal value k-nearest neighbors, in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] Forest, we will test the performance of the algorithm for
described the K-Tree method that solves this problem. a diferent number of decision trees. At the end, we will
In a Random Forest, we specify the number of Decision make a summary, whether the reduction of dimensions
Trees during training. Additionally, an important aspect contributed to the high accuracy of our models.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Raisin database</title>
      <p>The database that we used to build various classifiers
contains samples that were described by 7 morphological
features. These features were obtained after previously
processing the photos.Values are continuous and we can
see that each feature has value from diferent ranges.
There are also high values of standard deviations for
example, for Area and ConvexArea features, indicating
that the values for these features are highly dispersed
from their mean. The Fig. 1 shows a table containing the
statistics of our attributes.</p>
      <sec id="sec-2-1">
        <title>2.1. Standardization</title>
        <p>To improve the efectiveness and eficiency of the model,
data normalization or standardization is used. However
rule-based models don’t require transformations to a
single scale, because this classifiers make predictions
based on specific rules. Nevertheless, in our case, we
have standardized for:</p>
        <p>ize the data.
• models that were built from lower dimensionality
data using the PCA technique. When using this
technique, it is recommended to before
standard• models that were based on two features that
we chose. Standardization data contributed to
changes in values to a similar range which helped
in the creation of decision boundary charts.</p>
        <p>In our classifiers, we used standardization that transforms
the data in such a way that its mean is equal to 0 and the
standard deviation is equal to 1. First for every attribute
we calculated its mean and standard deviation. Later,
we used the obtained results to compute the new values
using the below formula:
 =
 − 

(1)</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Model based on PCA</title>
        <p>One of the popular dimensionality reduction techniques
is PCA. The task of PCA is to return n-features that we
can create a model with high accuracy. PCA model can
be improved for sophisticated data on the input, [16]
presented denoising of the input for improved
processing. In our models were used PCA, which returns to us
new training and test data reduced from seven to two
dimensions.</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Model based on two features</title>
        <p>Another way to prepare data for the model is to reduce
dimensionality based on correlation analysis. Correlation
defines the relation between two variables. Correlation
value close to 1 or -1 mean a strong correlation, but value
close to 0 mean weak correlation. The Extent feature
was removed from our training and testing data, because
its correlation value with our target feature was only
0.28. Additionally, the following features were elimi- Information gain:
nated: ConvexArea, Perimeter, Area, MinorAxisLength,
because these attributes had strong relation with other
features and didn’t contribute relevant information to the Gini coeficient:
classification models. Finally, our classifiers were built
on other two features: MajorAxisLength and Eccentricity.</p>
        <p>The Fig. 3 shows correlation plots between two features.</p>
        <sec id="sec-2-3-1">
          <title>Gini coeficient after:</title>
          <p>Information gain:
before − after
−

∑︁  ·</p>
          <p>2
=1
−
=1
∑︁  ()</p>
          <p>before − after</p>
        </sec>
      </sec>
      <sec id="sec-2-4">
        <title>2.4. Model based on all features</title>
        <p>For each classifier, we also built a model based on all
seven features. Sometimes training a model on the basis
of all attributes can be a disadvantage, because this
approach lead to slower learning of our classifier. However,
the advantage of including all features is that in some
cases it can lead to very high eficiency of our machine
learning algorithm, because we don’t lose any relevant
information. Fig. 2 illustrates our feature and correlation
graphs.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Methods</title>
      <sec id="sec-3-1">
        <title>3.1. Decision Tree</title>
        <p>3.1.1. Formulas</p>
        <sec id="sec-3-1-1">
          <title>Entropy:</title>
          <p>Entropy after:
−
−

∑︁  · log2()
=1
=1
∑︁  ()

3.1.2. Algorithm
A Decision Tree is a directed model that consists of a root,
nodes, leaves and edges. Root is top of the tree, passing
through the edges, we come to the nodes and finally to
the leaves, to the lowest layer of the tree. Leaves contain
the answers, predictions of our model, to which class our
data sample is classified. Nodes contain rules that are
used to make decisions during testing. Rules are created
using impurity measures. These are: entropy and gini
coeficient. Our classifiers will create rules that will divide
our sets into more pure subsets. The final conditions are
those for which the information gain is the greatest. The
Decision Tree has a tendency to overfitting, so we used
the following as regularization parameters: number of
max depth is 2 and 3, and the minimum amount of data
in the set before the division can not be less than 2.</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Random Forest</title>
        <p>Random Forest algorithm creates a forest in a random
manner. This “forest” you can think of as an ensemble of
Decision Trees, most of the time trained with the
“bagging” method. The general idea of the bagging method
is that a combination of learning models increases the
overall result. The Random Forest starts by selecting
random samples from the given dataset. It selects these
random subsets with replacement, meaning that some
samples may be used multiple times in a single subset. e
features at each split in the tree. This randomness in
feature selection is what gives the Random Forest its name.
The Random Forest consist of many decision trees. Test
data is classified by decision trees. Next, voting takes
place and we look at which class/forecast occurs most
(2) frequently. Random Forest is better option than Decision
Tree, because this classifier has not a tendency to
overfitting to training data. Our models include several dozen
decision trees, where each of them has been trained for
(3) diferent training data that has been previously
randomized from the main dataset intended for training.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experiments</title>
      <sec id="sec-4-1">
        <title>4.1. Decision Tree</title>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Random Forest</title>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>neighbors, IEEE Transactions on Neural Networks
and Learning Systems (2018) 1774–1785.</p>
      <p>After an in-depth analysis carried out on Decision tree [8] G. D. Magistris, C. Rametta, G. Capizzi, C. Napoli,
and Random Forest models, it can be concluded that us- Fpga implementation of a parallel dds for wide-band
ing PCA to reduce dimensionality for our dataset is good applications, volume 3092, 2021, pp. 12 – 16.
idea. Presented models of decision trees achieve high [9] H. S. Parmar, S. Mitra, B. Nutter, R. Long, S.
Anaccuracies for a depth equal of 2 at level 83 %, which tani, Visualization and detection of changes in brain
were trained on a training dataset using PCA. In addition, states using t-sne, 2020 IEEE Southwest Symposium
after analyzing the correlation, we were able to find two on Image Analysis and Interpretation (SSIAI) (2020)
features for which the models made predictions as good 14–17.
as the models for which PCA were used. Random Forest [10] C. Napoli, G. Pappalardo, E. Tramontana, A
hyis the model which make even more efective predictions. brid neuro-wavelet predictor for qos control and
Classifier of this type achieved an accuracy of 90 % using stability 8249 LNAI (2013) 527 – 538. doi:10.1007/
100 decision trees. Additionally, an important element 978-3-319-03524-6\_45.
turned out the right choice of impurity measure, our [11] M. Woźniak, M. Wieczorek, J. Siłka, Bilstm deep
research confirm that classifiers using the entropy mea- neural network model for imbalanced medical data
sure gave better accuracy results than models that used of iot systems, Future Generation Computer
Systhe gini coeficient. To sum up, the use of PCA for our tems 141 (2023) 489–499.
database allowed us to achieve equally high accuracies, [12] F. Bonanno, G. Capizzi, G. L. Sciuto, C. Napoli,
while reducing computational complexity. G. Pappalardo, E. Tramontana, A novel
clouddistributed toolbox for optimal energy dispatch
management from renewables in igss by using wrnn
References predictors and gpu parallel solutions, 2014, pp. 1077
– 1084. doi:10.1109/SPEEDAM.2014.6872127.
[13] A. Sikora, A. Zielonka, M. F. Ijaz, M. Woźniak,
Digital twin heuristic positioning of insulation in
multimodal electric systems, IEEE Transactions on</p>
      <p>Consumer Electronics (2024).
[14] S. Pepe, S. Tedeschi, N. Brandizzi, S. Russo, L.
Iocchi, C. Napoli, Human attention assessment
using a machine learning approach with gan-based
data augmentation technique trained using a
custom dataset, OBM Neurobiology 6 (2022). doi:10.</p>
      <p>21926/obm.neurobiol.2204139.
[15] A. Alfarano, G. De Magistris, L. Mongelli, S. Russo,</p>
      <p>J. Starczewski, C. Napoli, A novel convmixer
transformer based architecture for violent behavior
detection 14126 LNAI (2023) 3 – 16. doi:10.1007/
978-3-031-42508-0\_1.
[16] W. Dong, M. Woźniak, J. Wu, W. Li, Z. Bai,
Denoising aggregation of graph neural networks by using
principal component analysis, IEEE Transactions
on Industrial Informatics 19 (2022) 2385–2394.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>W.</given-names>
            <surname>Feng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Qin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ahmad</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <article-title>Exploiting robust quadratic polynomial hyperchaotic map and pixel fusion strategy for eficient image encryption</article-title>
          ,
          <source>Expert Systems with Applications</source>
          <volume>246</volume>
          (
          <year>2024</year>
          )
          <fpage>123190</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Naga Srinivasu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. F.</given-names>
            <surname>Ijaz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <article-title>Xaidriven model for crop recommender system for use in precision agriculture</article-title>
          ,
          <source>Computational Intelligence</source>
          <volume>40</volume>
          (
          <year>2024</year>
          )
          <article-title>e12629</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>V.</given-names>
            <surname>Ponzi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Russo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Bianco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Wajda</surname>
          </string-name>
          ,
          <article-title>Psychoeducative social robots for an healthier lifestyle using artificial intelligence: a case-study</article-title>
          , volume
          <volume>3118</volume>
          ,
          <year>2021</year>
          , pp.
          <fpage>26</fpage>
          -
          <lpage>33</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>G.</given-names>
            <surname>De Magistris</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Caprari</surname>
          </string-name>
          , G. Castro,
          <string-name>
            <given-names>S.</given-names>
            <surname>Russo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Iocchi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          ,
          <article-title>Vision-based holistic scene understanding for context-aware humanrobot interaction 13196 LNAI (</article-title>
          <year>2022</year>
          )
          <fpage>310</fpage>
          -
          <lpage>325</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>031</fpage>
          -08421-8\_
          <fpage>21</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>N.</given-names>
            <surname>Brandizzi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Russo</surname>
          </string-name>
          , G. Galati,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          ,
          <article-title>Addressing vehicle sharing through behavioral analysis: A solution to user clustering using recency-frequencymonetary and vehicle relocation based on neighborhood splits</article-title>
          ,
          <source>Information (Switzerland) 13</source>
          (
          <year>2022</year>
          ). doi:
          <volume>10</volume>
          .3390/info13110511.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>K.</given-names>
            <surname>Huang</surname>
          </string-name>
          ,
          <article-title>Image classification using the method of convolutional neural networks</article-title>
          ,
          <source>2022 IEEE Conference on Telecommunications, Optics and Computer Science (TOCS)</source>
          (
          <year>2022</year>
          )
          <fpage>827</fpage>
          -
          <lpage>832</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>S.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Eficient knn classification with diferent numbers of nearest</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>