{"id":18715,"date":"2017-01-05T09:00:07","date_gmt":"2017-01-05T17:00:07","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/?p=18715"},"modified":"2024-01-22T22:52:30","modified_gmt":"2024-01-23T06:52:30","slug":"how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/","title":{"rendered":"How six lines of code + SQL Server can bring Deep Learning to ANY App"},"content":{"rendered":"<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"359\" title=\"Deep SQL Server\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Deep SQL Server\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p><em>The link to the source code is <a href=\"https:\/\/github.com\/Microsoft\/SQL-Server-R-Services-Samples\/tree\/master\/Galaxies\">here<\/a>.<\/em><\/p>\n<h2>The What Part<\/h2>\n<p>Deep Learning is a hot buzzword of today. The recent results and applications are incredibly promising, spanning areas such as speech recognition, language understanding and computer vision. Indeed, Deep Learning is now changing the very customer experience around many of Microsoft\u2019s products, including HoloLens, Skype, Cortana, Office 365, Bing and more. Deep Learning is also a core part of Microsoft\u2019s development platform offerings with an extensive toolset that includes: the Microsoft <a href=\"http:\/\/cntk.ai\/\">Cognitive Toolkit<\/a>, the <a href=\"https:\/\/www.microsoft.com\/en-us\/cloud-platform\/cortana-intelligence-suite\">Cortana Intelligence Suite<\/a>, <a href=\"https:\/\/www.microsoft.com\/cognitive-services\">Microsoft Cognitive Services APIs<\/a>, <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/machine-learning\/\">Azure Machine Learning<\/a>, the <a href=\"https:\/\/dev.botframework.com\/\">Bot Framework<\/a>, and the <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/bot-service\/\">Azure Bot Service<\/a>. Our Deep Learning based <a href=\"http:\/\/www.popsci.com\/how-microsofts-machine-learning-breaking-language-barrier\">language translation in Skype<\/a> was recently named one of the <a href=\"http:\/\/www.popsci.com\/6-greatest-software-innovations-year\">7 greatest software innovations of the year<\/a> by Popular Science, and this technology has now helped machines achieve <a href=\"http:\/\/blogs.microsoft.com\/next\/2016\/09\/13\/microsoft-researchers-achieve-speech-recognition-milestone\/#sm.0001ozddel7hlfa411f7lw7b80vuz\">human-level parity in conversational speech recognition<\/a>. To learn more about our Deep Learning journey, I encourage you to read a recent blog <a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/from-a-pc-on-every-desktop-to-deep-learning-in-every-software\/\">From \u201cA PC on every desktop\u201d to \u201cDeep Learning in every software\u201d.<\/a><\/p>\n<p>The applications of Deep Learning technology are truly so far reaching that the new mantra, of <em>Deep Learning in Every Software<\/em>, may well become a reality within this decade. The venerable SQL Server DBMS is no exception. <strong>Can SQL Server do Deep Learning?<\/strong> The response to this is enthusiastic \u201c<strong>yes<\/strong>!\u201d With the <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2016\/11\/16\/announcing-the-next-generation-of-databases-and-data-lakes-from-microsoft\/\">public preview of the next release of SQL Server<\/a>, we\u2019ve added significant improvements into <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt604885.aspx\">R Services inside SQL Server<\/a> including a very powerful set of machine learning functions that are used by our own product teams across Microsoft. <strong>This brings new machine learning and deep neural network functionality with increased speed, performance and scale to database applications built on SQL Server<\/strong>. We have just recently <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2016\/10\/11\/1000000-predictions-per-second\/\">showcased SQL Server running more than one million R predictions per second<\/a>, using <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2016\/10\/17\/sql-server-as-a-machine-learning-model-management-system\/\">SQL Server as a Machine Learning Model Management System<\/a> and I encourage you all to try out R examples and machine learning templates for <a href=\"https:\/\/github.com\/Microsoft\/SQL-Server-R-Services-Samples\">SQL Server on GitHub<\/a>.<\/p>\n<p>In this blog, I wanted to address the finer points of the matter &#8211; the what, the why and the how part of Deep Learning in SQL Server. With this new clarity, it will be easier to see a picture of the road forward for data-driven machine intelligence using such a powerful data platform like SQL Server.<\/p>\n<h2>The Why Part<\/h2>\n<p>Today, every company is a data company, and every app is a data app.<\/p>\n<p>When you put intelligence (AI, ML, AA, etc.)\u00a0 close to where the data lives, then every app becomes an intelligent app. SQL Server can help developers and customers everywhere realize the holy grail of deep learning in their applications with just a few lines of code.\u00a0 It enables It enables data developers to deploy mission critical operational systems that embed deep learning models. So here are the 10 whys for deep learning in SQL Server.<\/p>\n<p>The 10 Whys of Deep Learning inside SQL Server<\/p>\n<ol>\n<li>By pushing intelligence close to where your data lives (i.e., SQL Server), you get security, compliance, privacy, encryption, <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ff487003.aspx\">master data services<\/a>, availability groups, advanced BI, in-memory, virtualization, geo-spatial, temporal, graph capabilities and other world-class features.<\/li>\n<li>You can do both near \u201creal-time intelligence\u201d or \u201cbatch intelligence\u201d (similar in spirit to OLTP and OLAP, but applied to Deep Learning and intelligence).<\/li>\n<li>Your apps built on top of SQL Server don\u2019t need to change to take advantage of Deep Learning, and a multitude of apps (web, mobile, IoT) can share the same deep learning models without duplicating code.<\/li>\n<li>You can exploit a number of functionalities that come in machine learning libraries (e.g., MicrosoftML) that will drive the productivity of your data scientists, developers and DBAs and business overall. This might be faster and far more efficient than doing it in the house.<\/li>\n<li>You can develop predictable solutions that can evolve\/scale up as you need. With the latest service pack of SQL Server, many features that were only available in the Enterprise Edition are now available in the Standard\/Express\/Web Edition of SQL Server. That means you can do Deep Learning using a standard SQL Server without high costs.<\/li>\n<li>You can use heterogeneous external data sources (via Polybase) for training and inference of deep models.<\/li>\n<li>You can create versatile data simulations and what-if scenarios inside SQL Server and then train a variety of rich Deep Learning models in those simulated worlds to enable intelligence even with a limited training data.<\/li>\n<li>You can operationalize Deep Learning models in a very easy and fast way using stored procedures and triggers.<\/li>\n<li>You get all the tools, monitoring, debugging and ecosystem around SQL Server applicable to intelligence. SQL Server can literally become your <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2016\/10\/17\/sql-server-as-a-machine-learning-model-management-system\/\">Machine Learning Management System<\/a> and handle the entire life cycle of DNN models along with data.<\/li>\n<li>You can generate new knowledge and insights on the data you are storing already and anyways without having any impact on your transactional workload (via <a href=\"http:\/\/blogs.microsoft.com\/blog\/2016\/03\/10\/sql-server-2016-the-database-for-mission-critical-intelligence\/#sm.0001ozddel7hlfa411f7lw7b80vuz\">HTAP pattern<\/a>).<\/li>\n<\/ol>\n<p>Let\u2019s be honest, nobody buys a DBMS for the sake of DBMS. People buy it for what it enables you to do. By putting deep learning capabilities inside SQL Server, we can scale artificial intelligence and machine learning both in traditional sense (scale of data, throughput, latency), but we also scale it in terms of productivity (low barrier to adoption and lower learning curve). The value that it brings results in so many shapes and forms &#8211; time, better experience, productivity, lower $ cost, higher $ revenue, opportunity, higher business aspirations, thought-leadership in an industry, etc.<\/p>\n<p>Real-life applications of Deep Learning running inside SQL Server span banking, healthcare, finance, manufacturing, retail, e-commerce and IoT. With applications like fraud detection, disease prediction, power consumption prediction, personal analytics, you have the ability to transform existing industries and apps. That also means whatever workloads you are running using SQL Server, be it CRM, ERP, DW, OLTP, BD\u2026 you can add Deep Learning to them almost seamlessly.\u00a0 Furthermore, it\u2019s not just about doing deep learning standalone, but it\u2019s rather about combining it with all kinds of data and analytics that SQL Server is so great at (e.g., processing structured data, JSON data, geo-spatial data, graph data, external data, temporal data). All that is really left to be added to this mix is\u2026 your creativity.<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/SQL-Server-and-Deep-Learning_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"359\" title=\"SQL Server and Deep Learning\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"SQL Server and Deep Learning\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/SQL-Server-and-Deep-Learning_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<h2>The How Part<\/h2>\n<p>Here is a great scenario to show all of this in reality. I am going to use an example of predicting galaxy classes from image data &#8211; using the power of <strong>Microsoft R<\/strong> and its new <a href=\"https:\/\/msdn.microsoft.com\/en-us\/microsoft-r\/microsoftml-introduction\">MicrosoftML<\/a> package for machine learning (which has been built by our Algorithms and Data Science team). And I am going to do all this in <strong>SQL Server<\/strong> with <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt604845.aspx\">R Services<\/a> on a readily available <a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/azure-n-series-general-availability-on-december-1\/\">Azure NC VM<\/a>. I am going to classify the images of galaxies and other celestial objects into 13 different classes based on the taxonomy created by astronomers &#8211; mainly elliptical and spirals and then various sub-categories within them. The shape and other visual features of galaxies change as they evolve. Studying the shapes of galaxies and classifying them appropriately helps scientists learn how the universe is evolving. It is very easy for us humans to look at these images and put them in the right buckets based on the visual features. But in order to scale it to the 2 trillion known galaxies I need help from machine learning and techniques like deep neural networks \u2013 so that is exactly what I am going to use. It\u2019s not a big leap to imagine that instead of astronomy data, we have healthcare data or financial data or IoT data and we are trying to make predictions on that data.<\/p>\n<h3>An app<\/h3>\n<p>Imagine a simple web app that loads images from a folder and then classifies them into different categories &#8211; spiral or elliptical and then sub-types with those categories (e.g., is it a regular spiral or does it have a handlebar structure in the center).<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Use-Deep-Neural-Nets_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"446\" height=\"99\" title=\"Use Deep Neural Nets\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Use Deep Neural Nets\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Use-Deep-Neural-Nets_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>The classification can be done incredibly fast on vast amounts of images. Here is an example output:<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Classifier_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"467\" title=\"Classifier\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Classifier\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Classifier_thumb.png\" border=\"0\" srcset=\"\"><\/a><br \/>\nThe first two columns are the elliptical types and the others are of different spiral types.<\/p>\n<h3>So how does this simple app do this amazingly complex computation?<\/h3>\n<p>The code for such an app actually isn&#8217;t doing much &#8211; it just writes the paths to the new files to classify into a database table (the rest of the app code is plumbing and page layout, etc).<\/p>\n<pre class=\"prettyprint\">SqlCommand Cmd = new SqlCommand(\"INSERT INTO [dbo].[GalaxiesToScore] ([path] ,[PredictedLabel]) \"<\/pre>\n<p>\u00a0<\/p>\n<pre class=\"prettyprint\"><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/CodeDemo_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"193\" title=\"CodeDemo\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"CodeDemo\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/CodeDemo_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/pre>\n<h3>What is happening in the database?<\/h3>\n<h4>Prediction and operationalization part:<\/h4>\n<p>Let\u2019s look at the table where the app writes the image paths. It contains a column with paths to the galaxy images, and a column to store the predicted classes of galaxies. As soon as a new row of data gets entered into this table, a trigger gets executed.<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Image-Path-Table-1_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"356\" title=\"Image Path Table 1\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Image Path Table 1\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Image-Path-Table-1_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>\u00a0<\/p>\n<p>The trigger in turn invokes a stored procedure \u2013 <em>PredictGalaxiesNN<\/em> as shown below (with R script portion embedded inside the stored proc):<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Image-Path-Table-2_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"461\" title=\"Image Path Table 2\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Image Path Table 2\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Image-Path-Table-2_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>This is where the <strong>magic<\/strong> happens &#8211; in these few lines of R code. This R script takes two inputs &#8211; the new rows of data (that have not been scored yet) and the model that is stored in a table as varbinary(max). I will talk about how the model got there in a minute. Inside the script, the model gets de-serialized and is used by the familiar scoring function (<em>rxPredict<\/em>) in this line:<\/p>\n<pre class=\"prettyprint\">scores &lt;- rxPredict(modelObject = model_un, data = InputDataSet,  extraVarsToWrite=\"path\")<\/pre>\n<p>to score the new rows and then write the scored output out. This is a new variant of <em>rxPredict<\/em> which understands the ML algorithms included in the new Microsoft ML package. This line<\/p>\n<pre class=\"prettyprint\"> [ library(\"MicrosoftML\") ]<\/pre>\n<p>loads the new package that contains the new ML algorithms. In addition to DNN (the focus of this blog), there are five other powerful ML algorithms in this package &#8211; fast linear learner, fast tree, fast forest, one class SVM for anomaly detection, regularized logistic regression (with L1 and L2) and neural nets. <strong>So, with just 6-7 lines of R code, you can enable any app to get the intelligence from a DNN based model<\/strong>. All that the apps needs to do is connect to SQL Server. By the way, you can now very easily generate a stored procedure for R Code using the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt790483.aspx\">sqlrutils<\/a> package.<\/p>\n<h4>What about training the model?<\/h4>\n<p>Where was the model trained? Well, the model was trained in SQL Server as well. However,<em> it does not have to be trained on SQL Server<\/em> &#8211; it could have been trained on a separate machine with a standalone R Server running on it, on-prem or on the cloud. Today we have these new ML algorithms on Windows version of <strong>R Server<\/strong>, and the support for other platforms is coming soon. I just chose to do the training in the SQL server box here, but I could have done it outside as well. Let&#8217;s look at the stored proc with the training code.<\/p>\n<h5>Training code:<\/h5>\n<p>The model training is done in these lines of code.<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Training-Code_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"337\" title=\"Training Code\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"Training Code\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Training-Code_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>This new function &#8211; <strong>rxNeuralNet<\/strong> from the <strong>MicrosoftML<\/strong> package for training a DNN. The code looks similar to other R and rx functions &#8211; there is a formula, an input dataset, and some other parameters. One of the parameters here is this line &#8220;netDefinition = netDefinition&#8221;. This is where the neural network is being defined.<\/p>\n<h5>Network definition:<\/h5>\n<p>Here is the DNN definition in this portion of the code:<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/DNN-Definition_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"387\" title=\"DNN Definition\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"DNN Definition\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/DNN-Definition_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>Here, a deep neural net is defined using Net# specification language that was created for this purpose. It has 1 input, 1 output and 8 hidden layers. It starts with an input layer of 50&#215;50 pixels and 3 colors (RGB) image data. First hidden layer is a convolution layer where we specify the kernel (small sub-part of the image) size and how many times we want the kernel to map to other kernels (convolute). There are some other layers for more convolutions, and for normalization and pooling that help stabilize the network. And finally, the output layer that maps it to one of the 13 classes. In about 50 lines of Net# specification, I have defined a complex neural network. <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/azure\/dn906030.aspx\">Net# is documented on MSDN<\/a>.<\/p>\n<h5>Training data size\/GPU:<\/h5>\n<p>Here is the R code to do the training.<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/R-code_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"480\" title=\"R code\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"R code\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/R-code_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>Some other lines to note here are &#8211; &#8216;training_rows = 238000&#8217;. This model was trained on 238K images that we got from <a href=\"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2016\/03\/10\/mapping-the-universe-with-sql-server\/\">Sloan Digital Sky Survey dataset<\/a>. We then created two variants of each image with 45% and 90% rotations. In all there was about 700K images to train on. That&#8217;s a lot of image data to train on \u2013 so, how long did it take to train it? Well, we were able to train this model in under 4 hours. This is a decent sized machine &#8211; 6 cores and 56GB or RAM, but then it also has a powerful Nvidia <strong>Tesla K80 GPU<\/strong>. In fact, it is an <strong>Azure VM<\/strong> &#8211; the new <strong>NC series GPU VM<\/strong>, readily available to anyone with an Azure subscription. We were able to leverage the GPU computation by specifying one simple parameter: <em>acceleration = &#8220;gpu&#8221;.<\/em> Without GPU, the training takes roughly 10X more time.<\/p>\n<h2>The What Are You Waiting For Part<\/h2>\n<p>So with just a few lines of R code using algorithms from the MicrosoftML package, I was able to train a DNN on tons of image data and operationalize the trained model in SQL using R services such that any app connected to SQL can get this type of Intelligence easily. That&#8217;s the power of Microsoft R and the Microsoft ML package in it combined with SQL Server. This is just the beginning, and we are working on adding more algorithms on our quest to democratize the power of AI and machine learning.\u00a0 You can download the <strong>MicrosoftML: Algorithm Cheat Sheet <\/strong><a href=\"https:\/\/msdn.microsoft.com\/en-us\/microsoft-r\/microsoftml-algorithm-cheat-sheet\">here<\/a> to help you choose the right machine learning algorithm for a predictive analytics model.<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/MicrosoftML-Alogorithm-Cheat-Sheet_thumb.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"663\" title=\"MicrosoftML Alogorithm Cheat Sheet\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"MicrosoftML Alogorithm Cheat Sheet\" src=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/MicrosoftML-Alogorithm-Cheat-Sheet_thumb.png\" border=\"0\" srcset=\"\"><\/a><\/p>\n<p>Don\u2019t wait, go ahead and give it a try.<\/p>\n<p><a href=\"https:\/\/twitter.com\/rimmanehme\">@rimmanehme<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The link to the source code is here. The What Part Deep Learning is a hot buzzword of today. The recent results and applications are incredibly promising, spanning areas such as speech recognition, language understanding and computer vision.<\/p>\n","protected":false},"author":1457,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","footnotes":""},"post_tag":[],"product":[5227,2406],"content-type":[2424],"topic":[2457],"coauthors":[],"class_list":["post-18715","post","type-post","status-publish","format-standard","hentry","product-sql","product-sql-server-2017","content-type-best-practices","topic-data-analytics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog\" \/>\n<meta property=\"og:description\" content=\"The link to the source code is here. The What Part Deep Learning is a hot buzzword of today. The recent results and applications are incredibly promising, spanning areas such as speech recognition, language understanding and computer vision.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft SQL Server Blog\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/sqlserver\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-05T17:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-23T06:52:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\" \/>\n<meta name=\"author\" content=\"SQL Server Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SQLServer\" \/>\n<meta name=\"twitter:site\" content=\"@SQLServer\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"SQL Server Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 min read\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\"},\"author\":[{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/author\/sql-server-team\/\",\"@type\":\"Person\",\"@name\":\"SQL Server Team\"}],\"headline\":\"How six lines of code + SQL Server can bring Deep Learning to ANY App\",\"datePublished\":\"2017-01-05T17:00:07+00:00\",\"dateModified\":\"2024-01-23T06:52:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\"},\"wordCount\":2308,\"commentCount\":17,\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\",\"name\":\"How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\",\"datePublished\":\"2017-01-05T17:00:07+00:00\",\"dateModified\":\"2024-01-23T06:52:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How six lines of code + SQL Server can bring Deep Learning to ANY App\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/\",\"name\":\"Microsoft SQL Server Blog\",\"description\":\"Official News from Microsoft\u2019s Information Platform\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization\",\"name\":\"Microsoft SQL Server Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"width\":259,\"height\":194,\"caption\":\"Microsoft SQL Server Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/www.facebook.com\/sqlserver\",\"https:\/\/x.com\/SQLServer\",\"https:\/\/www.youtube.com\/user\/MSCloudOS\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/","og_locale":"en_US","og_type":"article","og_title":"How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog","og_description":"The link to the source code is here. The What Part Deep Learning is a hot buzzword of today. The recent results and applications are incredibly promising, spanning areas such as speech recognition, language understanding and computer vision.","og_url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/","og_site_name":"Microsoft SQL Server Blog","article_publisher":"http:\/\/www.facebook.com\/sqlserver","article_published_time":"2017-01-05T17:00:07+00:00","article_modified_time":"2024-01-23T06:52:30+00:00","og_image":[{"url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png","type":"","width":"","height":""}],"author":"SQL Server Team","twitter_card":"summary_large_image","twitter_creator":"@SQLServer","twitter_site":"@SQLServer","twitter_misc":{"Written by":"SQL Server Team","Est. reading time":"9 min read"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#article","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/"},"author":[{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/author\/sql-server-team\/","@type":"Person","@name":"SQL Server Team"}],"headline":"How six lines of code + SQL Server can bring Deep Learning to ANY App","datePublished":"2017-01-05T17:00:07+00:00","dateModified":"2024-01-23T06:52:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/"},"wordCount":2308,"commentCount":17,"publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/","url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/","name":"How six lines of code + SQL Server can bring Deep Learning to ANY App - Microsoft SQL Server Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png","datePublished":"2017-01-05T17:00:07+00:00","dateModified":"2024-01-23T06:52:30+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#primaryimage","url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2017\/01\/Deep-SQL-Server_thumb.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/01\/05\/how-six-lines-of-code-sql-server-can-bring-deep-learning-to-any-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/"},{"@type":"ListItem","position":2,"name":"How six lines of code + SQL Server can bring Deep Learning to ANY App"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/","name":"Microsoft SQL Server Blog","description":"Official News from Microsoft\u2019s Information Platform","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#organization","name":"Microsoft SQL Server Blog","url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","width":259,"height":194,"caption":"Microsoft SQL Server Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/www.facebook.com\/sqlserver","https:\/\/x.com\/SQLServer","https:\/\/www.youtube.com\/user\/MSCloudOS"]}]}},"msxcm_display_generated_audio":false,"msxcm_animated_featured_image":null,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/posts\/18715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/users\/1457"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/comments?post=18715"}],"version-history":[{"count":0,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/posts\/18715\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/media?parent=18715"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/post_tag?post=18715"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/product?post=18715"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/content-type?post=18715"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/topic?post=18715"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/wp-json\/wp\/v2\/coauthors?post=18715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}