{"id":31456,"date":"2018-03-05T21:26:48","date_gmt":"2018-03-05T18:26:48","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=31456"},"modified":"2021-12-17T00:07:59","modified_gmt":"2021-12-16T21:07:59","slug":"building-recommenders-with-multilayer-perceptron-using-tensorflow","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/","title":{"rendered":"Building Recommenders with Multilayer Perceptron Using TensorFlow"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#The_accuracy_of_recommendations\" >The accuracy of recommendations<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Collaborative_filtering\" >Collaborative filtering<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Automating_matrix_factorization_with_TensorFlow\" >Automating matrix factorization with TensorFlow<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Improving_recommendations_even_further\" >Improving recommendations even further<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Want_details_Watch_the_video\" >Want details? Watch the video!<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Related_slides\" >Related slides<\/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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#Further_reading\" >Further reading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#About_the_expert\" >About the expert<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"The_accuracy_of_recommendations\"><\/span>The accuracy of recommendations<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<div id=\"attachment_31552\" style=\"width: 160px\" class=\"wp-caption alignright\"><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/oliver-gindele-datatonic.jpg\"><img decoding=\"async\" aria-describedby=\"caption-attachment-31552\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/oliver-gindele-datatonic-150x150.jpg\" alt=\"\" width=\"150\" class=\"size-thumbnail wp-image-31552\" \/><\/a><p id=\"caption-attachment-31552\" class=\"wp-caption-text\"><small>Oliver Gindele<\/small><\/p><\/div>\n<p>Recommenders are widely used by e-commerce and multimedia companies worldwide to provide relevant items to a user. Many different algorithms and models exist to tackle the problem of finding the best product in retail, telco, and other industries. Recently, we <a href=\"https:\/\/www.altoros.com\/blog\/tensorflow-for-recommendation-engines-and-customer-feedback-analysis\/\">have written<\/a> how Google created a solution to enable real-time recommendations of TV shows based on little data available.<\/p>\n<p>Within TensorFlow, there is a bunch of in-built high-level APIs that help to improve the accuracy of recommendation engines. At a <a href=\"https:\/\/www.meetup.com\/ru-RU\/TensorFlow-London\/events\/246867281\/\" rel=\"noopener noreferrer\" target=\"_blank\">TensorFlow meetup<\/a> in London, <a href=\"https:\/\/www.linkedin.com\/in\/oliver-gindele-13153540\/\" rel=\"noopener noreferrer\" target=\"_blank\">Oliver Gindele<\/a> of Datatonic expanded on the topic. He examplified popular recommendation systems like Netflix and the ones some don&#8217;t even think as of a recommender in the first place.<\/p>\n<p>For instance, Google Search, which provides highly personalized suggestions whenever a user types in the input. The accuracy of recommendations is of critical importance for end-user experience. Oliver backed up his idea by illustrating that when he looked for &#8220;python&#8221; on Google, it returned the results for the Python programming language rather than a snake. In addition, Google will offer to check out similar solutions that a user may not have interacted with previously, but the system decides they may be of interest.<\/p>\n<p>During his session, Oliver explained how to optimize such common recommendation models as collaborative filtering and multilayer perceptron using TensorFlow.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Collaborative_filtering\"><\/span>Collaborative filtering<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>So, what makes recommendation engines recommend? One of the common techniques is to build a matrix, demonstrating how users interact with a number of items, let&#8217;s say, books. Users rate books on a scale from one to five. The matrix may be quite sparse, either because not every user has read each of the books or just won&#8217;t give any rating. This poses a problem as you need the matrix with no empty fields to make a precise recommendation.<\/p>\n<p>Collaborative filtering helps to resolve this issue by breaking the matrix into two smaller matrices: <em>a user-centric<\/em> one and an <em>item-centric<\/em> one. Then, these two are compressed into a latent space to get detached latent representations of both the users and items. To get the necessary rating, one multiplies a user row with an item row.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/collaborative-filtering-with-tensorflow-for-recommender-systems-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/collaborative-filtering-with-tensorflow-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31503\" \/><\/a><small>A schematic visualization of collaborative filtering (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>The approach gained its popularity back in 2009, when Netflix held <a href=\"https:\/\/en.wikipedia.org\/wiki\/Netflix_Prize\" rel=\"noopener noreferrer\" target=\"_blank\">an open competition<\/a> for the best collaborative filtering algorithm to predict user ratings for movies. According to Oliver, the winning solution was based on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Singular-value_decomposition\" rel=\"noopener noreferrer\" target=\"_blank\">singular-value decomposition<\/a>, the <a href=\"https:\/\/stanford.edu\/~rezab\/classes\/cme323\/S15\/notes\/lec14.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">alternating least squares<\/a> method, and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Stochastic_gradient_descent\" rel=\"noopener noreferrer\" target=\"_blank\">stochastic gradient descent<\/a>.<\/p>\n<p>However, there are other models underlying recommenders, such as <a href=\"https:\/\/www.altoros.com\/research-papers\/hadoop-based-movie-recommendation-engine-a-comparison-of-the-apriori-algorithm-vs-the-k-means-method\/\">k-means clustering<\/a>, matrix factorization, multilayer perceptron, etc.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Automating_matrix_factorization_with_TensorFlow\"><\/span>Automating matrix factorization with TensorFlow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To demonstrate how the same can be done with TensorFlow in a faster manner, Oliver chose to showcase the working mechanics on a dating system. For the purpose, he utilized the LibimSeTi data set available online with:<\/p>\n<ul>\n<li>17,359,346 ratings on a scale from one to ten<\/li>\n<li>135,359 users (69% female and 31% male)<\/li>\n<li>Mean rating of 5.9<\/li>\n<\/ul>\n<p>To train the model, Oliver relied on TensorFlow&#8217;s <a href=\"https:\/\/www.tensorflow.org\/guide\/data\" rel=\"noopener noreferrer\" target=\"_blank\">Dataset API<\/a> (<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">tf.data<\/code>) and <a href=\"https:\/\/www.tensorflow.org\/guide\" rel=\"noopener noreferrer\" target=\"_blank\">Estimators API<\/a> (<code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">tf.estimator<\/code>).<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-dataset-estimator-apis-acrhitecture-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-dataset-estimator-apis-acrhitecture-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31508\" \/><\/a><small>High-level architectures of the Dataset and Estimators APIs (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>With <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">tf.data<\/code>, Oliver first fetched the data by defining the import function.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-dataset-api-code-sample-for-recommender-systems-v1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-dataset-api-code-sample-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" height=\"556\" class=\"aligncenter size-full wp-image-31507\" \/><\/a><small>Using the Dataset API to import data (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<blockquote><p><em>&#8220;The nice thing here is that it&#8217;s really optimized. It uses C++ queues under the hood, and you don&#8217;t have to tweak or tune it in any way.&#8221; \u2014Oliver Gindele, Datatonic<\/em><\/p><\/blockquote>\n<p>Oliver demonstrated a code sample of optimizing the loss function with <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">tf.estimator<\/code>.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-estimator-api-code-sample-for-recommender-systems-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-estimator-api-code-sample-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31509\" \/><\/a><small>Using the estimators API to tune the loss function (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>One needs to translate input data into representations that TensorFlow can handle. Here, tf.feature_column may be of help, serving as intermediary between raw data and Estimators. Applying <em>embedding columns<\/em>, it is possible to compress <em>categorical columns<\/em> into a dense vector of a smaller dimension. &#8220;And this is what matrix factorization approach is about,&#8221; noted Oliver.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/matrix-factorization-with-tensorflow-code-sample-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/matrix-factorization-with-tensorflow-code-sample-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31505\" \/><\/a><small>Matrix factorization with TensorFlow (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>Now, we&#8217;ve got latent space representation of the users and the items that can be mapped to a TensorFlow model. To reproduce ratings, one calculates the dot product, adds some biases and regularization if needed, and calculates the mean squared errors. This is the equivalent of singular-value decomposition\u2014though, done with TensorFlow in a more optimized way.<\/p>\n<p>Utilizing the same embeddings, one can build a multilayer perceptron on top and train on that, running matrix factorization in parallel. In contrast to matrix factorization, the multilayer perceptron allows for easily adding any available metadata\u2014gender or age, for instance.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/multilayer-perceptron-with-tensorflow-architecture-for-recommender-systems-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/multilayer-perceptron-with-tensorflow-architecture-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31506\" \/><\/a><small>Multilayer perceptron with TensorFlow (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<blockquote><p><em>&#8220;A bit of a shortcoming of the matrix factorization approach is that we only put in a user ID and an item ID. If you have any metadata, let&#8217;s say, on the customers we have or the items we serve, this gets lost, and we need to find a more complex way to reintroduce it into a model. In TensorFlow, we can flexibly write our layers and model the architecture as we want. This is not an issue anymore.&#8221; \u2014Oliver Gindele, Datatonic<\/em><\/p><\/blockquote>\n<p>Oliver has reached the following results while training the model, exploiting the matrix factorization and multilayer perceptron approaches individually. <em>Root-mean-square error<\/em> amounted to 2.137 with matrix factorization against 2.112 with multilayer perceptron. <em>Mean absolute error<\/em> amounted to 1.552 with matrix factorization against 1.541 with multilayer perceptron. Combining the two approaches allowed for minimizing root-mean-square error down to 2.071 and mean absolute error to 1.432.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Improving_recommendations_even_further\"><\/span>Improving recommendations even further<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Oliver then enumerated a few approaches and techniques that enable further improvements in building recommendation systems. For instance, delivering highly personalized recommendations based on prior <a href=\"http:\/\/yifanhu.net\/PUB\/cf.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">implicit feedback<\/a> (e.g., video length or clicks) rather than rare explicit ratings, which users aren&#8217;t always willing to submit. <a href=\"https:\/\/stanford.edu\/~rezab\/nips2014workshop\/submits\/logmat.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">Logistic matrix factorization<\/a> is another way of treating implicit feedback suggested by <a href=\"https:\/\/www.linkedin.com\/in\/mrchrisjohnson\/\" rel=\"noopener noreferrer\" target=\"_blank\">Christopher C. Johnson<\/a> of Spotify. Oliver also mentioned <a href=\"https:\/\/arxiv.org\/pdf\/1310.4546.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">negative sampling<\/a>, which poses an alternative to the hierarchical softmax, as well as using such ranking metrics as Hit Rate (HitRate@K) for better evaluation.<\/p>\n<p>In addition, he referred to Google&#8217;s <a href=\"https:\/\/research.google\/pubs\/pub45413\/\" rel=\"noopener noreferrer\" target=\"_blank\">Wide &#038; Deep learning<\/a> approach, which suggests training wide linear models and deep neural networks together to join forces of both memorization and generalization for recommendation engines. This very technique was tested on a commercial mobile app store with over a billion active users and over a million apps, and its implementation is open-sourced in TensorFlow.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/wide-and-deep-learning-model-tensorflow-google-for-recommender-systems-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/wide-and-deep-learning-model-tensorflow-google-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31511\" \/><\/a><small>A high-level architecture of the Wide &#038; Deep learning model (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>Another Google&#8217;s advance to turn to, according to Oliver, is <a href=\"https:\/\/static.googleusercontent.com\/media\/research.google.com\/ru\/\/pubs\/archive\/45530.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">deep neural networks for YouTube recommendations<\/a>\u2014a driving force behind one of the most sophisticated recommenders.<\/p>\n<p><center><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/deep-neural-networks-for-youtube-recommendations-tensorflow-google-for-recommender-systems-v1.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/deep-neural-networks-for-youtube-recommendations-tensorflow-google-for-recommender-systems-v1.png\" alt=\"\" width=\"640\" class=\"aligncenter size-full wp-image-31504\" \/><\/a><small>A high-level architecture of deep neural networks for YouTube recommendations (<a href=\"https:\/\/www.slideshare.net\/seldon_io\/tensorflow-london-by-oliver-gindele-recommender-systems-in-tensorflow\" rel=\"noopener noreferrer\" target=\"_blank\">Image credit<\/a>)<\/small><\/center><\/p>\n<p>To sum it up, Oliver highlighted that using TensorFlow helps to significantly enhance the processes of deploying, training, and scaling a model, as well as allows for implementing custom algorithms quite straightforwardly.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Want_details_Watch_the_video\"><\/span>Want details? Watch the video!<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><center><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/X8RnCX4wW88\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen><\/iframe><\/center><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Related_slides\"><\/span>Related slides<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><center><iframe loading=\"lazy\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/pIsylJdvgOlUtT\" width=\"595\" height=\"485\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe><\/center><\/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\/tensorflow-for-recommendation-engines-and-customer-feedback-analysis\/\">TensorFlow for Recommendation Engines and Customer Feedback Analysis<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/machine-learning-for-automating-a-customer-service-chatbots-and-neural-networks\/\">Machine Learning for Automating a Customer Service: Chatbots and Neural Networks<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/the-diversity-of-tensorflow-wrappers-gpus-generative-adversarial-networks-etc\/\">The Diversity of TensorFlow: Wrappers, GPUs, Generative Adversarial Networks, etc.<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"About_the_expert\"><\/span>About the expert<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><small><a href=\"https:\/\/www.linkedin.com\/in\/oliver-gindele-13153540\/\" rel=\"noopener noreferrer\" target=\"_blank\">Oliver Gindele<\/a> is a Data Scientist at Datatonic. With a background in computational physics and high-performance computing, he is a machine learning practitioner experimenting with different deep learning solutions. Oliver holds a MSc degree in Material Science from ETH Z\u00fcrich and a PhD degree in Physics from University College London.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The accuracy of recommendations<\/p>\n<p id=\"caption-attachment-31552\" class=\"wp-caption-text\">Oliver Gindele<\/p>\n<p>Recommenders are widely used by e-commerce and multimedia companies worldwide to provide relevant items to a user. Many different algorithms and models exist to tackle the problem of finding the best product in retail, telco, and other industries. Recently, we have written how Google [&#8230;]<\/p>\n","protected":false},"author":3,"featured_media":31518,"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-31456","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 v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros<\/title>\n<meta name=\"description\" content=\"This blog post explores the techniques to improve recommendations using matrix factorization, multilayer perceptron, negative sampling, etc. with TensorFlow.\" \/>\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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros\" \/>\n<meta property=\"og:description\" content=\"The accuracy of recommendations Oliver Gindele Recommenders are widely used by e-commerce and multimedia companies worldwide to provide relevant items to a user. Many different algorithms and models exist to tackle the problem of finding the best product in retail, telco, and other industries. Recently, we have written how Google [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-05T18:26:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-16T21:07:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"360\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"Sophia Turol\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sophia Turol\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/\"},\"author\":{\"name\":\"Sophia Turol\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/58194952af19fe7b2b830846e077a58e\"},\"headline\":\"Building Recommenders with Multilayer Perceptron Using TensorFlow\",\"datePublished\":\"2018-03-05T18:26:48+00:00\",\"dateModified\":\"2021-12-16T21:07:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/\"},\"wordCount\":1249,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif\",\"keywords\":[\"Machine Learning\",\"TensorFlow\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/\",\"name\":\"Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif\",\"datePublished\":\"2018-03-05T18:26:48+00:00\",\"dateModified\":\"2021-12-16T21:07:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/58194952af19fe7b2b830846e077a58e\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif\",\"width\":640,\"height\":360},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/building-recommenders-with-multilayer-perceptron-using-tensorflow\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Recommenders with Multilayer Perceptron Using 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\\\/58194952af19fe7b2b830846e077a58e\",\"name\":\"Sophia Turol\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/trello_card-96x96.jpg\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/trello_card-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/trello_card-96x96.jpg\",\"caption\":\"Sophia Turol\"},\"description\":\"Sophia Turol is passionate about delivering well-structured articles that cater for picky technical audience. With 3+ years in technical writing and 5+ years in editorship, she enjoys collaboration with developers to create insightful, yet intelligible technical tutorials, overviews, and case studies. Sophie is enthusiastic about deep learning solutions\u2014TensorFlow in particular\u2014and PaaS systems, such as Cloud Foundry.\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/author\\\/sophie-turol\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros","description":"This blog post explores the techniques to improve recommendations using matrix factorization, multilayer perceptron, negative sampling, etc. with TensorFlow.","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\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/","og_locale":"en_US","og_type":"article","og_title":"Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros","og_description":"The accuracy of recommendations Oliver Gindele Recommenders are widely used by e-commerce and multimedia companies worldwide to provide relevant items to a user. Many different algorithms and models exist to tackle the problem of finding the best product in retail, telco, and other industries. Recently, we have written how Google [...]","og_url":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/","og_site_name":"Altoros","article_published_time":"2018-03-05T18:26:48+00:00","article_modified_time":"2021-12-16T21:07:59+00:00","og_image":[{"width":640,"height":360,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif","type":"image\/gif"}],"author":"Sophia Turol","twitter_misc":{"Written by":"Sophia Turol","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#article","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/"},"author":{"name":"Sophia Turol","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e"},"headline":"Building Recommenders with Multilayer Perceptron Using TensorFlow","datePublished":"2018-03-05T18:26:48+00:00","dateModified":"2021-12-16T21:07:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/"},"wordCount":1249,"commentCount":0,"image":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif","keywords":["Machine Learning","TensorFlow"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/","url":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/","name":"Building Recommenders with Multilayer Perceptron Using TensorFlow | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif","datePublished":"2018-03-05T18:26:48+00:00","dateModified":"2021-12-16T21:07:59+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/58194952af19fe7b2b830846e077a58e"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2018\/03\/tensorflow-for-recommender-systems-dataset-estimators-api-v1.gif","width":640,"height":360},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/building-recommenders-with-multilayer-perceptron-using-tensorflow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Building Recommenders with Multilayer Perceptron Using 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\/58194952af19fe7b2b830846e077a58e","name":"Sophia Turol","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/05\/trello_card-96x96.jpg","caption":"Sophia Turol"},"description":"Sophia Turol is passionate about delivering well-structured articles that cater for picky technical audience. With 3+ years in technical writing and 5+ years in editorship, she enjoys collaboration with developers to create insightful, yet intelligible technical tutorials, overviews, and case studies. Sophie is enthusiastic about deep learning solutions\u2014TensorFlow in particular\u2014and PaaS systems, such as Cloud Foundry.","url":"https:\/\/www.altoros.com\/blog\/author\/sophie-turol\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/31456","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=31456"}],"version-history":[{"count":72,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/31456\/revisions"}],"predecessor-version":[{"id":65681,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/31456\/revisions\/65681"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/31518"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=31456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=31456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=31456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}