<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vladimir Chernykh on Medium]]></title>
        <description><![CDATA[Stories by Vladimir Chernykh on Medium]]></description>
        <link>https://medium.com/@vovacher?source=rss-c4a131e1558e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6Zh8u-vU3JIeym-nt4egKQ@2x.jpeg</url>
            <title>Stories by Vladimir Chernykh on Medium</title>
            <link>https://medium.com/@vovacher?source=rss-c4a131e1558e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 17:40:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vovacher/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[4 ways to mess up your Computer Vision model in Production]]></title>
            <link>https://medium.com/data-science/4-ways-to-mess-up-your-computer-vision-model-in-production-d4e198486928?source=rss-c4a131e1558e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4e198486928</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Vladimir Chernykh]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 11:27:07 GMT</pubDate>
            <atom:updated>2022-02-21T11:27:07.794Z</atom:updated>
            <content:encoded><![CDATA[<h4>Or the importance of careful image preprocessing before sending it to the neural network</h4><figure><img alt="A pair of glasses lying in front of the laptop" src="https://cdn-images-1.medium.com/max/1024/1*DlJ6GhfkxogYCeP2Iazbow.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk">Kevin Ku</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h3>Intro</h3><p>This article is not about the quality of the models. It is not even about scaling, load balancing, and other devops. It is about a more general yet sometimes missed thing: handling heterogeneous and unpredictable user inputs.</p><p>When training the model, data scientists almost always have a controlled data environment. It means that one uses an already prepared dataset or has the time and resources to manually collect, merge, clean, and check the data. By doing this accurately, one improves the quality of the model trained on these data.</p><p>Imagine the model is good enough to be deployed into the production. In the best-case scenario, one can still control the environment (classical server-side deployment). But even then, users would upload images from a vast variety of devices and sources. In the case of edge deployment, there’s one more layer of complexity: one can not control the environment.</p><p>In both cases, the model should answer right away and developers do not have time to check the data manually. Therefore it’s crucial to:</p><ul><li>Prepare the data on-the-fly</li><li>Do it as close to the training-time preprocessing as possible</li></ul><p>Otherwise, the real-life production model quality might be much lower than anticipated. It happens because one introduces the bias to the data, which the model does not expect.</p><h3>Real cases</h3><p>In what follows, I’ll cover 4 issues that I’ve met while working on the computer vision models in my <a href="https://retouchee.com/">retouchee</a> startup.</p><p>Each is related to image processing before passing it to the algorithm (mainly neural networks):</p><ul><li>Orientation stored in EXIF</li><li>Non-standrad color profile</li><li>Differences in image libraries</li><li>Resizing algorithms</li></ul><p>For each item, I would provide a case study with examples and a piece of code that resolved it in production for me.</p><p>All the code samples, data, and environment details can be found in the GitHub repository: <a href="https://github.com/vladimir-chernykh/cv-prod-tips">https://github.com/vladimir-chernykh/cv-prod-tips</a></p><h4>Orientation stored in EXIF</h4><p>Nowadays, people take most photos using mobile cameras (~91% and this number is growing). [<a href="https://blog.mylio.com/how-many-photos-will-be-taken-in-2020/">source</a>].</p><p>Often mobile device stores the image in some pre-determined fixed orientation no matter what the real camera position was when the photo was taken. The rotation angle necessary to restore the initial orientation is stored as the meta-information in <a href="https://en.wikipedia.org/wiki/Exif">EXIF</a>. Example: iPhone always stores JPEG images horizontally. In addition to that, there is a rotation (and mirroring) angle in EXIF. [<a href="https://ruk.ca/content/fixing-problem-sideways-iphone-photos-uploaded-drupal">source 1</a>, <a href="https://news.ycombinator.com/item?id=21207411">source 2</a>].</p><figure><img alt="An image of the cup with its metadata shown" src="https://cdn-images-1.medium.com/max/1024/1*-AvepHcOglHiKai5h3vk_A.jpeg" /><figcaption>Photo by the author on iPhone 12. Orientation is stored in EXIF and Mac’s “Preview” handles it correctly.</figcaption></figure><p>Watching such images on a mobile device or modern desktop software might be fine because they can handle this EXIF information. But when engineer loads the image programmatically, many libraries read the raw pixels data and omit the meta-information. It leads to the wrong image orientation. In the example below, I use <a href="https://github.com/python-pillow/Pillow">PIL</a>, which is one of the most popular Python libraries for image handling.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63182&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63182&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e43338ca282286d42af815fe9bc6169c/href">https://medium.com/media/e43338ca282286d42af815fe9bc6169c/href</a></iframe><figure><img alt="An image of the cup read using the code and rotated incorrectly" src="https://cdn-images-1.medium.com/max/1024/1*K7DnqTRO8oj5c8I1Ze4dXw.jpeg" /><figcaption>Image is read via code.</figcaption></figure><p>Sending an image like that to the neural network might generate completely random results.</p><p>To fix that problem, one needs to read the EXIF info as well and rotate/mirror an image correspondingly.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63183&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63183&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea1ebc287955978260257be798570fd5/href">https://medium.com/media/ea1ebc287955978260257be798570fd5/href</a></iframe><p>PIL allows to read EXIF meta-information and parse it. One needs to know where to look for the orientation. Amazing <a href="https://exiftool.org/TagNames/EXIF.html">Exiftool documentation</a> helps with that. The byte which stores the necessary information is 0x0112. The same docs hint how to treat each value and what to do with the image to restore initial orientation.</p><figure><img alt="An image of the cup read using the code accounting for EXIF and rotated correctly" src="https://cdn-images-1.medium.com/max/1024/1*QLegrcWGOGA-ETylFXaamA.jpeg" /><figcaption>Image is read via code, taking EXIF into account.</figcaption></figure><p>The issue seems to be solved, right? Well, not quite yet.</p><p>Let’s try another photo. This time I’ll be using modern <a href="https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format">HEIF</a> image format instead of old JPEG (note that one needs a special PIL <a href="https://github.com/uploadcare/heif-image-plugin/">plugin</a> for that). iPhone shoots <a href="https://en.wikipedia.org/wiki/Multi-exposure_HDR_capture">HDR</a> pictures in this format by default.</p><figure><img alt="An image of the girl standing in the door along with its metadata shown" src="https://cdn-images-1.medium.com/max/1024/1*5AYgQYyv6HbuLET9orHMVQ.jpeg" /><figcaption>Photo by the author on iPhone 12. Orientation is stored in EXIF and Mac’s “Preview” handles it correctly.</figcaption></figure><p>Everything looks the same. Let’s try to read it from the code in a naive way without looking at EXIF.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63199&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63199&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e78c13962dc1103764c2cfe38af311de/href">https://medium.com/media/e78c13962dc1103764c2cfe38af311de/href</a></iframe><figure><img alt="An image of the girl standing in the door read using the code" src="https://cdn-images-1.medium.com/max/1024/1*XDr8c7v9K2zTwckOo46a9w.jpeg" /><figcaption>Image is read via code without taking EXIF into account.</figcaption></figure><p>The raw image orientation is correct! But EXIF suggests that one should rotate it 90° CCW! So the orientation restoration code would fail.</p><p>It is a known issue with iPhone shooting in HEIC. [<a href="https://github.com/ImageMagick/ImageMagick/issues/1232">source 1</a>, <a href="https://blog.feld.me/posts/2019/10/iphone-11-pro-has-broken-exif-orientation-data/">source 2</a>, <a href="https://github.com/photoprism/photoprism/issues/1064">source 3</a>]. For some unclear reason iPhone stores raw pixels right but still keeps a sensor orientation in EXIF when taking pictures in this format.</p><p>Therefore one should fix the algorithm and omit rotation when the image is taken on an iPhone and is in HEIC format.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63200&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63200&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/34e317ce957a4d9358fa4b722844f299/href">https://medium.com/media/34e317ce957a4d9358fa4b722844f299/href</a></iframe><figure><img alt="An image of the girl standing in the door read using the code accounting for EXIF and rotated correctly" src="https://cdn-images-1.medium.com/max/1024/1*DgbgJSgicGnKxBBV14K-zg.jpeg" /><figcaption>Image is read via code, taking EXIF into account.</figcaption></figure><p>Surely there might be more issues with image orientation from other devices, and this piece of code might not be exhaustive. But it clearly shows how careful one should deal with user inputs and how unpredictable they can be even without malicious intent.</p><h4>Non-standrad color profile</h4><p>Meta-information hides one more challenge. Pictures might be taken and stored in different <a href="https://en.wikipedia.org/wiki/Color_space">color spaces</a> and <a href="https://en.wikipedia.org/wiki/ICC_profile">color profiles</a>.</p><p>With color space, it’s more or less clear. It defines the channels used to store the image color information for each pixel. The two most common color spaces are <a href="https://en.wikipedia.org/wiki/RGB_color_model">RGB</a> (Red-Green-Blue) and <a href="https://en.wikipedia.org/wiki/CMYK_color_model">CMYK</a> (Cyan-Magenta-Yellow-Black). And one would hardly miss images in CMYK because they have a different number of channels: 4 vs 3 in RGB. Thus sending it to the network would break it right away because of the wrong number of input channels. So this conversion from CMYK to RGB is rarely forgotten.</p><p>The color profile is a much trickier thing. It is the characteristic of the input (camera) or output (display) device. It accounts for the device-specific way of recording or showing colors. RGB color space has <a href="https://en.wikipedia.org/wiki/RGB_color_spaces">lots of different profiles</a>: <a href="https://en.wikipedia.org/wiki/SRGB">sRGB</a>, <a href="https://en.wikipedia.org/wiki/Adobe_RGB_color_space">Adobe RGB</a>, <a href="https://en.wikipedia.org/wiki/DCI-P3#Display_P3">Display P3</a>, etc. Each profile defines its own way of mapping raw RGB values into the real colors that the human eye percepts.</p><p>It leads to the fact that the same raw RGB values might imply different colors in different pictures. To tackle this problem one needs to carefully convert color profiles of all images into one chosen standard. Usually, it is an sRGB profile because due to historical reasons it is a default color profile for all the web.</p><figure><img alt="An image of the city with its metadata shown" src="https://cdn-images-1.medium.com/max/1024/1*i0kCvx5hd3zBBZixCz3Jxg.jpeg" /><figcaption>Photo by the author on iPhone 12. A color profile is “Display P3” and is stored in EXIF.</figcaption></figure><p>Pictures shot on iPhone often have a Display P3 color profile. Let’s read the image from code and see what it looks like with and without color profile conversion.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63272&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63272&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/792c175933da5ce3458527747e728f51/href">https://medium.com/media/792c175933da5ce3458527747e728f51/href</a></iframe><figure><img alt="An image of the city read using the code with and without color profile information" src="https://cdn-images-1.medium.com/max/1024/1*NhA56hWRCPupMgis5X7LSQ.jpeg" /><figcaption>Image is read via code with (right column) and without (left column) color profile information.</figcaption></figure><p>One can see that the image read with color profile conversion is more vibrant and is closer to the original. Depending on the picture and color profile, this difference might be bigger or smaller. Some images might even look like sepia without profile conversion.</p><p>The colors (i.e., pixel values) that one sends into the neural network might influence the final quality and spoil the predictions. Therefore it’s crucial to work with them appropriately.</p><h4>Differences in image libraries</h4><p>Correctly reading images is extremely important. But at the same time, one should do it as fast as possible. Because time is literally money in the era of cloud computing. Plus, clients do not want to wait for too long.</p><p>The ultimate solution here would be to switch to C/C++. And sometimes, it might make total sense in the production inference setting. But if one wants to stay inside the Python ecosystem, there are options. Each image library has its own capabilities and speed.</p><p>Up until this moment, I used only the PIL module. I would take two other popular libraries for the sake of this comparison: <a href="https://opencv.org/">OpenCV</a> and <a href="https://scikit-image.org/">Scikit-image</a>.</p><p>Let’s see how fast each of the libraries can read JPEG images of different sizes.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63313&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63313&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b63a68d14f7fd6bd3331f35e44d5269/href">https://medium.com/media/1b63a68d14f7fd6bd3331f35e44d5269/href</a></iframe><figure><img alt="Three growing curves showing read time for each of the libraries" src="https://cdn-images-1.medium.com/max/1024/1*WaFqWlhlVCa_eejujU9VTA.jpeg" /><figcaption>The graph shows how different libraries reading speed depends on the image size.</figcaption></figure><p>For small images, there is almost no difference. But for the big ones, the OpenCV is approximately 1.5x times faster than PIL and Scikit-image. This difference might vary from 1.4x to 2.0x depending on the image content and format (JPEG, PNG, etc.). But in general, OpenCV is much faster.</p><p>There are other solid benchmarks on the web [<a href="https://www.kaggle.com/zfturbo/benchmark-2019-speed-of-image-reading">source 1</a>, <a href="https://github.com/ethereon/lycon#benchmarks">source 2</a>] that give approximately the same numbers. The difference might be even more dramatic for image writing: OpenCV is 4x — 10x faster.</p><p>One more extremely common operation is resizing. One almost always resizes images before sending them into the neural net. And this is where OpenCV really shines.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63315&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63315&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/59bdddcc4c8f3b0b3cccc52f20805a1b/href">https://medium.com/media/59bdddcc4c8f3b0b3cccc52f20805a1b/href</a></iframe><p>Here I take one 7360x4100 image and resize it down to 1000x1000. OpenCV does it 22x faster than PIL and 755x faster than Scikit-image!</p><p>One can save tons of time by choosing the right library. The thing to be aware of is that the same resizing algorithm might give different results in different implementations:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63316&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63316&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/74e878eefe66a2baac9d3d0019ccc7a7/href">https://medium.com/media/74e878eefe66a2baac9d3d0019ccc7a7/href</a></iframe><p>Here one can notice that I do downsampling with linear interpolation for both OpenCV and PIL. The original images are the same. But the rezised results are different. And the difference is quite significant: 5 out of 255 on average for each pixel color.</p><p>Therefore it might influence the model quality if one uses different libraries for resizing during training and inference. So one should keep an eye on it.</p><h4>Resizing algorithms</h4><p>Apart from speed differences across libraries, there are different resizing algorithms even inside one library. Which of them should one choose? At least, it depends on whether one wants to decrease the image size (downsample) or increase it (upsample).</p><p>There are <a href="https://en.wikipedia.org/wiki/Image_scaling#Algorithms">numerous algorithms</a> to resize images. They differ in the resulting image quality and speed. I would look only at those 5, which are good and fast enough and are supported in mainstream libraries.</p><p>The results provided below also align with several guidelines and examples. [<a href="https://pillow.readthedocs.io/en/stable/handbook/concepts.html#filters-comparison-table">source 1</a>, <a href="https://docs.opencv.org/4.5.5/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d">source 2</a>, <a href="https://chadrick-kwag.net/cv2-resize-interpolation-methods/">source 3</a>].</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63320&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63320&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/04240623c47150edb033227b34e26d01/href">https://medium.com/media/04240623c47150edb033227b34e26d01/href</a></iframe><figure><img alt="Grid of images downsampled with different resizing algorithms" src="https://cdn-images-1.medium.com/max/1024/1*ti67s_gqHDYXAIiEo-6tWw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@aleskrivec">Alex Krivec</a> on <a href="https://unsplash.com/">Unsplash</a>. Different resizing algorithms are applied to downsample the same image.</figcaption></figure><p>For downsampling, the “area” algorithm looks the best (describing what happens under the hood goes beyond the scope of the article). It produces the least noise and artifacts. In fact, it is the preferred choice for downsampling following OpenCV <a href="https://docs.opencv.org/4.5.5/da/d54/group__imgproc__transform.html#ga47a974309e9102f5f08231edc7e7529d">guidelines</a>.</p><p>Let’s now upsample this “area”-downsampled image back to the original size and see which algorithm would work best in this case.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F63324&amp;dntp=1&amp;display_name=Snipit&amp;url=https%3A%2F%2Fsnipit.io%2Fpublic%2Flists%2F19500%2F63324&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f9cd32ba4007f22a1d694dc8bebcea8/href">https://medium.com/media/7f9cd32ba4007f22a1d694dc8bebcea8/href</a></iframe><figure><img alt="Grid of images upsampled with different resizing algorithms" src="https://cdn-images-1.medium.com/max/1024/1*AB0X5ORLwDML5Zzl5KhKEA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@aleskrivec">Alex Krivec</a> on <a href="https://unsplash.com/">Unsplash</a>. Different resizing algorithms are applied to upsample the same image.</figcaption></figure><p>For upsampling, the algorithms produce more consistent results. Nevertheless, “cubic” interpolation looks the least blurred and the closest to the original (“lanczos” provides similar results but is much slower).</p><p>So the final verdict here is to use an “area” interpolation for downsampling and a “cubic” algorithm for upsampling.</p><p>Note that the correct resizing algorithm choice is also important during training because it improves the overall image quality. And what is even more important is that the resizing algorithms in training and inference stages should be the same. Otherwise you already know what might happen.</p><h3>Conclusion</h3><p>In this article, I described the real cases and issues that I met many times during my years of working in computer vision. Each of them, when dealt carelessly, might significantly lower the model quality in production (even if the training numbers are ok). I would be glad to discuss your cases in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4e198486928" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/4-ways-to-mess-up-your-computer-vision-model-in-production-d4e198486928">4 ways to mess up your Computer Vision model in Production</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous quality evaluation for ML projects using GitHub Actions.]]></title>
            <link>https://medium.com/data-science/continuous-quality-evaluation-for-ml-projects-using-github-actions-78f2f078e38f?source=rss-c4a131e1558e------2</link>
            <guid isPermaLink="false">https://medium.com/p/78f2f078e38f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[quality]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Vladimir Chernykh]]></dc:creator>
            <pubDate>Wed, 15 Jan 2020 21:35:16 GMT</pubDate>
            <atom:updated>2020-01-15T21:35:16.540Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to setup an automatic metrics collection for GitHub repo and how I used it to win NLP competition.</h4><figure><img alt="Quality score dashboard" src="https://cdn-images-1.medium.com/max/1024/0*yeYGOpIt-Iu-iXXZ" /><figcaption>Photo by <a href="https://unsplash.com/@srd844?utm_source=medium&amp;utm_medium=referral">Stephen Dawson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this post, the automatic quality evaluation of Machine Learning (ML) based algorithms is discussed.</p><p>Recently I and my team have taken <a href="https://contest.ai-journey.ru/en/leaderboard">2nd place</a> in <a href="https://contest.ai-journey.ru/en/competition">Sberbank AIJ competition 2019</a> which is one of the largest ML contests in Russia (100 teams, 45k$ prizes). This year the task was to solve the Russian language <a href="https://en.wikipedia.org/wiki/Unified_State_Exam">high school graduation exam</a> consisting of many different Natural Language Processing (NLP) subtasks each of which requires a separate ML model. It leads our team to the urgent need for an automatic quality evaluation system. Based on my production experience I’ve built such a system and I’d like to share it here.</p><p>All the code from this post is available in the Github repository: <a href="https://github.com/vladimir-chernykh/ml-quality-cicd">https://github.com/vladimir-chernykh/ml-quality-cicd</a></p><h3>Introduction</h3><p>In the last few years, the ML field has been growing extremely fast. Because of that growth and the consecutive need to do everything as fast as possible many projects lack testing. At the same time, classical software development is far more mature area and has lots to learn from (<a href="https://medium.com/@karpathy/software-2-0-a64152b37c35">Software 1.0 vs Software 2.0</a>). Proper testing of the product is one of such things. One can learn more about testing and its different types starting from these links [<a href="https://en.wikipedia.org/wiki/Software_testing">1</a>, <a href="https://medium.com/edureka/types-of-software-testing-d7aa29090b5b">2</a>, <a href="https://testing.googleblog.com/">3</a>, <a href="https://techcommunity.microsoft.com/t5/TestingSpot-Blog/bg-p/TestingSpotBlog">4</a>]</p><figure><img alt="Different types of software tests" src="https://cdn-images-1.medium.com/max/1024/1*fQ-vAlZntxPwwF9negRapw.png" /><figcaption>Figure 1: One of the software testing classifications</figcaption></figure><p>While classical algorithms and applications are deterministic, most Machine Learning based counterparts are inherently stochastic.</p><p>It introduces one more type of tests which might be not that relevant previously: algorithm quality tests. They evaluate how accurate the model can solve the underlying task, e.g., predict stock prices, distinguish between cats and dogs in images, etc. For sure, there were approximate and stochastic algorithms since a long time ago, but with the rise of ML, they have become ubiquitous (+ many classical algorithms have theoretical bounds on their quality).</p><p>The quality evaluation is crucially important when it comes to production deployment. One needs to know how well the model performs, its applicability scope and weak sides. Only then the model can be used efficiently and benefit the product.</p><p>Almost every Data Scientist knows how to evaluate the quality of the model in the development environment, e.g., Jupyter notebook, IDE of choice, etc. But for production purposes, it is important not only to know the current quality metrics but also to keep track of their changes over time. There are at least three ways to tackle this issue:</p><ul><li>Surf through commit history in code storage (GitHub, BitBucket, etc.)</li><li>Store results in spreadsheets, wiki pages, readme files, etc.</li><li>Automatic metrics collection and storage</li></ul><p>Each of these options has its usage scenarios. First two options work well when there are not many changes to the model and they happen rarely. Whilst the last approach is inevitable when the model changes frequently and one wants to have a stable and convenient way of tracking it. In what follows the last approach is called continuous.</p><h3>CI/CD</h3><p>One of the convenient ways to implement continuous evaluation is to use <a href="https://www.redhat.com/en/topics/devops/what-is-ci-cd">Continuous Integration/Continuous Delivery</a> (CI/CD) system. There are many options available at the market:</p><ul><li><a href="https://jenkins.io/">Jenkins</a></li><li><a href="https://circleci.com/">CircleCI</a></li><li><a href="https://travis-ci.com/">TravisCI</a></li><li>…</li></ul><p>The ultimate goal of all CI/CD systems is to automate build, testing, merging, deployment, etc. The whole CI/CD pipeline works in conjunction with code repository and triggered by the specific event (usually commit).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PE2o3w7Iu6f0imBe9frlHA.png" /><figcaption>Figure 2: CI/CD principal scheme. Find more info in sources [<a href="https://semaphoreci.com/cicd">5</a>, <a href="https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment">6</a>, <a href="https://docs.gitlab.com/ee/ci/introduction/">7</a>]</figcaption></figure><p>Recently GitHub launched its own CI/CD system called <a href="https://github.com/features/actions">GitHub Actions</a>. Previously I used Jenkins for several production-grade CI/CD systems. AIJ competition was a perfect chance to experiment with the new tool and I decided to give it a try. There are a couple of points about Actions that stand it out:</p><ul><li>Inherent integration with GitHub. If one has already been using GitHub repositories for code management then Actions should work seamlessly.</li><li>GitHub provides on-demand virtual machines for running the whole pipeline. It means that there is no need to manage own machines and its connection to GitHub Actions. Though there is a possibility to do that if one needs a huge VM or has any other specific requests (self-hosted runners have been <a href="https://github.blog/2019-11-05-self-hosted-runners-for-github-actions-is-now-in-beta/">released</a> in beta recently).</li><li>For private repos there is a usage limit for free accounts (2000 minutes/month), for public repos there are no limits though. More info <a href="https://help.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-actions">here</a>. I have used GitHub Actions for 2 small projects and haven’t hit the limit but it’s pretty easy in case of bigger projects. In this case, Jenkins/Travis/etc. might be a better alternative.</li></ul><p>For a more comprehensive and detailed description please look in the <a href="https://help.github.com/en/actions">official docs</a>.</p><h3>Task</h3><p>To illustrate how the system is built and how it works I would use the toy example and build a model to solve the <a href="https://www.kaggle.com/vikrishnan/boston-house-prices">Boston House Prices</a> task. In practice, this system was applied to the AIJ competition NLP task.</p><h4>Real task: AIJ competition</h4><p>The real-world practical task from which this continuous quality evaluation system has arisen is about solving the Russian language exam at AIJ competition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZJQGWBe1PuHJWsdi8kngg.png" /><figcaption>Figure 4: AIJ contest evaluation pipeline</figcaption></figure><p>The peculiarity of this competition is that there are many completely different subtasks (27) which we end up solving with different models. Examples of subtasks are:</p><ul><li>Choose the word (out of several) with incorrect stress</li><li>Where the comma should be inserted</li><li>In which sentences the dashes are put according to the same rule</li><li>Which statements are held for the given text</li><li>Build a mapping between the type of grammatical mistake and the sentence where it occurred</li></ul><p>There were 3 different automated metrics (Figure 4) and each subtask was judged by one of them. The final ranking is based on the sum of the metrics across subtasks.</p><p>We have been solving these subtasks one-by-one and often returned to the one we had solved before to improve it. Thus we urgently needed an automatic system that keeps track of changes in metrics for particular tasks as well as the aggregative metric.</p><p>I do not describe the exact solution of the AIJ contest here because it is too bulky and complicated. It would distract from the main point of the article. But getting into the context under which the system was build might benefit the understanding of the system and decisions being made.</p><h4>Toy task: Boston House Prices</h4><p>This is the regression problem where one needs to predict the price of the housing facility based on different factors such as the number of rooms, neighborhood crime rate, etc.</p><p>This is one of the “default” classical datasets. It is even presented directly in the <a href="https://scikit-learn.org/stable/">scikit-learn</a> library</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24474&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24474&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4045cac7b129e56a7bfd95ca70321a77/href">https://medium.com/media/4045cac7b129e56a7bfd95ca70321a77/href</a></iframe><figure><img alt="Boston House Prices data examples" src="https://cdn-images-1.medium.com/max/1024/1*3IQzOMHf0VQGM4t_Zl4Jvg.jpeg" /><figcaption>Figure 3: data examples from Boston House Prices dataset</figcaption></figure><p>There are 13 features in total (see detailed description in the <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/notebooks/train.ipynb">notebook</a>) and one target called “MEDV” which stands for “Median value of owner-occupied homes in $1000&#39;s”.</p><figure><img alt="Boston House Prices solution pipeline" src="https://cdn-images-1.medium.com/max/1024/1*9GKMOxd8bGgKH2uD6FLA_g.png" /><figcaption>Figure 5: Model development pipeline for Boston House Prices Dataset and LightGBM model</figcaption></figure><p>I would use three different models (+ baseline) to emulate step-by-step “work” on the task:</p><ul><li>Mean model (baseline)</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24380&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24380&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac39023378abb86d3c595507b1cd6387/href">https://medium.com/media/ac39023378abb86d3c595507b1cd6387/href</a></iframe><ul><li>Random predictions</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24379&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24379&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b29e4ac4b30e2f9ad30ae9f4296542b/href">https://medium.com/media/0b29e4ac4b30e2f9ad30ae9f4296542b/href</a></iframe><ul><li>Linear Regression</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24381&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24381&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0838d9c0be585f644b3040caf7fab23c/href">https://medium.com/media/0838d9c0be585f644b3040caf7fab23c/href</a></iframe><ul><li>Gradient Boosting over Decision Trees (<a href="https://github.com/microsoft/LightGBM">LightGBM</a>)</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24382&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24382&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fabca4e74e9de233a4bcecd29b82096f/href">https://medium.com/media/fabca4e74e9de233a4bcecd29b82096f/href</a></iframe><p>In real-world problems, it is equivalent to continuously improving model whose changes are pushed to the repository.</p><p>One should also define metrics that estimate how good the model is. In this case, I am to use:</p><ul><li>Root Mean Squared Error (<a href="https://en.wikipedia.org/wiki/Root-mean-square_deviation">RMSE</a>)</li><li>Mean Absolute Error (<a href="https://en.wikipedia.org/wiki/Mean_absolute_error">MAE</a>)</li><li>Mean Absolute Percentage Error (<a href="https://en.wikipedia.org/wiki/Mean_absolute_percentage_error">MAPE</a>)</li></ul><p>All the data preprocessing and model training/evaluation code is available in the corresponding <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/notebooks/train.ipynb">notebook</a> in the GitHub repo. This is not the point of the article to:</p><ol><li>Build the best model</li><li>Explain how to do feature engineering and to develop models</li></ol><p>Thus I’m not describing it here in detail. The notebook is heavily commented and self-contained though.</p><h3>Solution Packaging</h3><p>The solution is shipped as a <a href="https://www.docker.com/">Dockerized</a> RESTful web-service. The model is wrapped into a server application using <a href="https://palletsprojects.com/p/flask/">Flask</a> (see <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/src/server.py">this</a> file in the repo for details).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24385&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24385&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bceebb499a08dadffdcba36cd72fc69/href">https://medium.com/media/3bceebb499a08dadffdcba36cd72fc69/href</a></iframe><p>Few things to note here:</p><ul><li>The sequence of features is important. Otherwise, the model will fail to do the prediction correctly.</li><li>There is ready endpoint which simply returns “OK”. One can send a request to it to understand whether all the models are already loaded to the RAM. If the endpoint does not answer then it means that the models are still loading or have already failed to load.</li><li>predict endpoint does an actual job of predicting the price. The input is a JSON with all the necessary features presented.</li><li>Input might contain a list of data instances, i.e., more than one.</li></ul><p>One can start the solution server using local Python by going into ml-quality-cicd/src and running python server.py. Although it is an acceptable method, there is a much better platform-agnostic way to do it using Docker. I created a special <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/Makefile">Makefile</a> which runs all the necessary command. To run the solution server just type (<a href="https://www.docker.com/">Docker</a> should be installed)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24395&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24395&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8921a4b75cd6e67ece4b7cf7417fbb0d/href">https://medium.com/media/8921a4b75cd6e67ece4b7cf7417fbb0d/href</a></iframe><p>It launches a Docker container with a solution web-server available at port 8000 of the host machine. For comprehensive technical instructions please go to the <a href="https://github.com/vladimir-chernykh/ml-quality-cicd">repo</a>.</p><p>One can query launched web-service in any suitable way, e.g., using Python, JS, Go, etc. CURL command-line utility and Python examples are below:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24394&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24394&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbbfdc02dedc5f1efcf0f147953faded/href">https://medium.com/media/fbbfdc02dedc5f1efcf0f147953faded/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24482&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24482&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/51439e617a4a431d8db107b6489f9a47/href">https://medium.com/media/51439e617a4a431d8db107b6489f9a47/href</a></iframe><p>In both cases the output should be the same:</p><pre>{&quot;predictions&quot;:[21.841831683168305]}</pre><p>The solution’s format choice is dictated by the AIJ competition. Recently there is a strong trend in ML competitions to switch to container-based solutions (<a href="https://www.kaggle.com/c/deepfake-detection-challenge">Kaggle DeepFake Detection</a>, <a href="https://contest.ai-journey.ru/en/competition">Sberbank AIJ Competition</a>, etc.)</p><p>One can choose any other format of solution delivery which is convenient for particular purposes. E.g., launch a script from the command line with the path to the data and location to store results.</p><h3>Evaluation</h3><p>To do evaluation, I would use the hold-out technique and split the whole dataset into train and validation subsets. <a href="https://en.wikipedia.org/wiki/Cross-validation_(statistics)">Cross-validation</a> (CV) can also be used in this particular case for the Boston House Prices task because the models used here are simple and fast. In real applications, one might have a model that is trained for days. Thus it would be hardly possible to use CV.</p><p>Split is done in the training <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/notebooks/train.ipynb">notebook</a>. This step is also shown in Figure 5.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24473&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24473&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f18d1be4b6da0245c2d615415437805e/href">https://medium.com/media/f18d1be4b6da0245c2d615415437805e/href</a></iframe><p>Note how the random state and other parameters are fixed for reproducibility. After that, the train and validation datasets are saved to CSV files to make later usage without launching the code again possible. These files are available in the data <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/tree/master/data">folder</a> in the repo.</p><p>Next, there are a few available options for evaluation:</p><ul><li>Notebook</li><li>Manual via web-service</li><li>Automatic via web-service</li></ul><p>Let’s break down how to do each of them.</p><h3>Evaluation: Notebook</h3><p>In this method, one is to measure the quality of the model in-place: in the same environment where it is being developed. This method helps to build a better model by comparing many of them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24477&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24477&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/71e14f4e79a1c46e5d086bec39f5940f/href">https://medium.com/media/71e14f4e79a1c46e5d086bec39f5940f/href</a></iframe><p>Below there is a table of comparison for all 3 models + baseline (full code in training <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/notebooks/train.ipynb">notebook</a>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGdcmsX89BuIuWOifBBosQ.jpeg" /><figcaption>Figure 6: Models comparison on the validation set done in Jupyter Notebook</figcaption></figure><p>In-place evaluation of algorithms is great for instant development purposes but it does not allow to trace the history of changes easily (discussed in “<em>Introduction”</em>).</p><h3>Evaluation: Manual via web-service</h3><p>This is an intermediate step on the way to fully automated continuous quality testing.</p><p>Here I’m going to use the serving interface described in the “<em>Solution Packaging</em>” section above. On the one end, there is a web service that accepts a list of data instances in the JSON body of the POST request. On the other end, there are CSV files (train and validation) that contain data instances in rows. One needs to:</p><ul><li>Get predictions from the web-service for all the data in CSV files</li><li>Compute metrics for predictions and ground truth values</li></ul><p>To run the code in this section please make sure that the server with the solution is running or run it with</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24395&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24395&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8921a4b75cd6e67ece4b7cf7417fbb0d/href">https://medium.com/media/8921a4b75cd6e67ece4b7cf7417fbb0d/href</a></iframe><p>Note that because the port is fixed to 8000 there can only be one server running at a time. To kill all the servers one can use make destroy_all command or stop them manually using docker stop ....</p><h4>Client</h4><p>The client solves the first of these two tasks. The main goals of it are to:</p><ul><li>Cast one format (CSV) to another (list of dictionaries)</li><li>Send a request to a server</li><li>Receive and process an answer</li></ul><p>The full code of the client is available in client.py <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/client/client.py">file</a> in the repo. Here I address only the main points.</p><p>Below there is a core logic which is able to send the file to the endpoint in the appropriate format. All other 120 lines in client.py are in fact interface to make these lines work properly.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24483&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24483&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a60cbfd1bfd59b62350fd78b79894708/href">https://medium.com/media/a60cbfd1bfd59b62350fd78b79894708/href</a></iframe><p>When the answers are returned one needs to handle and save them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24484&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24484&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f6848172adb971e72679f9bea56d8d7/href">https://medium.com/media/2f6848172adb971e72679f9bea56d8d7/href</a></iframe><p>Note that one row corresponds to one input file. In this task, one file can contain more than one data instance. It’s easier to work with CSV when one row contains one instance and not a list of many. Thus the next step is to transform the answers into a more convenient format.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24485&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24485&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/535e159b52b5f12e02c1d176632e9790/href">https://medium.com/media/535e159b52b5f12e02c1d176632e9790/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eCN-LMp_S4fDfSBqHZ60lg.jpeg" /><figcaption>Figure 7: Parsed and transformed answers dataframe. Here the client was launched on two files simultaneously: train and validation sets. The transformed dataframe contains predictions for both files. All the predictions are the same because the MeanRegressor model is deployed.</figcaption></figure><p>Note that this stage fully depends on the data. This transformation should be rewritten correspondingly for each new task and data structure.</p><h4>Metrics computation</h4><p>After the answers have been received and are stored in the appropriate format one needs to join ground truth values to the answers properly. It would allow us to compute all the metrics both instance-wise and globally. This functionality is covered by metrics.py <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/client/metrics.py">file</a> in the repo.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24486&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24486&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b874df1330bf8bc9d737dc570be7f26/href">https://medium.com/media/6b874df1330bf8bc9d737dc570be7f26/href</a></iframe><p>Note that the assignment is done without any join because the parsed_answers dataframe is sorted by “path”, “row_number” fields.</p><p>Once the ground truth values are available one can compute all the instance-wisse metrics which are MSE, MAE, and MAPE in this case.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24501&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24501&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e02c6774732e020a8c6eb4392f20f40d/href">https://medium.com/media/e02c6774732e020a8c6eb4392f20f40d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9nIxlHxKbuPr-SPt4k0nNQ.jpeg" /><figcaption>Figure 8: Transformed answers enriched by the ground truth labels and instance-wise computed metrics</figcaption></figure><p>This enriched table allows analyzing error distribution and instances which have the highest/lowest error.</p><p>Finally, let’s compute global metrics by averaging instance-wise metrics across files.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24502&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24502&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/49a9f721a7f8a58b9d07ed79e6a034c1/href">https://medium.com/media/49a9f721a7f8a58b9d07ed79e6a034c1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HlBeaQvYwdprxtgVv-EMvg.jpeg" /><figcaption>Figure 9: Global metrics averaged across files</figcaption></figure><p>Note that the model tested here is MeanRegressor. One can compare validation quality to the corresponding line from Figure 6 and assures that they are the same.</p><h3>Evaluation: Automatic via web-service</h3><p>Everything discussed in the previous section is implemented in the client <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/tree/master/client">folder</a> in the repo. The goal now is to automate this process and wrap it into the CI/CD pipeline.</p><p>Automation is done by means of <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/Makefile">Makefile</a>. I previously used it here to launch the web-service and now let’s take a closer look at its main details. There are a few targets in this Makefile which I’d like to discuss:</p><ul><li>Runtime variables. Note how the host port is chosen randomly (in accordance with UNIX timestamp at the moment of launch). This is done to allow multiple servers to run at the same time.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24512&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24512&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/222fa373fd7d28e657901628a00d0fdb/href">https://medium.com/media/222fa373fd7d28e657901628a00d0fdb/href</a></iframe><ul><li>build and push are the targets that prepare (build and push) Docker image. The image is quite standard and can be found in the dockers <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/tree/master/dockers">folder</a>.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24528&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24528&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/695ed2e85688e1eddda023f00fa4fa39/href">https://medium.com/media/695ed2e85688e1eddda023f00fa4fa39/href</a></iframe><ul><li>create starts the Docker container with a solution server. The resources limits are set and equal to 200Mb of RAM and 1 CPU. Note how the CPU limit is handled w.r.t. total CPU cores. This is done because Docker fails to launch the container in case if one asks for more CPUs than are available at the host machine.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24529&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24529&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8eaa29303bd625d08619cc9b4585fe06/href">https://medium.com/media/8eaa29303bd625d08619cc9b4585fe06/href</a></iframe><ul><li>evaluator launches the client and the metric computer discussed in the “<em>Evaluation: Manual via web-service</em>” section. The code can be found in the client <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/tree/master/client">folder</a>. Note that the launch happens in the separate Docker container (started from the same Docker image though) and the network is shared with the host machine. It allows accessing the solution server from inside the launched evaluation Docker.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24530&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24530&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f490621b71132a4da04fb989cb57156/href">https://medium.com/media/6f490621b71132a4da04fb989cb57156/href</a></iframe><ul><li>destroy stops and removes the solution server. Note how the logs are dumped and printed to the output in case of errors.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24535&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24535&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/72c956cce9bdb901d592b7c08c1a7a25/href">https://medium.com/media/72c956cce9bdb901d592b7c08c1a7a25/href</a></iframe><p>One can combine all the steps described above to launch the evaluation using one command:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24539&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24539&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/10a1342a154470048158e633058f5ef2/href">https://medium.com/media/10a1342a154470048158e633058f5ef2/href</a></iframe><p>which triggers create, evaluator and destroy sequentially. The output should be evaluation artifacts available under client/reports/&lt;timestamp&gt;_&lt;data folder name&gt; folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOcLoi9ViDxMt8gA5pNyGw.png" /><figcaption>Figure 10: Evaluation artifacts</figcaption></figure><p>All three files were discussed previously in the “<em>Evaluation: Manual via web-service</em>” section and should be clear by now.</p><p>The last step to complete the fully automated system is to tie the described evaluation process with CI/CD system.</p><h3>CI/CD: GitHub Actions</h3><p><a href="https://github.com/features/actions">GitHub Actions</a> platform is used as a CI/CD engine. For more details about GitHub Actions and CI/CD in general, please go to the section “<em>CI/CD</em>” of this post. There are also official docs available <a href="https://help.github.com/en/actions">here</a>. In what follows I would use three approaches. The difference between them is where and how to perform the CI/CD pipeline steps:</p><ul><li>GitHub machine</li><li>Remote machine using SSH</li><li>Remote machine using self-hosted runners</li></ul><h4>GitHub machine</h4><p>This is the easiest option to use. GitHub provides users with Virtual Machine (VM) which spins up automatically every time the specific event triggers the pipeline. GitHub manages the whole lifecycle of the VM and the user should not bother about it.</p><p>All the pipeline definitions should follow a few rules:</p><ul><li>YAML format</li><li>Stored in /.github/workflows folder inside the repo</li><li>Follow the syntax <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions">rules</a></li></ul><p>Let’s build a workflow that performs the evaluation process and prints the results. The specification is located in the evaluate_github.yml <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/.github/workflows/evaluate_github.yml">file</a> in the repo.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24598&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24598&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/42dee1112ec1ccc4ce862e347c9567b5/href">https://medium.com/media/42dee1112ec1ccc4ce862e347c9567b5/href</a></iframe><p>The pipeline is triggered on each push that happens to the Master branch and has changes to specified files. VM runs ubuntu-18.04 and has the <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners#ubuntu-1804-lts">following</a> list of packages installed. There are also other systems available (see the full list <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources">here</a>).</p><p>The first step is to execute publicly available action called checkout (more details <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsuses">here</a>). It checks out the code from the parent repo to the VM. The next step is to perform the evaluation. This is done using make evaluate as discussed previously. Finally, the metrics are printed to stdout.</p><p>As soon as the YAML config is pushed to the repo the pipeline would be triggered on each suitable event. Results of the pipeline run can be found under the “Actions” tab in the upper tab menu of the repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoSfprdJb9uMyTci3FsNQQ.png" /><figcaption>Figure 11: workflow run interface and results for GitHub provided VM</figcaption></figure><p>The successful pipeline run is shown in Figure 11. As one can notice, the metrics are the same as in Figures 6 and 9.</p><p>GitHub-managed VMs are a great method for workflows that do not require lots of resources. All VMs have only 2 CPUs, 7GB of RAM and 14 GB of disk space (<a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources">link</a>). It’s ok when one runs a toy task like Boston House Prices prediction. But for AIJ contest we quickly ran out of resources which made it impossible to use for the evaluation. And for many ML applications, these resources are not sufficient. This leads me to the solution described in the next subsection.</p><h4>Remote machine using SSH</h4><p>Assume now, that there is a workstation that one wants to use to execute the workflow. How do accomplish that?</p><p>One can use VM spun up by GitHub for any purpose, not only for launching the pipeline directly. In addition to that, GitHub allows users to <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets">store secrets</a> and use them during workflow execution. The secret might be any piece of information which is stored securely at GitHub and can be passed to the VM.</p><p>A combination of these two ideas makes it possible to connect to the remote workstation using SSH and execute all the necessary steps there.</p><p>To do that let’s first add three secrets to the GitHub:</p><ul><li>EVAL_SSH_HOST which is an IP-address of the remote machine</li><li>EVAL_SSH_USER is a user name at the remote machine</li><li>EVAL_SSH_KEY is a private SSH key which corresponds to the provided user and remote machine</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTKWrKWi0LDqUmj1syPefQ.png" /><figcaption>Figure 12: secrets management UI provided by GitHub</figcaption></figure><p>After initializing all the necessary secrets one can use them in the GitHub Actions pipeline definition. The code for the described workflow is available in the evaluate_remote_ssh.yml <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/.github/workflows/evaluate_remote_ssh.yml">file</a> in the repo.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24641&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24641&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06fd69983579a9425579da467640690/href">https://medium.com/media/b06fd69983579a9425579da467640690/href</a></iframe><p>The trigger conditions and initial checkout step are the same as in the previous example. The next step is to init the SSH private key. Note how the secret is passed to the environmental variable using special context placeholder {{ secrets.&lt;SECRET_NAME&gt; }}. Once the ssh credentials are initialized, one can make an archive with code at the GitHub VM and load it to the specified path on the remote machine using scp command. Note that the archive is named after the commit hash GITHUB_SHA which is available by default as an environmental variable (see <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables">here</a> for the full list of default env vars). After that, the evaluation is carried out by running make evaluate and the results are copied back from the remote machine to the GitHub VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8qL2izvQ-n2B183H3B5FtQ.jpeg" /><figcaption>Figure 13: workflow run results using an SSH connection to the remote machine</figcaption></figure><h4>Remote machine using self-hosted runners</h4><p>Remote connection via SSH solves the problem of insufficient GitHub VM resources. But it also introduces too many extra commands needed to accomplish the goal in comparison with GitHub VM execution (31 lines vs 5 lines). To resolve this issue and take the best of both worlds one might use recently <a href="https://github.blog/2019-11-05-self-hosted-runners-for-github-actions-is-now-in-beta/">released</a> the beta version of <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners">self-hosted runners</a>.</p><p>The core idea behind it is to expose the remote machine to the GitHub Actions for pipeline execution using special software (more info on installation <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/adding-self-hosted-runners">here</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kga4G1YpXfTKFGAXy48c4A.jpeg" /><figcaption>Figure 14: adding self-hosted runners</figcaption></figure><p>After establishing the connection one can <a href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-self-hosted-runners-in-a-workflow">use the new runner</a> natively in the pipelines via runs-on instruction of the YAML configuration file.</p><p>Below the pipeline for the self-hosted runner is defined.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F24642&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F24642&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd63c439d8f80074d9dba1ebe3bfc235/href">https://medium.com/media/fd63c439d8f80074d9dba1ebe3bfc235/href</a></iframe><p>Note how runs-in: self-hosted instruction tells GitHub Actions to run on custom remote machine added previously (Figure 14).</p><p>The YAML configuration is almost the same as the one for GitHub-managed VM except for the few steps.</p><ul><li>Cleaning the environment before and after the pipeline execution. It has to be done because nobody handles the env for us anymore (previously it was done by GitHub) and it might contain artifacts from previous builds. make clean command does the work.</li><li>Uploading artifacts to storage. Here I use a custom (possibly separate) machine defined by DASH_SSH secrets in GitHub. I store results in a separate folder where each file is named after the commit hash it corresponds to. One can use any other storage (AWS S3, GCP Storage, etc.) and format of files.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YOjJhGUgESQApT6T9EYuEQ.jpeg" /><figcaption>Figure 15: CI/CD pipeline execution results via self-hosted runner</figcaption></figure><h3>Results</h3><p>All the evaluations done in this post are shown to be consistent and give the same metrics for the same MeanRegressor baseline model.</p><p>Now let’s change the model sequentially to RandomRegressor, LinearRegression, and LGBMRegressor to see how the metrics are changing. I have implemented the special dashboard for this purpose using the <a href="https://plot.ly/dash/">Dash</a> Python library. One can get code details <a href="https://github.com/vladimir-chernykh/ml-quality-cicd/blob/master/dashboard/dashboard.py">here</a> in the repo. The dashboard is launched manually at the special remote machine specified by the DASH_SHH secrets in GitHub.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsnipit.io%2Fembed%2F25160&amp;dntp=1&amp;url=https%3A%2F%2Fsnipit.io%2Flists%2F8016%2F25160&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=snipit" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a02935c196b77c8f6568652f51551fd2/href">https://medium.com/media/a02935c196b77c8f6568652f51551fd2/href</a></iframe><p>The folder which is tracked by the dashboard corresponds to the folder where CI/CD self-hosted pipeline stores its results. The dashboard itself is available at the port 7050.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_12J-edLRXj1l9fQrSCjXg.jpeg" /><figcaption>Figure 16: commits with different models. They simulate the real progressive work on the model.</figcaption></figure><p>Each commit shown in Figure 16 triggers all 3 described CI/CD pipelines. All of the executions went well which is indicated by the green mark near the commit. The self-hosted runner also pushes results to the dashboard which is shown in Figures 17 and 18.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X5n9qZd9wfOKj0m6v3yjIw.jpeg" /><figcaption>Figure 17: dashboard with a table of results with MAE metric. The green row shows that the quality of the last model is better than the baseline (otherwise the row is painted in red).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiB_XTkiuV5ZTBY6K9KIgw.jpeg" /><figcaption>Figure 18: graph for one of the rows of the results table. Note how the model name repeats the commit hash from figure 16.</figcaption></figure><p>The dashboard allows users to conveniently track the progress in history and compare metrics across different subsets/subtasks.</p><p>In real-world AIJ contest this dashboard looked the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WIUse7bT4AXpeOlH8hjWcA.jpeg" /><figcaption>Figure 19: evaluation table for AIJ contest. Each row corresponds to one subtask of the exam.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMq4cWJFUOtnfrLXUbX_uw.jpeg" /><figcaption>Figure 20: model progress for one of the tasks.</figcaption></figure><h3>Conclusion</h3><p>In this post, I described my perspective on building continuous quality evaluation systems and provided all the necessary code and steps to reproduce it on one’s own.</p><p>The system built in this post is already good enough for small/medium size projects or ML contests. It also might be improved in many ways, e.g.:</p><ul><li>More reliable storage for logs and metrics</li><li>Better visualization system</li><li>Logs analytics</li><li>etc.</li></ul><p>The described continuous quality evaluation workflow can easily be ported to any other CI/CD engine by rewriting config files into the appropriate tool-specific format.</p><p>GitHub Actions has its pros and cons. The big advantage is the tight integration with GitHub and the availability of on-demand GitHub-managed VMs. This is convenient in case one uses GitHub and totally unacceptable if not. The main drawback is the restricted amount of builds (2000 minutes) for private repositories. For big projects, it leads to the need for a paid premium account or usage of another CI/CD instrument. If one has faced the minutes overflow issue, I would probably choose the latter option as the way to go.</p><p>In my opinion, GitHub Actions is a good option for small/medium scale projects which need an easy-to-setup CI/CD engine and do not want to care much about the infrastructure for it. For bigger projects and more fine-grained control, one might choose other CI/CD platforms.</p><p>P.S. I would like to thank my teammates (<a href="https://github.com/elejke">German Novikov</a>, <a href="https://github.com/oalenkin">Oleg Alenkin</a>, <a href="https://github.com/Anisalexvl">Alexander Anisimov</a>) in the AIJ contest for their contribution to the solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78f2f078e38f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/continuous-quality-evaluation-for-ml-projects-using-github-actions-78f2f078e38f">Continuous quality evaluation for ML projects using GitHub Actions.</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>