{"id":197,"date":"2018-01-09T10:20:00","date_gmt":"2018-01-09T09:20:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2018\/01\/09\/what-is-an-activation-function-in-neural-networks\/"},"modified":"2020-08-22T11:05:20","modified_gmt":"2020-08-22T09:05:20","slug":"what-is-an-activation-function-in-neural-networks","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/what-is-an-activation-function-in-neural-networks\/","title":{"rendered":"What is an Activation Function in Neural Networks"},"content":{"rendered":"<div style=\"color: #555555; font-size: 18px; line-height: 30px; text-align: justify;\">\n<div style=\"font-family: 'segoe ui';\">Activation Functions play a very important role in Neural Network so understanding them is key to getting a clearer understanding on how neural networks work.<\/p>\n<p><b>What is an Activation Function? <\/b><br \/>An activation function in neural network is a function the that takes the input or the set of inputs to a node and produces an output that is within a particular range say&nbsp; between 0 and 1(in the case of binary activation function). The input to an activation function could be a formula or even an output of another function.<\/p>\n<p><b>The Logistic Function<\/b><br \/>The Logistic function a&nbsp; type of sigmoid function that takes an input and produces an output between 0 and 1. The formula for the logistic function is given below:<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-Ymn1OWaa8n8\/WlSWQZg8xBI\/AAAAAAAAAqQ\/0PPmdRkZpqgTwZDloDvY8740JF2XWF2xgCLcBGAs\/s1600\/Logistic-Function.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"101\" data-original-width=\"303\" height=\"66\" src=\"https:\/\/3.bp.blogspot.com\/-Ymn1OWaa8n8\/WlSWQZg8xBI\/AAAAAAAAAqQ\/0PPmdRkZpqgTwZDloDvY8740JF2XWF2xgCLcBGAs\/s200\/Logistic-Function.jpg\" width=\"200\" \/><\/a><\/div>\n<p><\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/1.bp.blogspot.com\/-Q8YMTSW3hhA\/Wk_t7R9nWTI\/AAAAAAAAAmA\/KIq3eWqKvxATYdMZPApHywWoU-O7ENVdwCPcBGAYYCw\/s1600\/Sigmoid-function.JPG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"220\" data-original-width=\"429\" height=\"205\" src=\"https:\/\/1.bp.blogspot.com\/-Q8YMTSW3hhA\/Wk_t7R9nWTI\/AAAAAAAAAmA\/KIq3eWqKvxATYdMZPApHywWoU-O7ENVdwCPcBGAYYCw\/s400\/Sigmoid-function.JPG\" width=\"400\" \/><\/a><\/div>\n<p>On problem with the logistic function is the vanishing gradient problem. This means that when a neurons activation approaches the limits of either 0 or 1, the gradient at that point gets very close to 0.<br \/>Another problem with the logistic function is that it is not zero-centered as well as the problem of slow convergence<\/p>\n<p><b>The Hyperbolic Tangent Function<\/b><br \/>The Hyperbolic tangent is another type of sigmoid function that takes an input and produces an output between -1 and +1. Since the output of the Hyperbolic tangent function is 0-centere, it is preferred to the logistic function. But just like the logistic function, it also suffers from the vanishing gradient problem. The formula for the hyperbolic tangent function is given below<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/2.bp.blogspot.com\/-wjpPadV-Xwk\/WlSWbokTyAI\/AAAAAAAAAqU\/D34CDEE0iggzlB44vl281SUFgCAhChn4wCLcBGAs\/s1600\/Hyperbolic-tangent-function-formula.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"102\" data-original-width=\"557\" height=\"58\" src=\"https:\/\/2.bp.blogspot.com\/-wjpPadV-Xwk\/WlSWbokTyAI\/AAAAAAAAAqU\/D34CDEE0iggzlB44vl281SUFgCAhChn4wCLcBGAs\/s320\/Hyperbolic-tangent-function-formula.jpg\" width=\"320\" \/><\/a><\/div>\n<p><\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/1.bp.blogspot.com\/-yFDcusHo-BM\/WlIwsZ96xqI\/AAAAAAAAAoc\/M3YjIaNt_poi_r1Kkkhe4nxJWEakYXxkACPcBGAYYCw\/s1600\/Hyperbolic-tangent-function.JPG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"651\" data-original-width=\"849\" height=\"245\" src=\"https:\/\/1.bp.blogspot.com\/-yFDcusHo-BM\/WlIwsZ96xqI\/AAAAAAAAAoc\/M3YjIaNt_poi_r1Kkkhe4nxJWEakYXxkACPcBGAYYCw\/s320\/Hyperbolic-tangent-function.JPG\" width=\"320\" \/><\/a><\/div>\n<p><b>The Rectified Linear Unit<\/b><br \/>The ReLU is an activation function in neural networks defined as the positive part of its argument. The ReLU is defined as<\/p>\n<div style=\"text-align: center;\"><span style=\"color: black;\"><i><span style=\"font-family: Georgia, &quot;Times New Roman&quot;, serif;\">R(x) = max(0,x)<\/span><\/i><\/span><\/div>\n<p><span style=\"color: black;\"><i><span style=\"font-family: Georgia, &quot;Times New Roman&quot;, serif;\">&nbsp;<\/span><\/i><\/span><br \/>this means that the value is is zero when x is less than zero and linear with a slope of 1 when x is greater than zero. It was noted that it had a 6 x improvement over the the hyperbolic tangent function in a paper by Alex Krizhevsky on ImageNet Classification.<br \/>The formula for the rectified linear function is given as:<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-ypEHgwEWRQY\/WlSWvEp_QOI\/AAAAAAAAAqc\/HsVMkEWHlQoo8e9A-hIeNFhjdmElFoobQCLcBGAs\/s1600\/ReLU%2BFunction.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"102\" data-original-width=\"424\" height=\"76\" src=\"https:\/\/3.bp.blogspot.com\/-ypEHgwEWRQY\/WlSWvEp_QOI\/AAAAAAAAAqc\/HsVMkEWHlQoo8e9A-hIeNFhjdmElFoobQCLcBGAs\/s320\/ReLU%2BFunction.jpg\" width=\"320\" \/><\/a><\/div>\n<p>Other variants of the ReLU function are the Leaky Rectified Linear Unit (Leaky ReLU), the Parametric ReLU and the Exponential Linear unit. I would recommend you do some personal research on these and other activation function.<\/p>\n<p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Activation Functions play a very important role in Neural Network so understanding them is key to getting a clearer understanding on how neural networks work. &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[11,16,14],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/197"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":1,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":1468,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/197\/revisions\/1468"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}