{"id":3303,"date":"2019-06-11T17:06:11","date_gmt":"2019-06-11T16:06:11","guid":{"rendered":"https:\/\/www.alvantia.com\/?p=3303"},"modified":"2019-06-11T17:10:52","modified_gmt":"2019-06-11T16:10:52","slug":"introduction-to-machine-learning","status":"publish","type":"post","link":"https:\/\/www.alvantia.com\/en\/introduction-to-machine-learning\/","title":{"rendered":"Introduction to Machine Learning"},"content":{"rendered":"\n<p class=\"has-normal-font-size\">You have almost certainly heard about Machine Learning lately, and that is because this scientific discipline is being applied to more and more fields. This is due to two main reasons: great technological progress, especially the computing capacity, and the large amount of data that we currently have.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"has-normal-font-size\"><strong>Machine Learning<\/strong> is a branch of artificial intelligence that focuses on the study of algorithms to create predictive models.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/1.png\" alt=\"\" class=\"wp-image-3341\" width=\"302\" height=\"297\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/1.png 535w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/1-300x295.png 300w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><figcaption> Illustration 1. Structure of Artificial Intelligence <\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"has-normal-font-size\">It\nessentially works as follows: from some training data, a mathematical model is\ngenerated based on disciplines such as statistics and algebra. New data are\nsubsequently introduced to this model to make the prediction, as shown in\nIllustration 2.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">In the\nmodel training process, input data are divided into two or three sets. One of\nthem is allocated to the training itself, which is the biggest set. The second\nis used to test the model and the third for validation purposes. The latter is\noptional as it depends on the amount of data we have. As a general rule, it is\nrecommended that more data should be assigned to training than to testing. In\nthe event of using an extra set for validation, the test set is usually divided\nand a part is assigned to the latter set. For example, if 60% is allocated to\ntraining and 40% to testing, the latter percentage is divided with the following\ndistribution: 20% for testing and the remaining 20% for validation.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/2.jpg\" alt=\"\" class=\"wp-image-3319\" width=\"496\" height=\"386\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/2.jpg 495w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/2-300x233.jpg 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><figcaption>Illustration 2. Generic operation of Machine Learning algorithms<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"has-normal-font-size\">There is a great variety of algorithms, which are grouped into three main categories depending on the type of learning that takes place in the creation of the mathematical model. These are explained below.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. <strong>Supervised Learning<\/strong><\/h4>\n\n\n\n<p class=\"has-normal-font-size\">In <strong><em>supervised\nlearning<\/em><\/strong>, a predictive mathematical model is created by applying\ncertain algorithms to a set of data, which already have their corresponding\ncategory. That is to say, each element of the set has a label associated with\nit which defines the category this element corresponds to for the purpose of\nintroducing unclassified data into the model and ensuring that this one\nprovides us with the category to which they belong.&nbsp; <\/p>\n\n\n\n<p class=\"has-normal-font-size\">The\ngeneration process is based on classifying the elements of the training set and\ncomparing the result with the label associated with each element. This process\nis carried out iteratively to adjust the predictive model.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">One of the best-known supervised learning algorithms is based on <strong>Decision Trees<\/strong>, which use the &#8220;divide-and-conquer&#8221; technique to classify input data, taking into account the characteristics\/properties of the data. This algorithm in particular is based on probability, using the entropy value, which reflects the level of uncertainty or disorder, showing which of the data attributes are most relevant in the decision-making process. This value is between 0 and 1.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/treee.png\" alt=\"\" class=\"wp-image-3309\" width=\"242\" height=\"327\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/treee.png 508w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/treee-222x300.png 222w\" sizes=\"auto, (max-width: 242px) 100vw, 242px\" \/><figcaption>Illustration 3. Representation of a decision tree<\/figcaption><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">2. <strong>Unsupervised Learning<\/strong><\/h4>\n\n\n\n<p class=\"has-normal-font-size\">In\ncontrast to the previous category, in <strong><em>unsupervised learning<\/em><\/strong>, the training\ndata set used does not have labels. Therefore, these algorithms only take into\naccount the attributes\/characteristics of these data. Within this category, the\nbest-known algorithms are based on the clustering process.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">An\nexample of an algorithm belonging to this type of learning is the so-called <strong>K-Means<\/strong>, whose purpose is to group data\ninto k groups according to their characteristics\/attributes. It is based on the\nuse of quadratic distance.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">The algorithm is divided into four phases: <\/p>\n\n\n\n<p class=\"has-normal-font-size\">-K centres are established in the vector space in which it is working and these can be selected in different ways, one of them being at random. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">-Once the centres are defined, the data are associated with the centre with the closest average. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">-The algorithm then recalculates the position of the centres with respect to the data associated with each centre. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">-Phases 2 and 3 are repeated iteratively, as many times as configured. Ideally, the number of repetitions must be set until convergence is reached.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos1-1.png\" alt=\"\" class=\"wp-image-3311\" width=\"346\" height=\"305\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos1-1.png 580w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos1-1-300x265.png 300w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><figcaption>Illustration 4. Input data<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos2-1.png\" alt=\"\" class=\"wp-image-3313\" width=\"351\" height=\"320\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos2-1.png 560w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/puntos2-1-300x274.png 300w\" sizes=\"auto, (max-width: 351px) 100vw, 351px\" \/><figcaption> Illustration 5. Grouped data <\/figcaption><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">3. <strong>Reinforcement Learning<\/strong><\/h4>\n\n\n\n<p class=\"has-normal-font-size\">It\nincludes the algorithms that most resemble human learning, since it is based on\ntrial and error. To achieve this behaviour, a reward\/punishment function is\nimplemented. Training data are labelled using a mathematical function that can\nbe discrete or linear. In this type of learning, the decision-making process is\nmore important to reach the target than the solution itself. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">That is\nto say, after each decision made by the algorithm until it reaches the target,\na reward is given, the value of which depends on the correctness of the\ndecision made. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">After\nfinding the solution, the quality of the decisions taken is evaluated based on\nthe set of rewards\/punishments obtained during the process of solving the\nproblem.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">The problems to which this type of algorithm is applied have two main components:<\/p>\n\n\n\n<p class=\"has-normal-font-size\">-An <strong>agent<\/strong>, which represents the entity that performs the actions\/decisions, in this case the algorithm.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">-And an <strong>environment<\/strong>, which represents the context of the problem.&nbsp; <\/p>\n\n\n\n<p class=\"has-normal-font-size\">In short,\nthis type of learning is intended to optimise the process of finding the\nsolution to a particular problem.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">An\nexample of the application of this type of learning can be found in\nmaze-solving algorithms. In this particular case, the context is the maze\nitself, which has attributes such as distribution, and the agent is the\nalgorithm that is applied to solve it.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">In each step, the agent is rewarded or punished with a value that accumulates. In the event that it advances against a wall, it will obtain a negative value as &#8220;punishment&#8221;, and in the event that it advances toward a path, it will be given a positive value that will vary depending on how good that path is, as shown in Illustration 7.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">The algorithm, after reaching the end, will have the accumulation of rewards\/punishments and this value will give you the information as to how good the path it has taken is. Training is considered complete when you have found the optimal path, that is, the path in which the accumulated reward value is the highest. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/3-2.jpg\" alt=\"\" class=\"wp-image-3321\" width=\"279\" height=\"278\" srcset=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/3-2.jpg 263w, https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/3-2-150x150.jpg 150w\" sizes=\"auto, (max-width: 279px) 100vw, 279px\" \/><figcaption>Illustration 6. Maze distribution<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.alvantia.com\/wp-content\/uploads\/2019\/06\/3-3-2.jpg\" alt=\"\" class=\"wp-image-3334\" width=\"295\" height=\"292\"\/><figcaption>Illustration 7. Reward values<\/figcaption><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Overfitting and Underfitting<\/strong><strong><\/strong><\/h4>\n\n\n\n<p class=\"has-normal-font-size\">To\nconclude the article, we would like to mention two problematic situations that\ncan occur during and after model training.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">The\nfirst problem we will deal with is called <strong>Overfitting<\/strong>.\nIt occurs when the model fits so closely with the training data that when new\ndata are entered for a particular category, if they do not have exactly the\nsame characteristics as the training data belonging to that same category, they\nwill not be classified correctly. <\/p>\n\n\n\n<p class=\"has-normal-font-size\">For\nexample, in an animal classification algorithm, if your training data only\ninclude characteristics of a certain dog and this problem occurs, when new data\nrelating to a dog with characteristics different from the training are entered\ninto the model, it will not be recognised as a dog.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">And the\nsecond case is called <strong>Underfitting<\/strong>,\nwhich is the opposite of the previous one. It happens when the model fits so\npoorly that it is unable to make an acceptable classification\/prediction, even\nthough the new data have characteristics that are very similar to the data used\nduring training.<\/p>\n\n\n\n<p class=\"has-normal-font-size\">If you are interested in knowing more about this scientific\ndiscipline, stay tuned! In upcoming articles we will delve a little deeper into\nthe world of Machine Learning.<\/p>\n<div class=\"clearfix\"><\/div>","protected":false},"excerpt":{"rendered":"<p>You have almost certainly heard about Machine Learning lately, and that is because this scientific discipline is being applied to more and more fields. This is due to two main reasons: great technological progress, especially the computing capacity, and the large amount of data that we currently have.<\/p>\n<p class=\"cv-read-more-button\"><a class=\"cv-button button is-standard color-accent has-icon icon-after\" href=\"https:\/\/www.alvantia.com\/en\/introduction-to-machine-learning\/\">Continue Reading<i class=\"button-icon icon-right-open-big\"><\/i><\/a><\/p>\n","protected":false},"author":5,"featured_media":3256,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[279,280],"tags":[292],"class_list":["post-3303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alvantia-en-2","category-technology-2","tag-machine-learning","not-single"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/posts\/3303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/comments?post=3303"}],"version-history":[{"count":19,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/posts\/3303\/revisions"}],"predecessor-version":[{"id":3344,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/posts\/3303\/revisions\/3344"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/media\/3256"}],"wp:attachment":[{"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/media?parent=3303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/categories?post=3303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alvantia.com\/en\/wp-json\/wp\/v2\/tags?post=3303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}