{"id":3257,"date":"2016-05-23T17:37:31","date_gmt":"2016-05-23T15:37:31","guid":{"rendered":"https:\/\/geekosas.com\/?p=3257"},"modified":"2026-05-23T17:38:23","modified_gmt":"2026-05-23T15:38:23","slug":"what-are-neural-networks","status":"publish","type":"post","link":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/what-are-neural-networks\/","title":{"rendered":"What are neural networks?"},"content":{"rendered":"<p>Many have heard at some point about neural networks or &quot;artificial intelligence,&quot; and we have to be honest: when someone uses those words, it sounds like a total computing Einstein straight out of Terminator 2.<\/p>\n<p><!--more--><\/p>\n<p>Basically, neural networks are applied when the developer has absolutely no idea how to approach a problem, so they prefer to let the computer &quot;understand&quot; it and do the work of modeling the problem. This is achieved by creating a model (or formula) that needs to be calibrated.<br \/>\nA neural network has two particularities: the functional form or model and the strategy to calibrate it. I&#8217;ll talk about these particularities in the order they were named, but first let&#8217;s remember what a model or representation of reality is:<br \/>\nA model we all know from physics in high school, when we were taught how springs work, the model was: *<em>extension = K <\/em> force**, where K had to be measured through experiments and then, with a regression, the model was calibrated. This model had the peculiarity of giving a &quot;straight line,&quot; because it is a linear model (as can be seen in the following graph).<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"79\" data-permalink=\"https:\/\/geekosas.com\/index.php\/es\/2016\/03\/27\/que-son-las-redes-neuronales\/muelle4\/\" data-orig-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/muelle4.gif?fit=249%2C171&amp;ssl=1\" data-orig-size=\"249,171\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"modelo_resorte\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/muelle4.gif?fit=249%2C171&amp;ssl=1\" class=\"alignnone size-full wp-image-79\" src=\"https:\/\/i0.wp.com\/www.geekosas.com\/wp-content\/uploads\/2016\/03\/muelle4.gif?resize=249%2C171&#038;ssl=1\" alt=\"\" width=\"249\" height=\"171\" \/><\/p>\n<p>I want to make it clear that in this and in every model, there are 3 components:<\/p>\n<ol>\n<li>Value to predict: In this case, we want to predict the extension<\/li>\n<li>Input variables or Data: in this case, it&#8217;s the force<\/li>\n<li>Calibration Constants: in this case, K.<\/li>\n<\/ol>\n<p>A neural network is a NON-LINEAR model. It&#8217;s so non-linear that it can take practically any shape and can depend on many <strong>variables<\/strong> and has even more <strong>constants<\/strong>, and although this non-linear function can take almost any form, its structure is quite clear.<br \/>\nThe neural network is made up of many mini-functions, each of which is called: neuron, perceptron, response function, S-curve, or whatever the person typing at that moment pleases. The important thing is that each of these functions is a neuron connected to other neurons. Neurons are connected in layers, where each neuron takes the result from the previous ones, processes it, and passes it to the next sequentially, generating a network that looks like this:<br \/>\n<a href=\"https:\/\/i0.wp.com\/geekosas.com\/geekosas\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?ssl=1\" rel=\"attachment wp-att-82\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"82\" data-permalink=\"https:\/\/geekosas.com\/index.php\/es\/2016\/03\/27\/que-son-las-redes-neuronales\/index_img_4\/\" data-orig-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?fit=1078%2C673&amp;ssl=1\" data-orig-size=\"1078,673\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"red neuronal\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?fit=1024%2C639&amp;ssl=1\" class=\"alignnone wp-image-82\" src=\"https:\/\/i0.wp.com\/www.geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4-300x187.jpg?resize=637%2C397\" alt=\"\" width=\"637\" height=\"397\" srcset=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?resize=300%2C187&amp;ssl=1 300w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?resize=768%2C479&amp;ssl=1 768w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?resize=1024%2C639&amp;ssl=1 1024w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/index_img_4.jpg?w=1078&amp;ssl=1 1078w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/a><br \/>\nIn the diagram above, each red square is an input datum and each circle is a neuron, where each neuron depends on all the data from the previous stage (there can be n layers).<br \/>\nThus, in our layer W1 we have functions of the form: $f(x_1, x_2, x_3, \\ldots, x_n, 1)$, where a simple function could be a linear one: $ f(x_1, x_2, x_3, \\ldots, x_n, 1) = B_1 x_1 + B_2 x_2 + B_3 x_3 + \\ldots + c $ and, as I said before, this function is up to the programmer, generally determined by trial and error. In general, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Logistic_function\">S-curves or logistic functions<\/a> are used.<br \/>\nWhat makes neural networks and most of these artificial intelligence models special is the way they are calibrated. Since they are complex and generally have many input variables and many samples, if we approached them the same way as a linear regression, we would crash even the most powerful NASA computer. Therefore, instead of calibrating, we talk about &quot;training&quot; the neural network.<br \/>\nTraining the neural network consists of taking one of the sample cases, applying the model, and seeing the result. If the result is good, keep the network as is; if it&#8217;s bad, adjust the parameters a little to make it better, and then repeat with the next sample. After doing this several times for each sample, we will have our trained neural network ready to travel back in time to destroy Skynet.<br \/>\nUpdate: If you liked the post, go play with neural networks in our other post called <a href=\"http:\/\/www.geekosas.com\/index.php\/2016\/04\/18\/jugando-con-redes-neuronales\/\">Playing with Neural Networks<\/a><br \/>\nIf you liked it, follow us on any of our channels; all publications will appear there.<\/p>\n<ul>\n<li><a href=\"https:\/\/twitter.com\/geekosas_com\">Twitter @geekosas_com<\/a><\/li>\n<li><a href=\"https:\/\/www.facebook.com\/geekosas\/\">Facebook @geekosas<\/a><\/li>\n<li><a href=\"https:\/\/cl.linkedin.com\/in\/danielfischerm\">LinkedIn (my personal account)<\/a><\/li>\n<\/ul>\n<p>And don&#8217;t forget to share on your social media; your visits are my motivation.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Many have heard at some point about neural networks or &quot;artificial intelligence,&quot; and we have to be honest: when someone uses those words, it sounds <a class=\"mh-excerpt-more\" href=\"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/what-are-neural-networks\/\" title=\"What are neural networks?\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":92,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-3257","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sin-categoria"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/ai.jpg?fit=608%2C211&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8vjqF-Qx","jetpack-related-posts":[{"id":3323,"url":"https:\/\/geekosas.com\/index.php\/2018\/05\/23\/what-does-machine-learning-see\/","url_meta":{"origin":3257,"position":0},"title":"What does Machine Learning see?","author":"Daniel Fischer","date":"2018-05-23","format":false,"excerpt":"Machine learning algorithms can understand problems with hundreds or sometimes thousands of dimensions, thus seeing things that the human eye could not otherwise see. But how do these methods compare when the human eye can actually see? That is why we generated a series of experiments in 2 dimensions and\u2026","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2018\/08\/1_2UjSSQwW0bns1lPIuRxccQ.png?fit=1200%2C629&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2018\/08\/1_2UjSSQwW0bns1lPIuRxccQ.png?fit=1200%2C629&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2018\/08\/1_2UjSSQwW0bns1lPIuRxccQ.png?fit=1200%2C629&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2018\/08\/1_2UjSSQwW0bns1lPIuRxccQ.png?fit=1200%2C629&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2018\/08\/1_2UjSSQwW0bns1lPIuRxccQ.png?fit=1200%2C629&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3269,"url":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/playing-with-neural-networks\/","url_meta":{"origin":3257,"position":1},"title":"Playing with Neural Networks","author":"Daniel Fischer","date":"2016-05-23","format":false,"excerpt":"A few days ago I wrote about neural networks, trying to explain in a simple way how they work and why this type of technology is called \"artificial intelligence.\" The important thing about this technique and what makes it so revolutionary is the concept of training, but it is often\u2026","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1200%2C715&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1200%2C715&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1200%2C715&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1200%2C715&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1200%2C715&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3300,"url":"https:\/\/geekosas.com\/index.php\/2017\/05\/23\/data-science-course-in-r\/","url_meta":{"origin":3257,"position":2},"title":"Data Science course in R","author":"Daniel Fischer","date":"2017-05-23","format":false,"excerpt":"On October 20, I will teach a Data Science course using R. The topics covered will be: Data Cleaning Supervised classification models: Logistic regression. Naive Bayes. Trees and Random Forest. Neural Networks. Grid Search (hyperparameter tuning). Evaluation of classification models. Unsupervised models: Dimensionality Reduction (PCA) -> Applied example of replicating\u2026","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/09\/Rprogramming.jpg?fit=1176%2C664&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/09\/Rprogramming.jpg?fit=1176%2C664&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/09\/Rprogramming.jpg?fit=1176%2C664&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/09\/Rprogramming.jpg?fit=1176%2C664&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/09\/Rprogramming.jpg?fit=1176%2C664&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3274,"url":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/segment-customers-step-by-step\/","url_meta":{"origin":3257,"position":3},"title":"Segment customers step by step","author":"Daniel Fischer","date":"2016-05-23","format":false,"excerpt":"Previously I wrote about neural networks (click here to see it). Neural networks and all other \"supervised methods\" are used when you have a sample of values to predict. But when you know what you want to achieve but do not have a sample of the value to predict, the\u2026","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/05\/kmenas6.png?fit=620%2C539&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/05\/kmenas6.png?fit=620%2C539&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/05\/kmenas6.png?fit=620%2C539&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3317,"url":"https:\/\/geekosas.com\/index.php\/2017\/05\/23\/who-voted-for-each-candidate-chilean-elections-2017\/","url_meta":{"origin":3257,"position":4},"title":"Who voted for each candidate? (Chilean Elections 2017)","author":"Daniel Fischer","date":"2017-05-23","format":false,"excerpt":"Last Sunday, the president of Chile was elected, so many pundits tried to explain how the votes from the first round were distributed to the second round. Since the vote is secret, no one can be wrong. That is why I decided to take a different approach from the standard\u2026","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/12\/1511132848-untitled-collage-3.jpg?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/12\/1511132848-untitled-collage-3.jpg?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/12\/1511132848-untitled-collage-3.jpg?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/12\/1511132848-untitled-collage-3.jpg?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/12\/1511132848-untitled-collage-3.jpg?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3306,"url":"https:\/\/geekosas.com\/index.php\/2017\/05\/23\/how-to-compare-the-performance-of-machine-learning-models\/","url_meta":{"origin":3257,"position":5},"title":"How to compare the performance of Machine Learning models","author":"Daniel Fischer","date":"2017-05-23","format":false,"excerpt":"A video of this item covered in the Data Science in R Course. https:\/\/youtu.be\/sKTYMwW3A3o","rel":"","context":"In &quot;Sin categor\u00eda&quot;","block_context":{"text":"Sin categor\u00eda","link":"https:\/\/geekosas.com\/index.php\/category\/sin-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2017\/10\/homepage-scales-min.png?fit=400%2C400&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/comments?post=3257"}],"version-history":[{"count":1,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3257\/revisions"}],"predecessor-version":[{"id":3258,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3257\/revisions\/3258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/media\/92"}],"wp:attachment":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/media?parent=3257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/categories?post=3257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/tags?post=3257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}