<!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>Cerebrum algorithm for automatic diet preparation</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Paulina Grzanka, Łukasz Płaneta, Bartłomiej Adamski Faculty of Applied Mathematics Silesian University of Technology Kaszubska 23</institution>
          ,
          <addr-line>Gliwice, 44-100</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>-We have created a program that deals with the issue of dietetics and is strongly related to artificial intelligence. It aims to create an optimal nutritional plan. This is an innovative solution because our application is not only a basic calculator of calories, but thanks to a combination of advanced algorithms we can match the diet to each person individually unlimited number of times. There is a very large need on the market to develop such programmes because of the absence of dietary education in society and a large number of myths and incorrect and often misleading thesis. The idea behind the application was to help people who do not have knowledge about healthy diets. Thanks to the application, meals can be balanced and tasty. The user chooses how many meals wants to eat so the process of losing weight does not have to necessarily result in constant hunger. Neither building the muscles will not lead to eating too much. Our program is based on the kNN algorithm and soft sets. The soft sets choose allowed products. The kNN determines a product from allowed products that is closest to the point we need. This allows sufficiently good results to be obtained. The program is easy to use and requires only basic data from the user. Additionally, users can freely adjust one's meals with the food modes as intermittent fasting, no food after 18 or a regular meals every 3 hours.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>One of the problems of the modern world is the
inappropriate consumption of meals.</p>
      <p>Many people who want to lose weight look for help among
‘wonderful’ supplements, effectively slimming only wallets.
Others spend hundreds of hours exercising or working out
at the gym, but not getting the desired effects in a short
time. There are also people who weigh too little and want to
gain some weight.It concerns gym enthusiasts or underweight
people who reach for different kinds of supplements in the
form of powders or tablets that are very expensive.</p>
      <p>An effective solution for them would be the help of a
dietitian - a specialist who will effectively help to control
body weight and choose a diet plan to match our individual
preferences. However, the problem arises when we cannot
determine the competence of the person to whom we entrust
our goal.</p>
      <p>A dietitian is a profession from which we require the
knowledge about the issues of nutrition, help with choosing a
balanced diet or time to explain us what a healthy lifestyle is.</p>
      <p>c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0)</p>
      <p>Unfortunately, not long time ago, in Poland to become
a dietitian there was no need to graduate from university.
According to the law a short course was sufficient to have
the status of a nutritionist. As a result our health might still
be exposed to a risk due to insufficient knowledge of the so
called "dietitians" and loose money for nothing. On the other
hand, once we find a person with sufficient qualifications, we
have to be aware that we will have to spend hundreds of zlotys
on his or her service. So what should people who want to take
control of their weight and achieve their goals without feeling
of being on a diet and paying a huge amount of money do?</p>
      <p>We recommend to use our diet app which thanks to
advanced algorithms, accumulated knowledge and hours of work
will help you with the perfect selection of macroelements.
Our program is based on a combination of dietary and IT
knowledge.</p>
      <p>It will help to reduce weight, count calories, and prepare a
plan of sample products for a single day. All you have to do
is provide us with basic information about yourself and the
program will suggest food products. Our application will select
the right ingredients for your individual needs and preferences.</p>
      <p>Our goal is to constantly improve the application, upgrade
the algorithms and care about user’s satisfaction. Soon there
will be solutions to inform the user what GMOs are and
whether to be afraid of them or not and other similar nutritional
topics. There will also be section about how to distinguish
reliable nutritional information from dangerous fake news.
We will also strive to improve our program so it can be
compatible with social apps such as Facebook and Instagram.</p>
      <p>Applications like ours are essential not only to lose weight,
but also to gain proper dietary knowledge.</p>
      <p>By using our application you will avoid dietary fake news
and you will start to live in a healthy and balanced way.</p>
      <sec id="sec-1-1">
        <title>A. Related works</title>
        <p>
          From the point of view of modeling algorithms in order
