<!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>Iris database - Effectiveness of selected classifiers</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Paulina Hałatek</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Katarzyna Wiltos</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mariusz Wróbe</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, 44100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Machine learning and artificial intelligence are crucial tools in the vast majority of different fields, but mainly in computer science and technology. Classifiers play a vital role in this field, especially in predicting the class membership of a sample under consideration. An example of the practical use of classifiers is the spam filter of email messages. The following paper aims to determine the most efficient classifier from selected: kNN, Soft set, and Naive Bayes on Iris database. Different versions of each of the classifiers have been considered. For kNN, the performance of various metrics was compared, for the Soft set, two approaches for establishing intervals during the classification, and for Naive Bayes, the normal and triangular distributions were compared. The most effective versions of the classifiers have been selected for the final comparison.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Artificial intelligence</kwd>
        <kwd>Iris</kwd>
        <kwd>classifiers</kwd>
        <kwd>kNN</kwd>
        <kwd>Soft set</kwd>
        <kwd>Naive Bayes</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>This is actually a small fraction of the immeasurable
possibilities in this field of study. Machine learning models
are used to learn the patterns in data. Machine learning
algorithms can be used for example to gather information
about data, split data for two parts and try to identify
unknown sample as a data element. The methods which
determine this, are called classifiers. W e have various
types of classifiers applicable to diferent task. In machine
learning models neural networks based ideas are very
eficient in complex data analysis. In [4] was presented
how to use them in low-dimensional data feature
learning. The idea presented in [8] proposed neural network
for analytical purposes of data recorded form high-speed
train. There are also very eficient, however simple in
construction, classifiers based on approaches sourced in
Before we started working on our base, we made sure
that our Iris base didn’t have null or NaN values. We have
helped us to shufle, normalize and split database by
dividing it into 70% as a training set and 30% as a validation
set. As we can see, the setos class is significantly
separated from the rest of the classes. This will result in a
high proportion of correctly recognized objects for this
class.
For all classifiers we were normalizing a given database
by taking all values from a specific column, determining
of the lowest and highest value in the specific column
and changing all values in the column according to the
formula which is given below:
 [][] =
 [][] − 
 − 
(1)




a current row
a current column
a minimal value in the current column
a maximal value in the current column</p>
    </sec>
    <sec id="sec-2">
      <title>3. Methods</title>
      <p>3.1. kNN</p>
      <sec id="sec-2-1">
        <title>3.1.1. Formulas</title>
        <p>In order to function properly, the kNN algorithm needs
functions that calculate the distance of the object for
which we are looking for a class to the objects of classes
already known to us. It is on the basis of this distance
that the kNN algorithm decides to which class a given
object may belong. There are many ways to calculate
distances, each with its pros and cons. When
calculating distances, we can, for example, use one of
the known metrics, e.g. Euclid:

|| − ||2 = ∑︁( −  )</p>
        <p>2</p>
        <sec id="sec-2-1-1">
          <title>Or Minkowski distance:</title>
          <p>(, ) = (∑︁ | − |) 1
=1</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>In our algorithm, we chose the Minkowski metric. (2) (3)</title>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>3.1.2. Algorithm</title>
        <p>The kNN (k-Nearest Neighbors) classifier is one of
the most important non-parametric classification
methods. The kNN algorithm does not create an
internal representation of the training data, but looks
for a solution only when the testing pattern appears. It
consists in assigning an object to a given class by
checking to which representatives a given object has
the shortest distance. The algorithm works as follows.</p>
        <sec id="sec-2-2-1">
          <title>First, a sample is taken from the validation set. Next</title>
          <p>for a given sample, the distance to each object in the
test set is calculated. Then list is created containing the
given test file object and the distance to the sample
which then is sorted from shortest distance to longest.</p>
          <p>After that from this list, the k objects in the shortest test set were calculated. On their basis, the middle values
distance from the sample are analyzed. At the end the of species range values were determined.
sample is assigned to the class with the most objects. The classifier considers samples from the validation
set together with the selected characteristic weight.</p>
        </sec>
        <sec id="sec-2-2-2">
          <title>Algorithm 1 kNN algorithm</title>
        </sec>
        <sec id="sec-2-2-3">
          <title>Input: Test set, validate set, ,</title>
        </sec>
        <sec id="sec-2-2-4">
          <title>Output: The class to which the sample may belong</title>
          <p>while  &lt; ( ) do
