{"id":3269,"date":"2016-05-23T17:44:40","date_gmt":"2016-05-23T15:44:40","guid":{"rendered":"https:\/\/geekosas.com\/?p=3269"},"modified":"2026-05-23T17:45:06","modified_gmt":"2026-05-23T15:45:06","slug":"playing-with-neural-networks","status":"publish","type":"post","link":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/playing-with-neural-networks\/","title":{"rendered":"Playing with Neural Networks"},"content":{"rendered":"<p>A few days ago I wrote <a href=\"http:\/\/geekosas.com\/index.php\/2016\/03\/27\/que-son-las-redes-neuronales\/\">about neural networks<\/a>, trying to explain in a simple way how they work and why this type of technology is called &quot;artificial intelligence.&quot;<\/p>\n<p>The important thing about this technique and what makes it so revolutionary is the concept of training, but it is often difficult to imagine how this happens and how the parameters affect the result.<\/p>\n<p>To help us out, our friends at <a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\">TensorFlow<\/a> created a graphical tool that shows us the training process of a neural network, available at <a href=\"http:\/\/playground.tensorflow.org\/\" target=\"_blank\"><a href=\"http:\/\/playground.tensorflow.org\/\">http:\/\/playground.tensorflow.org\/<\/a><\/a><\/p>\n<p>For those who don&#8217;t really know how to interpret the application, I&#8217;ll explain the basic components. To do that, I&#8217;ll use the following screenshot as an example:<br \/>\n&nbsp;<\/p>\n<p><!--more--><br \/>\n<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"691\" data-permalink=\"https:\/\/geekosas.com\/index.php\/es\/2016\/04\/18\/jugando-con-redes-neuronales\/tensorflow\/\" data-orig-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1224%2C729&amp;ssl=1\" data-orig-size=\"1224,729\" 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=\"tensorflow\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?fit=1024%2C610&amp;ssl=1\" class=\"alignnone wp-image-691\" src=\"https:\/\/i0.wp.com\/www.geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow-300x179.png?resize=789%2C471&#038;ssl=1\" alt=\"\" width=\"789\" height=\"471\" srcset=\"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?resize=300%2C179&amp;ssl=1 300w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?resize=768%2C457&amp;ssl=1 768w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?resize=1024%2C610&amp;ssl=1 1024w, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/tensorflow.png?w=1224&amp;ssl=1 1224w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>For the impatient who already want to see the app: If you press the &quot;play&quot; button, it will start training the neural network to predict the colors of the dots on the right.<\/p>\n<p>For the more geeky ones, the explanation begins here (I was impatient too). The application is divided into 5 sections: the top menu (in white), DATA, INPUT, HIDDEN LAYERS, and OUTPUT. The orange colors represent negative values, while the blue ones represent positive values. A white color means something close to 0.<\/p>\n<p><strong>DATA<\/strong> contains parameters about the sample to train the neural network. First, you can choose the general shape of the data, then the percentage of data left to test the model (see OUTPUT section), a noise factor to make the work more &quot;real&quot; for the neural network, and finally the number of cases that will enter each training cycle.<\/p>\n<p><strong>INPUT<\/strong> is the second section, and it is for choosing the variables that will enter the model. x1 and x2 are predefined, representing the vertical and horizontal axes of the OUTPUT section, but you can also choose transformations on these, such as x1*x2, sin(x1), or sin(x2). The lines coming out of each box correspond to the value of the constant associated with the parameter input in the activation or response function.<\/p>\n<p><strong>HIDDEN LAYERS<\/strong> is for configuring the connections the neural network will have. In the boxes, you can see the shape the function takes as x1 and x2 move. The lines connecting them represent the value of the constant associated with the data coming from the previous function\/neuron. In other words, if it is thick, it means it has high impact, and if it is blue, it has a positive constant, while if it is orange, it is negative.<\/p>\n<p><strong>OUTPUT<\/strong> shows the contrast between the value obtained by the neural network and the data it should fit (read the same way as the boxes in HIDDEN LAYER). When you start training, above the large graph, you will see a smaller graph that shows how the error percentage of the neural network evolves for both the control group and the training group. Below the large graph, you can choose to discretize (orange or blue) the network output and also show the control group. The control group is used to measure the model&#8217;s predictiveness; the network is never trained on these.<\/p>\n<p><strong>Top Menu<\/strong> is where the magic happens. To start training, you must press the play button and everything will begin. In &quot;Interactions,&quot; you see how many times it has trained with the entire sample of dots. Then come the parameters:<\/p>\n<ul>\n<li><strong>Learning Rate:<\/strong> Power of the impulse or learning of the networks.<\/li>\n<li><strong>Activation:<\/strong> Shape of the neurons&#8217; objective function; by default it is the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Hyperbolic_function\">tanh or S-curve<\/a>, the most used in this type of model.<\/li>\n<li><strong>Regularization:<\/strong> Honestly, I don&#8217;t know what this is&#8230; I hope someone can help me below; I imagine it is to simulate &quot;forgetting,&quot; when a negative stimulus is not received in a number of cycles, it should forget.<\/li>\n<li><strong>Regularization Rate:<\/strong> Speed parameter for the above&#8230;<\/li>\n<li><strong>Problem Type:<\/strong> Type of problem, whether it is classification or generating an objective function.<\/li>\n<\/ul>\n<p>Now you can play around with this web page. However, you should know that using neural networks is more magic than science, and in general you simply have to try different parameters for each problem, train, have a coffee, and try again.<\/p>\n<p>If you are very lost, I recommend reading my <a href=\"https:\/\/geekosas.com\/2016\/03\/27\/que-son-las-redes-neuronales\/\" target=\"_blank\">previous article on neural networks<\/a>.<\/p>\n<p>If you liked it, follow us on any of our channels; all posts 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 with 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>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 <a class=\"mh-excerpt-more\" href=\"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/playing-with-neural-networks\/\" title=\"Playing with Neural Networks\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":691,"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-3269","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\/04\/tensorflow.png?fit=1224%2C729&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8vjqF-QJ","jetpack-related-posts":[{"id":3257,"url":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/what-are-neural-networks\/","url_meta":{"origin":3269,"position":0},"title":"What are neural networks?","author":"Daniel Fischer","date":"2016-05-23","format":false,"excerpt":"Many have heard at some point about neural networks or \"artificial intelligence,\" and we have to be honest: when someone uses those words, it sounds like a total computing Einstein straight out of Terminator 2. Basically, neural networks are applied when the developer has absolutely no idea how to approach\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\/03\/ai.jpg?fit=608%2C211&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/ai.jpg?fit=608%2C211&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/03\/ai.jpg?fit=608%2C211&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3323,"url":"https:\/\/geekosas.com\/index.php\/2018\/05\/23\/what-does-machine-learning-see\/","url_meta":{"origin":3269,"position":1},"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":3300,"url":"https:\/\/geekosas.com\/index.php\/2017\/05\/23\/data-science-course-in-r\/","url_meta":{"origin":3269,"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":3269,"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":3260,"url":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/strava-the-cyclists-facebook\/","url_meta":{"origin":3269,"position":4},"title":"Strava &#8211; The Cyclist&#8217;s Facebook","author":"Daniel Fischer","date":"2016-05-23","format":false,"excerpt":"Strava is the Facebook of cyclists. At first it's hard to understand this app, but once you get it, it becomes a healthy addiction. Before I begin, I want to say that this is not Sponsored Content; I haven't reached that level of development in this blog yet. On Facebook\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\/www.geekosas.com\/wp-content\/uploads\/2016\/03\/capture-300x234.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.geekosas.com\/wp-content\/uploads\/2016\/03\/capture-300x234.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.geekosas.com\/wp-content\/uploads\/2016\/03\/capture-300x234.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3262,"url":"https:\/\/geekosas.com\/index.php\/2016\/05\/23\/arduino-2\/","url_meta":{"origin":3269,"position":5},"title":"Arduino","author":"Daniel Fischer","date":"2016-05-23","format":false,"excerpt":"It's hard to start this article. I've been playing with my new Arduino Starter Kit for a few days, and I think the best way to define it is: an electronic Lego. An excellent toy for those who enjoyed the blocks years ago. Arduino is a microcontroller easily programmable from\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\/ardr3a.jpg?fit=1200%2C829&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/ardr3a.jpg?fit=1200%2C829&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/ardr3a.jpg?fit=1200%2C829&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/ardr3a.jpg?fit=1200%2C829&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/geekosas.com\/wp-content\/uploads\/2016\/04\/ardr3a.jpg?fit=1200%2C829&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3269","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=3269"}],"version-history":[{"count":1,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3269\/revisions"}],"predecessor-version":[{"id":3270,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/posts\/3269\/revisions\/3270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/media\/691"}],"wp:attachment":[{"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/media?parent=3269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/categories?post=3269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekosas.com\/index.php\/wp-json\/wp\/v2\/tags?post=3269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}