{"id":19697,"date":"2016-04-15T18:21:15","date_gmt":"2016-04-16T02:21:15","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=19697"},"modified":"2018-02-09T20:20:27","modified_gmt":"2018-02-09T17:20:27","slug":"using-logistic-and-softmax-regression-with-tensorflow","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/","title":{"rendered":"Using Logistic and Softmax Regression with TensorFlow"},"content":{"rendered":"<p>In this TensorFlow tutorial, we train a softmax regression model. The model should be able to look at the images of handwritten digits from the <a href=\"http:\/\/yann.lecun.com\/exdb\/mnist\/\" target=\"_blank\">MNIST<\/a> data set and classify them as digits from 0 to 9. For instance, our model might evaluate an image of a six and be 90% sure it is a six, give a 5% chance to it being an eight, and leave a bit of probability to all the other digits.<\/p>\n<p>The data set is split into three parts: 55,000 data points of training data (mnist.train), 10,000 points of test data (mnist.test), and 5,000 points of validation data (mnist.validation).<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Building_a_computational_graph\" >Building a computational graph<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Model_and_cost_function\" >Model and cost function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Training_a_model\" >Training a model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Evaluating_the_model\" >Evaluating the model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Running_the_code\" >Running the code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#Further_reading\" >Further reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before running the code from this tutorial, download the <a href=\"https:\/\/github.com\/tensorflow\/tensorflow\/blob\/r0.8\/tensorflow\/examples\/tutorials\/mnist\/input_data.py\" target=\"_blank\">input_data.py<\/a> file and place it into the same folder where softmax regression will be implemented. The script encapsulates the logic that is responsible for downloading the MNIST data set.<\/p>\n<p>To import the data set, proceed as follows:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"># Import MNIST data\r\nimport input_data\r\nmnist = input_data.read_data_sets(&quot;\/tmp\/data\/&quot;, one_hot=True)<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Building_a_computational_graph\"><\/span>Building a computational graph<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>First of all, we should set up graph inputs and outputs. MNIST images are matrices of pixels (28&#215;28). The simplest way to structure I\/O data is just to flatten a matrix into a single column vector <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">(28x28 = 784)<\/code>. In this case, an input tensor has the shape of <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">[None, 784]<\/code>, where <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">784<\/code> is a flattened image and <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">None<\/code> indicates that the number of input images can be of any size.<\/p>\n<p>The graph output is the tensor y with the vector size of 10 entries, where each entry expresses the probability for the image to be a particular digit (0\u20139) and None indicates that the number of output can be of any size.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"># TF graph input\r\nx = tf.placeholder(&quot;float&quot;, &#x5B;None, 784]) # MNIST data image of shape 28*28=784\r\ny = tf.placeholder(&quot;float&quot;, &#x5B;None, 10]) # 0-9 digits recognition =&gt; 10 classes<\/pre>\n<p>Now let\u2019s define and initialize the weights <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">W<\/code> and the biases <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">b<\/code> for our model.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"># Set model weights\r\nW = tf.Variable(tf.zeros(&#x5B;784, 10]))\r\nb = tf.Variable(tf.zeros(&#x5B;10]))<\/pre>\n<p>Before <em>Variables<\/em> can be used, they must be initialized:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"># Initializing the variables\r\ninit = tf.initialize_all_variables()<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Model_and_cost_function\"><\/span>Model and cost function<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>For this example, we start with the simplest possible function\u2014a linear mapping:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">y = tf.nn.softmax(tf.matmul(x, W) + b)<\/pre>\n<p>As the cost function, we use the cross-entropy function:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">cost_function = -tf.reduce_sum(y*tf.log(y))<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Training_a_model\"><\/span>Training a model<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To minimize the cross-entropy function, we use the gradient descent method with the step length of 0.01.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)\r\nfor i in range(total_batch):\r\n      batch_xs, batch_ys = mnist.train.next_batch(batch_size)\r\n      # Fit training using batch data\r\n      sess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys})<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Evaluating_the_model\"><\/span>Evaluating the model<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>After training the model, we want to estimate the accuracy of this model. To get accuracy, we need to compare the predicted values with the actual ones in the training data set:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">correct_predictions = tf.equal(tf.argmax(model, 1), tf.argmax(y, 1))<\/pre>\n<p>Then, compute accuracy:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">accuracy = tf.reduce_mean(tf.cast(predictions, &quot;float&quot;))<\/pre>\n<p>Finally, we can evaluate our accuracy on the test data.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">print &quot;Accuracy:&quot;, accuracy.eval({x: mnist.test.images, y: mnist.test.labels})<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Running_the_code\"><\/span>Running the code<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Now, try to run the example source code:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"># Import MINST data\r\nimport input_data\r\nmnist = input_data.read_data_sets(&quot;\/tmp\/data\/&quot;, one_hot=True)\r\n\r\nimport tensorflow as tf\r\n\r\n# Set parameters\r\nlearning_rate = 0.01\r\ntraining_iteration = 30\r\nbatch_size = 100\r\ndisplay_step = 2\r\n\r\n# TF graph input\r\nx = tf.placeholder(&quot;float&quot;, &#x5B;None, 784]) # mnist data image of shape 28*28=784\r\ny = tf.placeholder(&quot;float&quot;, &#x5B;None, 10]) # 0-9 digits recognition =&gt; 10 classes\r\n\r\n# Create a model\r\n\r\n# Set model weights\r\nW = tf.Variable(tf.zeros(&#x5B;784, 10]))\r\nb = tf.Variable(tf.zeros(&#x5B;10]))\r\n\r\n# Construct a linear model\r\nmodel = tf.nn.softmax(tf.matmul(x, W) + b) # Softmax\r\n\r\n# Minimize error using cross entropy\r\n# Cross entropy\r\ncost_function = -tf.reduce_sum(y*tf.log(model)) \r\n# Gradient Descent\r\noptimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost_function)\r\n\r\n# Initializing the variables\r\ninit = tf.initialize_all_variables()\r\n\r\n# Launch the graph\r\nwith tf.Session() as sess:\r\n    sess.run(init)\r\n\r\n    # Training cycle\r\n    for iteration in range(training_iteration):\r\n        avg_cost = 0.\r\n        total_batch = int(mnist.train.num_examples\/batch_size)\r\n        # Loop over all batches\r\n        for i in range(total_batch):\r\n            batch_xs, batch_ys = mnist.train.next_batch(batch_size)\r\n            # Fit training using batch data\r\n            sess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys})\r\n            # Compute average loss\r\n            avg_cost += sess.run(cost_function, feed_dict={x: batch_xs, y: batch_ys})\/total_batch\r\n        # Display logs per eiteration step\r\n        if iteration % display_step == 0:\r\n            print &quot;Iteration:&quot;, '%04d' % (iteration + 1), &quot;cost=&quot;, &quot;{:.9f}&quot;.format(avg_cost)\r\n\r\n    print &quot;Tuning completed!&quot;\r\n\r\n    # Test the model\r\n    predictions = tf.equal(tf.argmax(model, 1), tf.argmax(y, 1))\r\n    # Calculate accuracy\r\n    accuracy = tf.reduce_mean(tf.cast(predictions, &quot;float&quot;))\r\n    print &quot;Accuracy:&quot;, accuracy.eval({x: mnist.test.images, y: mnist.test.labels})<\/pre>\n<p>As a result, we trained a softmax regression model that is able to look at images of handwritten digits and predict what digits they are.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Further_reading\"><\/span>Further reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/using-linear-regression-in-tensorflow\/\">Implementing Linear Regression with TensorFlow<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/basic-concepts-and-manipulations-with-tensorflow\/\">Basic Concepts and Manipulations with TensorFlow<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/using-k-means-clustering-in-tensorflow\/\">Using k-means Clustering with TensorFlow<\/a><\/li>\n<\/ul>\n<hr>\n<p><center><small>This post was written by Sergey Kovalev and edited by <a href=\"https:\/\/www.altoros.com\/blog\/author\/sophie.turol\/\">Sophie Turol<\/a> and <a href=\"https:\/\/www.altoros.com\/blog\/author\/alex\/\">Alex Khizhniak<\/a>.<\/small><\/center> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this TensorFlow tutorial, we train a softmax regression model. The model should be able to look at the images of handwritten digits from the MNIST data set and classify them as digits from 0 to 9. For instance, our model might evaluate an image of a six and be [&#8230;]<\/p>\n","protected":false},"author":122,"featured_media":19706,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[748,749],"class_list":["post-19697","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-machine-learning","tag-tensorflow"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Logistic and Softmax Regression with TensorFlow | Altoros<\/title>\n<meta name=\"description\" content=\"As an example, we&#039;ll be classifying handwritten digits (0\u20139) from the MNIST data set.\" \/>\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.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Logistic and Softmax Regression with TensorFlow | Altoros\" \/>\n<meta property=\"og:description\" content=\"In this TensorFlow tutorial, we train a softmax regression model. The model should be able to look at the images of handwritten digits from the MNIST data set and classify them as digits from 0 to 9. For instance, our model might evaluate an image of a six and be [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-16T02:21:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-02-09T17:20:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png\" \/>\n\t<meta property=\"og:image:width\" content=\"530\" \/>\n\t<meta property=\"og:image:height\" content=\"297\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sergey Kovalev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sergey Kovalev\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/\",\"name\":\"Using Logistic and Softmax Regression with TensorFlow | Altoros\",\"isPartOf\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png\",\"datePublished\":\"2016-04-16T02:21:15+00:00\",\"dateModified\":\"2018-02-09T17:20:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7bb3c35a84eeaa32af69b53773e7fe1a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png\",\"width\":530,\"height\":297},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.altoros.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Logistic and Softmax Regression with TensorFlow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#website\",\"url\":\"https:\/\/www.altoros.com\/blog\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.altoros.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7bb3c35a84eeaa32af69b53773e7fe1a\",\"name\":\"Sergey Kovalev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/3faf706-150x150.jpg\",\"contentUrl\":\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/3faf706-150x150.jpg\",\"caption\":\"Sergey Kovalev\"},\"description\":\"Sergey Kovalev is a senior software engineer with extensive experience in high-load application development, big data and NoSQL solutions, cloud computing, data warehousing, and machine learning. He has strong expertise in back-end engineering, applying the best approaches for development, architecture design, and scaling. He has solid background in software development practices, such as the Agile methodology, prototyping, patterns, refactoring, and code review. Now, Sergey\u2019s main interest lies in big data distributed computing and machine learning.\",\"url\":\"https:\/\/www.altoros.com\/blog\/author\/s-kovalev\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Logistic and Softmax Regression with TensorFlow | Altoros","description":"As an example, we'll be classifying handwritten digits (0\u20139) from the MNIST data set.","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.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/","og_locale":"en_US","og_type":"article","og_title":"Using Logistic and Softmax Regression with TensorFlow | Altoros","og_description":"In this TensorFlow tutorial, we train a softmax regression model. The model should be able to look at the images of handwritten digits from the MNIST data set and classify them as digits from 0 to 9. For instance, our model might evaluate an image of a six and be [...]","og_url":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/","og_site_name":"Altoros","article_published_time":"2016-04-16T02:21:15+00:00","article_modified_time":"2018-02-09T17:20:27+00:00","og_image":[{"width":530,"height":297,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png","type":"image\/png"}],"author":"Sergey Kovalev","twitter_misc":{"Written by":"Sergey Kovalev","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/","url":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/","name":"Using Logistic and Softmax Regression with TensorFlow | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png","datePublished":"2016-04-16T02:21:15+00:00","dateModified":"2018-02-09T17:20:27+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7bb3c35a84eeaa32af69b53773e7fe1a"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/mnist.png","width":530,"height":297},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/using-logistic-and-softmax-regression-with-tensorflow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Logistic and Softmax Regression with TensorFlow"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/7bb3c35a84eeaa32af69b53773e7fe1a","name":"Sergey Kovalev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/3faf706-150x150.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2017\/01\/3faf706-150x150.jpg","caption":"Sergey Kovalev"},"description":"Sergey Kovalev is a senior software engineer with extensive experience in high-load application development, big data and NoSQL solutions, cloud computing, data warehousing, and machine learning. He has strong expertise in back-end engineering, applying the best approaches for development, architecture design, and scaling. He has solid background in software development practices, such as the Agile methodology, prototyping, patterns, refactoring, and code review. Now, Sergey\u2019s main interest lies in big data distributed computing and machine learning.","url":"https:\/\/www.altoros.com\/blog\/author\/s-kovalev\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/122"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=19697"}],"version-history":[{"count":15,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19697\/revisions"}],"predecessor-version":[{"id":30895,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/19697\/revisions\/30895"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/19706"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=19697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=19697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=19697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}