while  &lt; ( ) do</p>
        </sec>
        <sec id="sec-2-2-5">
          <title>Calculate the distance using Minkowski</title>
          <p>distance of test object j to the sample 
and add the result to the list of distances.
 + +</p>
        </sec>
        <sec id="sec-2-2-6">
          <title>Sort the list of distances in ascending order.</title>
        </sec>
        <sec id="sec-2-2-7">
          <title>Take the k objects with the smallest distance and return the class x with the most objects.</title>
          <p>Return from dictionary variety with the highest
probability
3.2. Soft sets</p>
        </sec>
        <sec id="sec-2-2-8">
          <title>The soft set term as a mathematical model ofers a tool for analysing vaguely defined objects. Soft set theory is a generalisation of fuzzy set theory that was introduced in 1999 by Dmitri Molodtsov.</title>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>3.2.1. Formulas</title>
        <p>There are a few ways in which soft set may be
implemented, for example: including weight or not. In
this case weight was included. Pearson correlation
coeficients were calculated to properly choose the most
appropriate weight values for particular characteristics.</p>
        <p>(∑︀( − ¯)( − ¯)
 = √︀∑︀( − ¯)2√︀∑︀( − ¯)2
(4)





characteristic value for i = 0,1,...,n
mean value for particular characteristic
value of compared characteristic for i = 0,1,...,n
mean value for compared characteristic</p>
        <sec id="sec-2-3-1">
          <title>Pearson correlation coeficient value</title>
        </sec>
      </sec>
      <sec id="sec-2-4">
        <title>3.2.2. Algorithm</title>
        <sec id="sec-2-4-1">
          <title>Prior to classification data was prepared through shuf</title>
          <p>lfing, normalizing, and splitting the database into a test
set and validation set in the ratio of 70 to 30.</p>
        </sec>
        <sec id="sec-2-4-2">
          <title>In the developed implementation of the soft set, the minimum and maximum values for each species of the</title>
        </sec>
        <sec id="sec-2-4-3">
          <title>In the first approach implementation for each sample, the distance from the center of the interval is calculated and the minimum value is chosen, which determines sample classification.</title>
        </sec>
        <sec id="sec-2-4-4">
          <title>Algorithm 2 Soft set algorithm - first approach</title>
        </sec>
        <sec id="sec-2-4-5">
          <title>Input: Test set, validation set, weight</title>
        </sec>
        <sec id="sec-2-4-6">
          <title>Output: The class to which the sample was classified</title>
          <p>←    ℎ  
for  &lt; ( ) do</p>
        </sec>
        <sec id="sec-2-4-7">
          <title>Creates nested list with iris type name, minimal</title>
          <p>and maximal values for each iris type in test set.
Creates nested list with iris type name, centre
value for each iris type based on minimal
and maximal values.
 ←       
  ← 
  ← 0
 ← 0
for    do ◁ Add all trait values for sample
 + =  * ℎ[]
+ = 1
for    do ◁ Calculate distances
 = [0]
 = | −  |
Chooses minimal distance and corresponding iris type.
Returns classified type.</p>
        </sec>
        <sec id="sec-2-4-8">
          <title>In the second approach algorithm, overlapping intervals are considered and mean value is calculated to create new intervals. Based on new intervals each sample is being classified accordingly to these measures.</title>
        </sec>
        <sec id="sec-2-4-9">
          <title>Naive Bayes classifier is a probabilistic machine learning</title>
          <p>model that’s used for classification task. At the
beginning it reduces database by splitting an Iris database
to three smaller databases according to their variety.
After that classifier assigns the initial probability of a
given species appearing in the database. Next, it takes a
sample and counts a probability for each reduced
database. It uses one of two considered distribution
formulas. Subsequently, it multiplies the initial
probability with all partial probabilities (with all
attributes that a reduced database has). And at the end
it compares which probability of three possible is the
highest.</p>
        </sec>
      </sec>
      <sec id="sec-2-5">
        <title>3.3.1. Formulas</title>
        <p>Normal distribution:
 (| ) = √
1
22
(−
( − )2
22
)
⎧0,
⎪⎪⎪⎨ 6−2 + √16 ,  − √6 ≤  ≤ 
⎪⎪− 6−2 + √16 ,  ≤  ≤  + √6)
⎩⎪0  &gt;  + √6)
 &lt;  − √6