to select certain specific elements from the set due to the set
of specific rules, various techniques of artificial intelligence
can be used [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]. Neural networks or fuzzy logic are a popular
tool. Especially the spiking neural network [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] – mathematical
representation of mechanisms occurring in the human brain is
an interesting subject, which is constantly being developed
and analyzed in order to increase its accuracy and reduce
the number of calculations. In [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]–[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], the authors proposed
the idea of using recursive approach to the classification
of working groups or in the medical purposes. Again in
[
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], the idea of using and implementing convolutional neural
network on mobile phones was described. Important issue is
the creation of hybrid solutions like fuzzy logic with Markov
chains [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] or neuro-fuzzy controler [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. In this paper, we
proposed a hybrid solution based on soft sets and k-nearest
neighbors.
        </p>
        <p>The products are analyzed by the algorithm based on
soft sets. The list of allowed products is created by the
following formula:
(
2 ( 2
^ 2
^
2 ));
(2)
where represents allowed products, is the item in a
set and ; ; are levels of required proteins, fats and
carbohydrates</p>
        <p>We use the K-Nearest Neighbors algorithm which is
one of the non-parametric regression algorithms used in
statistics to predict the value of a certain variable. It is based
on following steps:
comparison of the values of explanatory variables for
observations of C with values of these variables for each
observation in the training set;
selection of k, which is a predetermined number, of the
nearest to C observations from the set; average of the value
of the explained variable for selected observations so as a
result we get a forecast.</p>
        <p>
          The mentioned kNN algorithm [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] determines the product
that adapts best to the current daily requirement for
macronutrients according to the formula:
where is the level of matching, ; ; are differences
between needs for macronutrients and macronutrients of the
product
        </p>
        <p>The proteins have doubled value due to the high importance
of this element and the rare occurrence in the products.</p>
        <p>III. DESCRIPTION OF THE PROPOSED SYSTEM</p>
        <p>At the beginning we use our own Cerebrum algorithm . It is
used for dynamic distribution of nutritional values, depending
on the products, their nutritional values and the user’s daily
demand. The dynamic division is based on checking the
user’s needs and then subtracting from them the sum of the
values of the macroelements used in the list of products.
Next, it’s divided by the number of products declared by the
user and decreased by the number of already used products.
Example: the user declared 10 products. The program found
3 products. Therefore, the division will be by 7, because:
10 3 = 7.</p>
        <p>
          The received request is sent to the Soft Set algorithm [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ].
Then, from the list of available products soft sets select those
products that do not exceed the daily requirement. It was
planned for people who want to reduce body fat so they do
not exceed the daily demand and can enjoy their dream figure
sooner. Additionally, it provides correct results by the kNN
algorithm, which will be explained in the next section.
The obtained products are analyzed by the kNN algorithm.
This involves selecting the products that are closest to the
requirements. If the macroelements of the products exceeded
the daily demand, the distance would be negative, hence the
protection in the Soft Set algorithm.
        </p>
        <p>Finally, the best suited products are added to the list of
products and the algorithm is executed until the number of
products is reached.</p>
      </sec>
      <sec id="sec-1-2">
        <title>A. Pseudocode of the proposed algorithm</title>
        <p>Cerebrum:
get protein, fat and carbohydrates from user
get number of meals from user
for (number of meal)
get product from kNN
add product to list
return products
kNN:
get protein, fat and carbohydrates from
cerebrum
get products from SoftSet
for each product in products
calculate fitness score
if (fitness score &gt; previous the best
fitness score)
best product = product
return best product
SoftSet:
get protein, fat and carbohydrates from kNN
get products from Download
for each product in products</p>
        <p>if (requirements == true)
Add(product) to List
return List
Download:
get products from database
return products</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>IV. EXPERIMENTS</title>
      <p>We carried out a series of several experiments. A few of
examples below
1) Man weighing 100 kg, interested in building the
muscles.</p>
      <p>Our program estimated following macronutrient needs:
proteins 200 g, fats 100 g, carbohydrates 575 g
2) Man weighing 100 kg, interested in weight reduction.</p>
      <p>Our program estimated following macronutrient needs:
