{"id":9209,"date":"2020-08-04T08:01:25","date_gmt":"2020-08-04T08:01:25","guid":{"rendered":"https:\/\/www.experfy.com\/blog\/?p=9209"},"modified":"2023-11-23T10:49:36","modified_gmt":"2023-11-23T10:49:36","slug":"getting-your-machine-learning-model-out-to-the-real-world","status":"publish","type":"post","link":"https:\/\/www.experfy.com\/blog\/ai-ml\/getting-your-machine-learning-model-out-to-the-real-world\/","title":{"rendered":"Getting Your Machine Learning Model Out to the Real World"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9209\" class=\"elementor elementor-9209\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-3ef00fd9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3ef00fd9\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3d0e264b\" data-id=\"3d0e264b\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6ada4b18 elementor-widget elementor-widget-text-editor\" data-id=\"6ada4b18\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<p>Anexciting development in the past few years is the proliferation of machine learning in the product. We now see state-of-the-art computer vision models being deployed on mobile phones. State-of-the-art natural language processing models are being used to\u00a0<a href=\"https:\/\/blog.google\/products\/search\/search-language-understanding-bert\/\" target=\"_blank\" rel=\"noreferrer noopener\">improve<\/a>\u00a0<a href=\"https:\/\/www.itnews.com.au\/news\/abc-uses-machine-learning-to-improve-results-in-revamped-search-530277\" target=\"_blank\" rel=\"noreferrer noopener\">search<\/a>.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-221cf90 elementor-widget elementor-widget-text-editor\" data-id=\"221cf90\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3d1363f elementor-widget elementor-widget-text-editor\" data-id=\"3d1363f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>While there have been many articles on new, exciting <a href=\"https:\/\/www.experfy.com\/blog\/the-ten-algorithms-machine-learning-engineers-need-to-know\/\" target=\"_blank\" rel=\"noreferrer noopener\">machine learning algorithms<\/a>, there isn\u2019t as many on productizing machine learning models. There has been upcoming interest in the engineering of these systems, such as the\u00a0ScaledML conference, and the birth of\u00a0<a href=\"https:\/\/cloud.google.com\/solutions\/machine-learning\/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning\" target=\"_blank\" rel=\"noreferrer noopener\">MLOps<\/a>. However, productionizing machine learning models is a skill that is still in short supply.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>In my career so far, I\u2019ve gotten a few hard-earned lessons in productionizing machine learning models. Here are some of them.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c713b3b elementor-widget elementor-widget-heading\" data-id=\"c713b3b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2 id=\"4022\">Build or Buy?<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-594bad4 elementor-widget elementor-widget-text-editor\" data-id=\"594bad4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Twitter recently has been all abuzz about\u00a0<a href=\"https:\/\/github.com\/openai\/gpt-3\" target=\"_blank\" rel=\"noreferrer noopener\">GPT-3<\/a>. Primed with the right\u00a0<em>seed<\/em>, it turns out that GPT-3 can generate do many amazing things such as\u00a0<a href=\"https:\/\/twitter.com\/sharifshameem\/status\/1282676454690451457\" target=\"_blank\" rel=\"noreferrer noopener\">generating buttons on webpages<\/a>\u00a0and\u00a0<a href=\"https:\/\/twitter.com\/sharifshameem\/status\/1284095222939451393\" target=\"_blank\" rel=\"noreferrer noopener\">React code<\/a>. Spurred by these exciting developments, your stakeholder has an idea: what if you build a GPT-3 equivalent to help speed up the development of the frontend of the company you work at using GPT-3?<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dbe9536 elementor-widget elementor-widget-image\" data-id=\"dbe9536\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/980\/1*ezT40r7R5TF0tbXKKbxbSA.gif\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0607c90 elementor-widget elementor-widget-heading\" data-id=\"0607c90\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2>Should you train your own GPT-3 model?<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-97fce62 elementor-widget elementor-widget-text-editor\" data-id=\"97fce62\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Well, no! GPT-3 is a 175 billion parameter model that requires the resources most companies outside of the likes of Google and Microsoft would be hard-pressed to develop. Since OpenAI is trialling a beta for its GPT-3 API, it would be more prudent to try it out, and see if the model solves your use case, and the API scales to your use case.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>So then, to buy (more like rent) or build? It depends.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>It may look like a cop-out answer, but it is an age-old question in the software industry. It is also such a large and complicated topic, that it deserves a post of its own.<\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f65a2ac elementor-widget elementor-widget-text-editor\" data-id=\"f65a2ac\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>However, here I can offer some guidelines that can help you discuss buying vs. building question with a stakeholder. The first is<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>Is this use case not a core competence? Is it generic enough for an existing\/potential AWS\u00b9 offering?<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\n\n<!-- wp:paragraph -->\n<p>The underlying principle of this question is to ask yourself if\u00a0<strong>what you\u2019re about to work on is part of the company\u2019s core competence<\/strong>. If your stakeholders can afford it, it may be worth buying an off-the-shelf solution.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>Are resources besides data available? E.g., talent and infrastructure?<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7025122 elementor-widget elementor-widget-text-editor\" data-id=\"7025122\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>At its heart, building and deploying a reliable machine learning system is\u00a0<strong>still mostly software engineering, with an added twist:\u00a0<em>data management<\/em><\/strong>. If the team doesn\u2019t have experience building models as service APIs, with collecting, cleaning, labelling and storing data, then the amount of time needed can be prohibitive, say about 1 to 2 years (or even more). Instead, deploying a third party solution could take 3 to 6 months since it\u2019s mostly about integrating the solution into the product. Business owners would find this savings of time and cost extremely attractive.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>On the other hand, if it\u2019s related to the company\u2019s core competence, then investing in building up a team that can design and deploy models based on the company\u2019s proprietary data is the better way to go. It allows much more control and understanding of the process, though it does come with a high initial investment overhead.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-311bc96 elementor-widget elementor-widget-heading\" data-id=\"311bc96\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><h4>Just remember<\/h4><\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a2c469c elementor-widget elementor-widget-text-editor\" data-id=\"a2c469c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>All that matters to a business owner is: how will the output of your model be useful in the context of the business?<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\n\n<!-- wp:paragraph -->\n<p>Broadly speaking, machine learning is a next step up in automation. So in thinking this way, your model helps to increase revenue, or improves business efficiency by reducing costs.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>For instance, integrating a better recommendations system should lead to higher user satisfaction and engagement. Higher satisfaction leads to more subscriptions and organic promotion, which leads to higher revenue and lower churn.<\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2bbddf7 elementor-widget elementor-widget-text-editor\" data-id=\"2bbddf7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>As a data scientist, you have to help the business owner make the best decision on whether to build or buy, and that means assessing the specific pros and cons of either approach\u00a0<strong>in the context of the business<\/strong>.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The points in this\u00a0<a href=\"https:\/\/lethain.com\/build-vs-buy\/\" target=\"_blank\" rel=\"noreferrer noopener\">article<\/a>\u00a0are very useful in approaching the \u201cbuild vs. buy\u201d question, and it also applies to machine learning production. There\u2019s a case for building it yourself, as argued\u00a0<a href=\"https:\/\/www.joelonsoftware.com\/2001\/10\/14\/in-defense-of-not-invented-here-syndrome\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>, if it is a core business competence.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-59df6da elementor-widget elementor-widget-heading\" data-id=\"59df6da\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2 id=\"9039\">It all starts from the source<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b2e725 elementor-widget elementor-widget-text-editor\" data-id=\"5b2e725\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Consider the search results for a user who searched for photos of puppies. Here we have an example from Unsplash, one from Shutterstock, and finally one from EyeEm, this time on a mobile device.<\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-48b2c19 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"48b2c19\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-06edf16\" data-id=\"06edf16\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e5e5e94 elementor-widget elementor-widget-image\" data-id=\"e5e5e94\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/1354\/1*e86aGeqzcpwjY_48zPWang.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-980a530 elementor-widget elementor-widget-image\" data-id=\"980a530\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/2226\/1*dEE8BsUFafGKbT9-QE9nXQ.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-217b296 elementor-widget elementor-widget-image\" data-id=\"217b296\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/378\/1*UTU9scsx4oG2_NEZpBc9RQ.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cd0a338 elementor-widget elementor-widget-text-editor\" data-id=\"cd0a338\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We can see that while each user interface(UI) displays images in a wide selection. Suppose we want to use clicks on the image to train a model that gives better search results.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Which image would you be drawn to first if you were a user?<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>In the Shutterstock example, you may first be drawn to puppy on the right most side of the window, but in the EyeEm example, it could be the image in the center.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>It is clear that there are differences between each UI to cause differences in the distribution of the data collected.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-be7c37a elementor-widget elementor-widget-text-editor\" data-id=\"be7c37a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Information retrieval literature has demonstrated that a\u00a0<em>positional bias\u00b2<\/em>\u00a0and\u00a0<em>presentation bias<\/em>\u00b3 exists when displaying results. It is entirely possible for users to click on the first ranked result, even if it\u2019s not relevant to their search query, simply because it\u2019s the first thing they see, and they might be curious about the result!<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>We can see that the click data used to train search ranking models will have these biases in them, driven by how the UI was designed. So,<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>Know where and how the model will ultimately be used in the product<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c9f3e97 elementor-widget elementor-widget-text-editor\" data-id=\"c9f3e97\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A data scientist and machine learning engineer\u00a0<strong>cannot build models in isolation from where the model will ultimately be used<\/strong>. A consequence of this is that a data scientist has to work with all manners of specialties who are involved in the product: the product manager, the designer, the engineers (frontend and backend) and quality assurance engineers.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>The cross-functional team work provides benefits, including briefing all team members about the limitations of the model, how that affects UI design and vice versa. Another is to find simple, reliable ways to solve problems, for instance, not solving an inherent UI (and user experience) issue using machine learning. Designers can also come up with ways to make the presentation of results from the model look amazing, as well as constraining user actions in the UI to limit the space of inputs that goes into a model.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-50cb9e4 elementor-widget elementor-widget-text-editor\" data-id=\"50cb9e4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>A data scientist must build up domain knowledge about the product, including why certain UI decisions were made, and how they can impact your data downstream if product changes are made. The latter point is especially important, since it can mean your model is outdated very quickly when product changes are rolled out.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Moreover, how the results from the model are presented is important so as to minimize bias in future training data, as we shall see next.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-06300b3 elementor-widget elementor-widget-heading\" data-id=\"06300b3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2 id=\"4ea0\">Data collection is still challenging<\/h2>\n<!-- \/wp:heading --><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8b9637b elementor-widget elementor-widget-text-editor\" data-id=\"8b9637b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Analytics collection typically depend on engineers setting up analytics events in the services they are responsible for on various parts of the product. Sometimes, analytics are not collected, or collected with noise and bias in them. Analytics events can be dropped, resulting in missing data. Clicks on a button are not debounced, resulting in multiple duplicate events.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Machine learning models are, unfortunately, typically downstream consumers of these analytics data, which means problems with measurements and data collection has a huge impact on the models.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>If there\u2019s one thing to remember about data it\u2019s that<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>Data is merely a byproduct of measurement<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f32cd8f elementor-widget elementor-widget-text-editor\" data-id=\"f32cd8f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>This means that it is important to\u00a0<strong>understand where the data is coming from, and how it is being collected<\/strong>. It is also then paramount that measurements are made correctly, with tests on the measurement system conducted periodically to ensure good data quality. It would also be prudent to work with an engineer and a data analyst to understand the issues first-hand because there\u2019s usually a \u201cgotcha\u201d in collected data.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Stored data needs to be\u00a0<strong>encoded to suit the business domain<\/strong>. Let\u2019s take image storage for instance. In most domains, a lossy JPEG image may be fine to encode your stored images, but not in some domains where very high resolution is needed, such as using machine learning for detecting anomalies in MRI scans, for instance. It\u2019s important that these issues be communicated up-front to engineers who are helping you collect the data.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-36c8aa9 elementor-widget elementor-widget-text-editor\" data-id=\"36c8aa9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Machine learning in research differs from machine learning in the product in that\u00a0<strong>generally your biggest wins come from better data, not so much better algorithms<\/strong>. There are exceptions, though, such as deep learning improving performance metrics in many areas. Even then, these algorithms are still sensitive to the training data, and you need a whole lot more data.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>It is always worth convincing your stakeholder to continually invest in improving the data collection infrastructure<\/strong><em>.\u00a0<\/em>Sometimes, just even a new source of data to construct new features can boost model performance metrics. Not only does it help with better models, it helps with better tracking of the company\u2019s key metrics and product features overall. The data analysts you work with will be very thankful for that.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7332b96 elementor-widget elementor-widget-text-editor\" data-id=\"7332b96\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>As an ex-Dropbox data scientist told me recently<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>Your biggest improvements usually come from sitting down with an engineer to improve analytics<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6c69b25 elementor-widget elementor-widget-heading\" data-id=\"6c69b25\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2 id=\"e2aa\">Check your assumptions on the data<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ecf180f elementor-widget elementor-widget-text-editor\" data-id=\"ecf180f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Here is one story I experienced first-hand from the trenches.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>During the early days of incorporating learning-to-rank models to improve image search at\u00a0<a href=\"https:\/\/www.canva.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"broken_link\">Canva<\/a>, we planned to use a set of relevance judgments sourced from Mechanical Turk. Canva has a graphic design editor tool that allows a user to search over 50 million images to include into their design.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Basically, what this meant was collected sets of pairwise judgements: for each search term, raters are given a pair of images, one of them which they give a thumbs up to. An example pairwise judgement rating for the term\u00a0<em>firefly\u00a0<\/em>is shown below. Although both are relevant, the image on the left is more preferred by the rater than the image on the right.<\/p>\n<!-- \/wp:paragraph -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-2a442a4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2a442a4\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f5fd557\" data-id=\"f5fd557\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1ba32f4 elementor-widget elementor-widget-image\" data-id=\"1ba32f4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/710\/1*ggxel_0HfnGMR0MjTW4yOg.png\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-952e67c elementor-widget elementor-widget-text-editor\" data-id=\"952e67c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We then trained a model using these pairwise judgements, and another model that solely relied on clicks from search logs. The latter has more data, but is of lower quality due to positional bias and errant clicks. Both models look great on offline ranking metrics, and a visual check of the results (<em>i.e.,\u00a0<\/em>manually, using our eyes).<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>In online experiments, however, the model that relied on these sourced relevance judgements had a very poor performance, tanking business metrics, compared to the control and the other model.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1f317d0 elementor-widget elementor-widget-heading\" data-id=\"1f317d0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3>What happened?<\/h3><\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-641143d elementor-widget elementor-widget-text-editor\" data-id=\"641143d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>As it turned out, we sourced the judgements\u00a0<em>without<\/em>\u00a0the context of users searching for images to fit their design, not just on pure search relevance alone. This missing context contributed to a dataset that had a different distribution from the data distribution in the product.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Needless to say, we were wrong in our assumption.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><em>Data distribution skew<\/em>\u00a0is a very real problem: even the team that implemented the Quick Access functionality in Google Drive at Google faced it\u2074. In this case, the distribution of data collected for their development environment did not match the data distribution of the final deployed environment, as the training data was not collected from a production service.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\">\n<p>The data used to train your models should match the final environment where your model will be deployed<\/p>\n<\/blockquote>\n<!-- \/wp:quote -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7bb19a0 elementor-widget elementor-widget-text-editor\" data-id=\"7bb19a0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>A sample of other assumptions to check for are<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list {\"ordered\":true} -->\n<ol>\n<li>the appearance of a\u00a0<strong>concept drift<\/strong>, where a significant shift in the data distribution happens (<a href=\"https:\/\/www.technologyreview.com\/2020\/05\/11\/1001563\/covid-pandemic-broken-ai-machine-learning-amazon-retail-fraud-humans-in-the-loop\/\" target=\"_blank\" rel=\"noreferrer noopener\">a very recent example is the COVID-19 outbreak messing with prediction models<\/a>),<\/li>\n<li>the\u00a0<strong>predictive power of features<\/strong> going into the model as some features decay in predictive power over time, and<\/li>\n<li><strong>product deprecations<\/strong>, resulting in features disappearing.<\/li>\n<\/ol>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>These are partially solvable by having monitoring systems in place to check data quality and model performance metrics, as well as flag anomalies. Google has provided an excellent checklist on scoring your current production machine learning system\u00a0<a href=\"https:\/\/research.google\/pubs\/pub46555\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>, including data issues to watch out for.<\/p>\n<!-- \/wp:paragraph -->\n<!-- wp:paragraph -->\n<p>Remember, if a team at Google, whose maturity in deploying machine learning systems is one of the best in the world, had data assumption problems, you should certainly double-check your assumptions about your training data.<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-670824f elementor-widget elementor-widget-heading\" data-id=\"670824f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h2 id=\"7380\">Wrapping it all up<\/h2><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-790b72c elementor-widget elementor-widget-text-editor\" data-id=\"790b72c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<!-- wp:paragraph -->\n<p>Machine learning systems are very powerful systems. They provide companies with new options in creating new product features, improving existing product features, and improving automation.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>However, these systems are still fragile, as there are more considerations about how it\u2019s designed, and how data is collected and used to train models.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>I still have more to say on the topic, but these will do for now.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:separator --><hr class=\"wp-block-separator\" \/><!-- \/wp:separator -->\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-556f8e9 elementor-widget elementor-widget-text-editor\" data-id=\"556f8e9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>[1] Substitute with your favorite cloud provider.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>[2] Thorsten Joachims, Laura Granka, Bing Pan, Helene Hembrooke, and Geri Gay,\u00a0<a href=\"https:\/\/www.cs.cornell.edu\/people\/tj\/publications\/joachims_etal_05a.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Accurately Interpreting Clickthrough Data As Implicit Feedback<\/a>, In Proc. of the 28th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR), pp.154\u2013161 (2005).<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>[3] Yisong Yue, Rajan Patel, and Hein Roehrig,\u00a0<a href=\"https:\/\/static.googleusercontent.com\/media\/research.google.com\/en\/\/pubs\/archive\/36363.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Beyond Position Bias: Examining Result Attractiveness As a Source of Presentation Bias in Clickthrough Data<\/a>, In Proc. of the 19th International Conference on World Wide Web (WWW), pp. 1011\u20131018 (2010).<\/p>\n<!-- \/wp:paragraph -->\n<!-- wp:paragraph -->\n<p>[4] Sandeep Tata, Alexandrin Popescul, Marc Najork, Mike Colagrosso, Julian Gibbons, Alan Green, Alexandre Mah, Michael Smith, Divanshu Garg, Cayden Meyer, Reuben Kan,\u00a0<a href=\"https:\/\/dl.acm.org\/doi\/10.1145\/3097983.3098048\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"broken_link\">Quick Access: Building a Smart Experience for Google Drive<\/a>, KDD \u201917: Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp.1643\u20131651 (2017)<\/p>\n<!-- \/wp:paragraph -->\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Machine learning systems are very powerful systems. They provide companies with new options in creating new product features, improving existing product features, and improving automation. However, these systems are still fragile, as there are more considerations about how it\u2019s designed, and how data is collected and used to train models.<\/p>\n","protected":false},"author":875,"featured_media":9210,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[183],"tags":[92,850,518],"ppma_author":[3814],"class_list":["post-9209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-ml","tag-machine-learning","tag-machine-learning-models","tag-train-models"],"authors":[{"term_id":3814,"user_id":875,"is_guest":0,"slug":"paul-tune","display_name":"Paul Tune","avatar_url":"https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2020\/08\/Paul-Tune-150x150.jpg","user_url":"http:\/\/www.canva.com","last_name":"Tune","first_name":"Paul","job_title":"","description":"Paul Tune is Machine Learning Engineer at Canva"}],"_links":{"self":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/users\/875"}],"replies":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/comments?post=9209"}],"version-history":[{"count":6,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9209\/revisions"}],"predecessor-version":[{"id":34288,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/9209\/revisions\/34288"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media\/9210"}],"wp:attachment":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media?parent=9209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/categories?post=9209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/tags?post=9209"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=9209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}