a current attribute in reduced database
a current attribute of a sample
a standard deviation of an attribute
a mean of an attribute in reduced database
current reduced variety database</p>
        <sec id="sec-2-5-1">
          <title>Counting probability:</title>
          <p>4
 ( ) =  () * ∏︁  (| )
=1</p>
        </sec>
      </sec>
      <sec id="sec-2-6">
        <title>3.3.2. Algorithm</title>
        <sec id="sec-2-6-1">
          <title>To simplify how Naive Bayes actually works I will explain everything based on Iris database.</title>
        </sec>
        <sec id="sec-2-6-2">
          <title>At the beginning, the Naive Bayes algorithm takes two parameters. First is a test set and the second is a validation set.</title>
        </sec>
        <sec id="sec-2-6-3">
          <title>Afterwards, it splits the test set to three reduced</title>
          <p>databases according to their varieties.</p>
        </sec>
        <sec id="sec-2-6-4">
          <title>Subsequently, it calculates a initial probability by</title>
          <p>counting the number of elements in reduced database
divided by the number of all elements in the main
database. Next, for a given sample it calculates a
partial probability for each attributes in each reduced
database.
4.1. kNN
  +  
  +   +   +  
(8)</p>
        </sec>
        <sec id="sec-2-6-5">
          <title>After testing, we noticed that the results for any k are</title>
          <p>very similar to each other. This may be due to the fact
4. Experiments that the Setos class is significantly distant from the other
two classes, which means that there is a very high
probIn order to properly analyze individual classifiers, we ability that the objects closest to the sample will also be
will perform a series of tests that will allow us to select Stetosa. Below are the results for k equal to 1 2 3 and
the best classifier using the confusion matrix. Confu- 4, respectively.
sion matrix is used in assessing the quality of a binary
classification. It describes how well the classifier classi- Table 1
fied given samples. It also gives us information about Table for k = 1
several things about the classifier such as:</p>
        </sec>
        <sec id="sec-2-6-6">
          <title>1. Accuracy</title>
          <p>k
1
4.2. Naive Bayes</p>
        </sec>
        <sec id="sec-2-6-7">
          <title>We considered in our article two distribution formulas.</title>
        </sec>
        <sec id="sec-2-6-8">
          <title>In this section we decide which of these two are the best for our database.</title>
        </sec>
        <sec id="sec-2-6-9">
          <title>For the Normal distribution function results are:</title>
          <p>4.3. Soft sets</p>
        </sec>
        <sec id="sec-2-6-10">
          <title>The determined values of Pearson correlation coeficients</title>
          <p>for each characteristic of iris flowers allowed choosing
the weight of the features for the optimal classifier
accuracy. An association between individual features was
considered and their influence on the classifier eficiency.</p>
        </sec>
        <sec id="sec-2-6-11">
          <title>Based on these factors diferent weights were applied to select the most suitable solution.</title>
          <p>Considering obtained correlation values, it was
concluded that the most important characteristics
are the following in descending order: petal-length,
petal-width, sepal-length, and sepal-width. According
to these observations, successively assigning diferent
weight values, the best results were observed with
weight  = [0.1, 0, 0.5, 0.4].</p>
        </sec>
        <sec id="sec-2-6-12">
          <title>The analysis of the results for both the first and the second algorithm showed that the first algorithm is a more efective soft set implementation. After performing 100 tests, the following results were obtained.</title>
        </sec>
        <sec id="sec-2-6-13">
          <title>For the most eficient implementation, the following</title>
          <p>results were obtained for individual types of iris flowers.</p>
        </sec>
        <sec id="sec-2-6-14">
          <title>After performing 100 tests, the following results were obtained.</title>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>5. Conclusion</title>
      <sec id="sec-3-1">
        <title>In order to establish the most eficient classifier, the pre</title>
        <p>pared implementations were compared on the same