proteins 200 g, fats 70 g, carbohydrates 292 g
3) Woman weighing 70 kg, interested in loosing weight.</p>
      <p>Our program estimated following macronutrient needs:
proteins 140, fats 50, carbohydrates 185g
4) Woman weighing 50 kg interested in muscles building.</p>
      <p>Our program estimated following macronutrient needs:
100g proteins, 45g fats, 223g carbohydrates
Person
1
2
3
4
Average
We can see from the Table I and diagram below that the
estimated results are close to the expected daily demand for
macronutrients.</p>
      <p>The lowest mismatch turned out to occur for carbohydrates.
The protein level was also very satisfactory. The greatest
mismatch level of the program was for the fats.</p>
      <p>Interestingly, the perfect fit of the fats was noticed for the
person 2 from the experiment who wanted to lose weight.
Other results for fats led to a more than 10 percent mismatch
in average.</p>
      <p>The final average mismatch of the program is less than 5
percent. You can therefore acknowledge the results of the
program as reliable.</p>
    </sec>
    <sec id="sec-3">
      <title>V. CONCLUSIONS</title>
      <p>Based on the results of the analyzed persons, it can be
concluded that the program is very good at finding products
with an adequate supply of protein and carbohydrates. The
level of fats is almost 89%, which is a satisfactory level.
The average lapse of the program was 4.66%, which is
a very good result.</p>
      <p>Statistically, the higher level of mismatch connected with
fats than level of mismatch connected with of proteins
or carbohydrates may result from the initially lower daily
demand for these macronutrients. As a result, over the
whole division, fat is more than 4.5 times less common than
carbohydrates, having the same search weight in the kNN
algorithm.</p>
      <p>However, an interesting case is person number 2.
Proportionally, the amount of macronutrients is not much
different from other cases. However, the missing amount of
fat was 0 %. At the same time, this person has the lowest
mismatch bias, which is only 2%.</p>
      <p>The program allows to efficiently search for products that
allow effective help in achieving goals. Most importantly, it
does not use stereotypical divisions for the "healthy" and
"unhealthy" food. Instead, each food product is treated objectively,
according to its properties. It avoids subconscious thinking
about food products as good or bad.</p>
      <p>In our innovative application, everything depends on objective
