{"id":1201,"date":"2016-03-24T11:28:11","date_gmt":"2016-03-24T11:28:11","guid":{"rendered":"http:\/\/blog.themusio.com\/?p=1201"},"modified":"2024-05-01T11:26:05","modified_gmt":"2024-05-01T02:26:05","slug":"theano-theano-python-language-library","status":"publish","type":"post","link":"https:\/\/blog.themusio.com\/?p=1201","title":{"rendered":"Theano: Theano Python Language Library"},"content":{"rendered":"<p><strong>Goal<br \/>\n<\/strong>In this ongoing summary we give a first introduction to the theano library, its basic functionality and usage in th field neural networks.<\/p>\n<p><strong>Motivation<\/strong><br \/>\nThe need for such a library is based on easily handling tensorial objects, like multi-array input data and weights in neural networks.<br \/>\nOf particular interest are symbolic operations that can perform differentiation as need for the backpropagation algorithm in order to update the models according to the seen training data.<br \/>\nA core functionality of libraries nowadays is to make use of GPUs in order to efficiently distribute the huge amount of computing operations.<\/p>\n<p><strong>Ingredients<\/strong><br \/>\nsymbolic operations, numpy, python<\/p>\n<p><strong>Steps<\/strong><br \/>\nThe theano library is an open source project lead by a machine learning group associated with a university.<br \/>\nIt nicely integrates the NumPy library widely used in the scientific community and makes use of the computational power of GPUs.<\/p>\n<p>Among its basic features are algebraic operations on vectors, matrices and multi-dimensional arrays.<br \/>\nThese objects have to be defined abstractly in advance together with the operations in which they appear.<br \/>\nTheano now allows to pass these objects and the computational steps to a function that is first compiled and can be later called on instances of the abstract objects.<\/p>\n<p>An extremely useful type of objects are so-called shared variables.<br \/>\nOnce defined this can be used among multiple functions and updated accordingly.<br \/>\nThis allows for an easy way to implement an updating mechanism for the weights of a neural network.<\/p>\n<p>A major advantage of the theano library is its use of symbolic operations for differentiation.<br \/>\nIn particular the theano.grad allows to differentiate previous defined functions with respect to any kind of parameters.<br \/>\nEspecially in neural networks where the optimization of the weights is handled by the backpropagation algorithm calculating gradients through layers according to the chain rule is of great importance.<\/p>\n<p>Finally, the scan function allows to take care of loops.<br \/>\nThe advantage of this function over the standard Python looping is its memory allocation.<br \/>\nFurther, the outputs at each time-step can be nicely gathered into new objects which is necessary for building recurrent layers.<\/p>\n<p><strong>Outlook<\/strong><br \/>\nThe theano library is very useful to build up neural networks from ground up.<br \/>\nFor quick implementations of standard neural networks one might want to rely on neural network libraries like keras which are build on top of theano.<\/p>\n<p>However, certain neural network architectures as proposed in the latest research papers exceed the functionality of such libraries and theano is a good starting point.<\/p>\n<p><strong>Resources<br \/>\n<\/strong>&#8220;<a href=\"http:\/\/deeplearning.net\/software\/theano\/\" target=\"_blank\" rel=\"noopener\">Theano<\/a>&#8221; (WEB). <em>Theano<\/em>. Accessed 24 March 2016.<br \/>\n&#8220;<a href=\"http:\/\/deeplearning.net\/software\/theano\/\" target=\"_blank\" rel=\"noopener\">Deep Learning Tutorials<\/a>&#8221; (WEB). <em>Deep Learning Tutorials<\/em>.\u00a0Accessed 24 March 2016.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goal In this ongoing summary we give a first introduction to the theano library, its basic functionality and u [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3642,3640],"tags":[3650,3652,4172,3760,3656,3762,3658,3700,4174,3702,3664,3958,4176,4178,3710,4180,3712,4182,4184,4186,4188,4190,3962,4192,4194],"class_list":{"0":"post-1201","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-ai-en","7":"category-all-en","8":"tag-ai-ja-en","9":"tag-aka-ja-en","10":"tag-algorithms-ja-en","11":"tag-artificial-intelligence-en","12":"tag-baggage-en","13":"tag-children-book-ja-en","14":"tag-christmas-en","15":"tag-cmos-en","16":"tag-connection-en","17":"tag-contents-en","18":"tag-crowd-funding-en","19":"tag-keras-en","20":"tag-loops-en","21":"tag-memory-allocation-en","22":"tag-musio-en","23":"tag-neural-network-libraries-en","24":"tag-neural-networks-en","25":"tag-python-en","26":"tag-shared-variables-en","27":"tag-theano-en","28":"tag--en-en","30":"tag--en","31":"tag--ja-en"},"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/posts\/1201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1201"}],"version-history":[{"count":4,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions"}],"predecessor-version":[{"id":10893,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions\/10893"}],"wp:attachment":[{"href":"https:\/\/blog.themusio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.themusio.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}