partition of the Iris database. In comparison, the following
results were statistically calculated.</p>
      </sec>
      <sec id="sec-3-2">
        <title>Results for kNN:</title>
        <p>Through analysis of attained results for all classes of
all classifiers, it can be noted that the level of accuracy
is the highest for the soft set classifier. T he v alues of [1] Akram, M., Ali, G., Butt, M. A., Alcantud, J. C. R.
other statistically obtained characteristics also reach the (2021). Novel MCGDM analysis under m-polar fuzzy
highest levels for the previously mentioned classifier. It soft expert sets. Neural Computing and Applications,
is worth mentioning that the obtained results are similar 33(18), 12051-12071.
for particular characteristics of the kNN and Naive Bayes [2] Chen, W., Zhou, Y., Zhou, E., Xiang, Z., Zhou, W., Lu,
classifiers. J. (2021). Wildfire risk assessment of transmission-line</p>
        <p>Based on the obtained results, it can be concluded corridors based on Naïve Bayes network and remote
that the soft set classifier implementation classifies most sensing data. Sensors, 21(2), 634.
efectively. All of the implemented classifiers have been [3] Dong, W., Wozniak, M., Wu, J., Li, W., Bai, Z. (2022).
properly implemented. The results of the best classifier De-Noising Aggregation of Graph Neural Networks
difer only by a few percentage points from each other. by Using Principal Component Analysis. IEEE
Trans</p>
        <p>The work and efort that was applied to completing actions on Industrial Informatics.
this article are practical and applicable. This research [4] Dong, W., Wu, J., Bai, Z., Hu, Y., Li, W., Qiao, W.,
ofered an opportunity to learn and expand knowledge Woźniak, M. (2021). MobileGCN applied to
lowabout the diferent approaches to assessing and teaching dimensional node feature learning. Pattern
Recognichosen classifiers as well as through the process of iden- tion, 112, 107788.
tifying the best solution. The analysis allowed acquiring [5] Rani, P., Verma, S., Kaur, N., Wozniak, M., Shafi, J.,
practical experience in implementing machine learning Ijaz, M. F. (2021). Robust and secure data
transmisalgorithms. sion using artificial intelligence techniques in ad-hoc</p>
        <p>In the future, the project could be extended and fol- networks. Sensors, 22(1), 251.
lowed with further analysis of other classifiers, for in- [6] Ruan, S., Chen, B., Song, K., Li, H. (2022). Weighted
stance through rebuilding the current classifiers in a more Naïve Bayes text classification algorithm based on
imadvanced way and selecting even more eficient solutions. proved distance correlation coefficient. Neural
Computing and Applications, 34(4), 2729-2738.</p>
        <p>Table 28 [7] Shokrzade, A., Ramezani, M., Tab, F. A., Mohammad,
Results M. A. (2021). A novel extreme learning machine based
kNN classification method for dealing with big data.</p>
        <p>Classifier Expert Systems with Applications, 183, 115293.
[8] Siłka, J., Wieczorek, M., oWzniak, M.
(2022).Recurrent neural network model for high-speed train
vibration prediction from time series. Neural
ComputkNN ing and Applications, 1-14.</p>
        <p>[9] https://c3.ai/glossary/data-science/classifier/
[10]
https://www.sas.com/en_th/insights/articles/bigdata/artificial-intelligence-machine-learning-deeplearning-and-beyond.html
[11]
https://www.sciencedirect.com/topics/computer</p>
        <p>science/machine-learning
[12] https://www.sciencedirect.com/science/article/
Naive pii/S0898122199000565
Bayes [13]
https://towardsdatascience.com/machinelearning-classifiers-a5cc4e1b0623
[14]
https://monkeylearn.com/blog/what-is-aclassifier/</p>
        <p>Setosa
0.96
0.87
1.00
0.93
1.00
13
0
30
2
0.96
0.87
1.00
0.93
1.00
13
0
30
2
0.98
0.93
1.00
0.96
1.00
13
0
31
1</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list />
  </back>
</article>