values. Therefore, a person who wants to reduce weight can
eat a cheeseburger and a pizza while losing weight.
An important attribute of the application is also the control
of the amount of dishes. Thanks to this the user can freely
choose whether one wants to eat pizza or a large amount of
vegetables or other products.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>F.</given-names>
            <surname>Beritelli</surname>
          </string-name>
          , G. Capizzi,
          <string-name>
            <given-names>G. Lo</given-names>
            <surname>Sciuto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Scaglione</surname>
          </string-name>
          , “
          <article-title>Automatic heart activity diagnosis based on gram polynomials and probabilistic neural networks,” Biomedical engineering letters</article-title>
          , vol.
          <volume>8</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>77</fpage>
          -
          <lpage>85</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Brusca</surname>
          </string-name>
          , G. Capizzi,
          <string-name>
            <given-names>G. Lo</given-names>
            <surname>Sciuto</surname>
          </string-name>
          , and G. Susi, “
          <article-title>A new design methodology to predict wind farm energy production by means of a spiking neural network-based system</article-title>
          ,”
          <source>International Journal of Numerical Modelling: Electronic Networks, Devices and Fields</source>
          , vol.
          <volume>32</volume>
          , no.
          <issue>4</issue>
          , p.
          <fpage>e2267</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Pappalardo</surname>
          </string-name>
          , E. Tramontana,
          <string-name>
            <given-names>R. K.</given-names>
            <surname>Nowicki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. T.</given-names>
            <surname>Starczewski</surname>
          </string-name>
          , and M. Woz´niak, “
          <article-title>Toward work groups classification based on probabilistic neural network approach,”</article-title>
          <source>in International Conference on Artificial Intelligence and Soft Computing</source>
          . Springer,
          <year>2015</year>
          , pp.
          <fpage>79</fpage>
          -
          <lpage>89</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woz</surname>
          </string-name>
          ´niak, D. Połap, G. Capizzi,
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Sciuto</surname>
          </string-name>
          ,
          <string-name>
            <surname>L.</surname>
          </string-name>
          <article-title>Kos´mider, and</article-title>
          K. Frankiewicz, “
          <article-title>Small lung nodules detection based on local variance analysis and probabilistic neural network,” Computer methods and programs in biomedicine</article-title>
          , vol.
          <volume>161</volume>
          , pp.
          <fpage>173</fpage>
          -
          <lpage>180</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Wozniak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Polap</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Kosmider</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , and E. Tramontana, “
          <article-title>A novel approach toward x-ray images classifier</article-title>
          ,” in
          <source>2015 IEEE Symposium Series on Computational Intelligence. IEEE</source>
          ,
          <year>2015</year>
          , pp.
          <fpage>1635</fpage>
          -
          <lpage>1641</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and J.</given-names>
            <surname>Sun</surname>
          </string-name>
          , “
          <article-title>Shufflenet: An extremely efficient convolutional neural network for mobile devices</article-title>
          ,”
          <source>in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>6848</fpage>
          -
          <lpage>6856</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>H.</given-names>
            <surname>Xie</surname>
          </string-name>
          , G. Tian, G. Du,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Huang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zheng</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T. H.</given-names>
            <surname>Luan</surname>
          </string-name>
          , “
          <article-title>A hybrid method combining markov prediction and fuzzy classification for driving condition recognition</article-title>
          ,
          <source>” IEEE Transactions on Vehicular Technology</source>
          , vol.
          <volume>67</volume>
          , no.
          <issue>11</issue>
          , pp.
          <volume>10</volume>
          <fpage>411</fpage>
          -
          <lpage>10</lpage>
          424,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Parvathavardhini</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Manju</surname>
          </string-name>
          , “
          <article-title>Cancer gene detection using neuro fuzzy classification algorithm</article-title>
          ,”
          <source>International Journal of Scientific Research in Computer Science, Engineering and Information Technology</source>
          , vol.
          <volume>3</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>1223</fpage>
          -
          <lpage>1229</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>N. S.</given-names>
            <surname>Altman</surname>
          </string-name>
          , “
          <article-title>An introduction to kernel and nearest-neighbor nonparametric regression,” The American Statistician</article-title>
          , vol.
          <volume>46</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>175</fpage>
          -
          <lpage>185</lpage>
          ,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>P. K.</given-names>
            <surname>Maji</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Biswas</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Roy</surname>
          </string-name>
          , “
          <article-title>Soft set theory,”</article-title>
          <source>Computers &amp; Mathematics with Applications</source>
          , vol.
          <volume>45</volume>
          , no.
          <issue>4-5</issue>
          , pp.
          <fpage>555</fpage>
          -
          <lpage>562</lpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>B.</given-names>
            <surname>Ahmad</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Kharal</surname>
          </string-name>
          , “
          <article-title>On fuzzy soft sets,” Advances in fuzzy systems</article-title>
          , vol.
          <year>2009</year>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>B.</given-names>
            <surname>Shaw</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Jebara</surname>
          </string-name>
          , “Structure preserving embedding,”
          <source>in Proceedings of the 26th Annual International Conference on Machine Learning. ACM</source>
          ,
          <year>2009</year>
          , pp.
          <fpage>937</fpage>
          -
          <lpage>944</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>V.</given-names>
            <surname>Kuznetsov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. Y.</given-names>
            <surname>Andreev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Kuznetsov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Nikolaeva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Zotova</surname>
          </string-name>
          , and
          <string-name>
            <given-names>N.</given-names>
            <surname>Gudkova</surname>
          </string-name>
          , “
          <article-title>Heavily doped si layers grown by molecular beam epitaxy in vacuum,” physica status solidi (a), vol</article-title>
          .
          <volume>127</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>371</fpage>
          -
          <lpage>376</lpage>
          ,
          <year>1991</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>