<?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 Markus Schmitt on Medium]]></title>
        <description><![CDATA[Stories by Markus Schmitt on Medium]]></description>
        <link>https://medium.com/@DataRevenue?source=rss-902b7c650a38------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tjYHedO1zbtgQ5ZT4Yh-2A.jpeg</url>
            <title>Stories by Markus Schmitt on Medium</title>
            <link>https://medium.com/@DataRevenue?source=rss-902b7c650a38------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 19:28:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DataRevenue/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[MetaClean Automates Peak Quality Assessments]]></title>
            <link>https://medium.com/data-science/metaclean-automates-peak-quality-assessments-3786f4c026b4?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/3786f4c026b4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[lcms]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[metabolomics]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Fri, 15 Oct 2021 03:13:13 GMT</pubDate>
            <atom:updated>2021-10-15T03:13:13.094Z</atom:updated>
            <content:encoded><![CDATA[<h4>Leverage machine learning to detect poor quality integrations and save hours assessing peaks manually</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BevjeBzobgvpZtz5GYsN9w.png" /><figcaption>Source: Author</figcaption></figure><p>Even the best metabolomics pipelines have a degree of variance, which can cause poor peak integration between samples. This reduces your ability to accurately quantify a metabolite, and usually means that you have to manually check the quality of every peak (of interest).</p><p>Kelsey Chetnik, Lauren Petrick, and Gaurav Pandey have developed a new framework and R package called MetaClean. This combines eleven peak quality metrics and eight machine learning algorithms to automatically detect poorly integrated peaks.</p><p>We interviewed Petrick and Pandey about <a href="https://link.springer.com/article/10.1007/s11306-020-01738-3">the recent paper in Metabolomics</a> and learned how MetaClean works and how you can apply it to your data.</p><h3>Current automatic peak integration is unreliable</h3><p>Liquid chromatography coupled mass spectrometry (LC-MS) is a standard tool for identifying and quantifying compounds in metabolomics workflows. In LC-MS, retention time and peak shapes of identical compounds (metabolites) will vary slightly from one measurement to another. Slight fluctuations are normal, but automated integration can still mischaracterize peaks and complicate sample to sample comparison.</p><p>In many cases,<strong> up to 30%</strong> of peaks integrated by standard post-processing tools may fail manual inspection. Low-quality peaks can be products of coeluting analytes, faulty alignment, or background noise. As a result, you can’t expect any two samples to have the exact same peaks, even when their makeup and concentrations match. But in order to compare concentrations, you still need to accurately integrate peaks from different samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qw8bmAWmbOGrwaWu.png" /><figcaption>Three examples of possible integration problems common to LC-MS. Source: Author</figcaption></figure><p>One way to evaluate peak integration is to review manually and judge the peak shape and included areas. This isn’t just extremely time-consuming; it’s practically impossible when you’re analyzing thousands of peaks per batch. As a result, manual QC is often done on a small subset of data and often only on peaks of interest. While this may remove false positives from your analysis, it can’t address false negatives and poorly integrated peaks can slip through.</p><h3>Machine learning can automate peak evaluation</h3><p>Individual quality metrics can quantify individual peak quality. However, by themselves, these metrics are often insufficient to fully differentiate between low and high quality integrations.</p><p>Machine learning models can find complex and valuable combinations of metrics that can aid this differentiation. All you need are the metrics (your features) and labels that describe whether a peak integration is high or low quality (your target variable).</p><p>With these features and the target variables, you can train models and evaluate how well they predict the peak integration of unseen examples. If you find the models are highly accurate, you can easily apply those models to every single peak in a dataset (containing thousands of peaks). You can then filter out the low-quality peaks before you analyze your data.</p><h3>The MetaClean features: Eleven peak quality metrics</h3><p>Chetnik, Petrick and Pandey explored whether a combination of quality metrics could work better as an effective feature set for a peak quality classifier. The team created MetaClean to generate these classifiers and evaluate their performance against several datasets.</p><p>The team used a set of four metrics from <a href="http://doi.org/10.1186/1471-2105-15-S11-S5">Zhang et al.</a> (M4 Metrics) and seven metrics from <a href="https://doi.org/10.1186/s1201%204-018-9209-x">Eshghi et al.</a> (M7 Metrics), as well as the combined M11 set consisting of all the metrics. These metrics were used to quantify overall peak shape and retention-time consistency between samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*qWjn9mNTejBXEVDR.png" /><figcaption>Source: Author</figcaption></figure><h3>The MetaClean training data: 500 manually reviewed peaks</h3><p>The team classified 500 pre-processed peaks by hand from 89 blood plasma samples: <strong>almost 40% failed manual visual inspection</strong>. They ensured a variety of different peak shapes were in the training data so the model would be trained on a representative set of peaks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/0*HNxtiRPb4_AksEaf.png" /><figcaption>Source: Author</figcaption></figure><h3>The MetaClean model: The best of eight ML classification algorithms</h3><p>The next step was to find the machine learning algorithm that best classifies peak quality. MetaClean evaluates eight of the most commonly used algorithms, each paired with the M4, M7, and M11 metrics to develop 24 different peak quality classifiers. The performance of each classifier is assessed with five-fold cross-validation, repeated ten times, and results are averaged. For this, MetaClean evaluates:</p><ul><li>Decision Tree;</li><li>Logistic Regression;</li><li>Naive Bayes;</li><li>Neural Network;</li><li>SVM with linear kernel;</li><li>AdaBoost;</li><li>Model Averaged Neural Network;</li><li>Random Forest.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xq8trEkBTGmrL1sF.png" /><figcaption>MetaClean evaluates 24 different potential peak classifiers built from a combination of three peak quality metric sets and eight machine learning algorithms using five-fold cross-validation. Source: Author</figcaption></figure><p>After comparing the performance of each model, the team observed the AdaBoost algorithm using the M11 metric set performed the best. They called this model the “Global Peak Quality Classifier,” and it achieved <strong>almost 85% accuracy</strong> in classification on the development dataset.</p><p>However, just testing the model on the same batch of samples doesn’t provide an accurate picture of how well the model will perform in a real situation. An effective model also needs to perform well cross-batch and cross-platform:</p><ul><li><strong>Cross-batch</strong>: Other samples, from a different batch, measured on the same machine with the same settings.</li><li><strong>Cross-platform</strong>: On samples measured on different machines, with different settings.</li></ul><p>So the team evaluated 500 peaks from four more datasets to test. They evaluated the Global Peak Quality Classifier on:</p><ul><li>a different dataset from the same instrument to test same-platform performance;</li><li>three datasets from different platforms to test cross-platform performance.</li></ul><h3>MetaClean performs well in analyses of data from the same platform</h3><p>The Global Peak Quality Classifier evaluated a different dataset from the same instrument (Test 1). The classifier categorized peaks accurately in almost 81% of cases, even though this dataset was from a different sample type.</p><h3>MetaClean performs reasonably well in cross-platform analyses</h3><p>The team applied the Global Peak Quality Classifier to four publicly accessible datasets, each using different MS instruments, LC columns, and/or ionization modes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*U5PsAtrtYih5fBNS.png" /><figcaption>Source: Author</figcaption></figure><p>Even with these platform and sample matrix variabilities, the classifier correctly categorized between 65–80% of peaks accurately. However, the reduced performance for these datasets showed that cross-platform analyses are still quite challenging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YNqAM60XV8LWqeQX.png" /><figcaption>The Global Peak Quality Classifier achieved over 65% accuracy against all test sets, including those from different platforms and/or sample matrices. Source: Author</figcaption></figure><h3>Train MetaClean on a per-platform basis</h3><p>The team used two of these datasets (Test 3 and Test 4) from a lab that is different from the one that generated the development set as an independent case to re-train and evaluate models on their data. They trained two new models with the positive and negative mode data from the same platform, evaluating each against the other. They showed that using each model against the other dataset produces great cross-mode results. Each model can be optimized in a platform-specific fashion, and can even be applied to different ionization modes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kzce3No1T5oOJLyM.png" /><figcaption>The model trained on the positive mode data performed very well against the negative mode data, and vice versa, when trained on a per-platform basis. Source: Author</figcaption></figure><h3>Comparing MetaClean with RSD filtration</h3><p>Random analytical errors can be difficult to address, especially in complex samples. Often, they are the product of background noise or sample carryover from a previous run and are not relevant to the question at hand. These peaks are often highly variable, and their integrations are not consistent.</p><p>One way to find these errors is through Relative Standard Deviation (RSD) filtration, in which pooled samples are analyzed multiple times. Random peaks are discarded and common peaks are evaluated for consistency. When the standard deviation of peak area is outside of a cutoff, they are removed.</p><p>Since MetaClean operates independently from RSD filtration, the team thought that first subjecting the data to RSD filtration could serve dual purposes:</p><ul><li>Comparing the performance of MetaClean against an established method;</li><li>Increasing the performance of MetaClean through combination with RSD filtration.</li></ul><p>The team found that MetaClean outperformed RSD filtration in all test cases, accurately classifying the quality of the peak better than this widely used method.</p><p>While RSD does a great job of ensuring that random analytical error is minimized, MetaClean focuses on removing integration issues that may pass RSD filtration. Since RSD and MetaClean are complementary approaches to data quality filtering, they work very effectively in combination.</p><h3>Use Metaclean with your data</h3><p>Training a MetaClean model on your data could be valuable for your workflow. With little up-front time investment, you can analyze all peaks from all the runs in your lab rapidly and greatly reduce the rate of false integrations without dedicating hours to manual peak reviews.</p><p>Kelsey, Lauren, and Gaurav provide an open R package that evaluates your data against the eight ML and three quality metric sets to develop a model. You can <a href="https://cran.r-project.org/package=MetaClean">download the package today</a> and train your model to evaluate your LC-MS integrations.</p><p>Be sure to read the <a href="https://link.springer.com/article/10.1007%2Fs11306-020-01738-3">MetaClean article published in Metabolomics </a>to learn more about the platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3786f4c026b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/metaclean-automates-peak-quality-assessments-3786f4c026b4">MetaClean Automates Peak Quality Assessments</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[Going Beyond Spectral Similarity With MS2DeepScore]]></title>
            <link>https://medium.com/data-science/going-beyond-spectral-similarity-with-ms2deepscore-ef0f923428e6?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef0f923428e6</guid>
            <category><![CDATA[structural-similarity]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[metabolomics]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Mon, 06 Sep 2021 17:19:30 GMT</pubDate>
            <atom:updated>2021-09-06T17:19:30.325Z</atom:updated>
            <content:encoded><![CDATA[<h4>Predict structure similarity from MS/MS spectra directly with a deep learning model.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Hdejr5ZkzL16-J2NqVNBQ.jpeg" /><figcaption>Source: Author</figcaption></figure><p>Spectral similarity scores are commonly used as a proxy for structural similarity. But in many cases the two differ significantly. This can call the results of your library comparisons into question. Florian and his team have built a deep learning model that successfully predicts structural similarity directly from tandem mass spectra.</p><h3>Spectral comparisons are part of every metabolomics workflow</h3><p>Comparing your mass-spectral measurements against library measurements is a crucial step in any metabolomics analysis pipeline. You need reliable spectral comparisons to,</p><ul><li><strong>Identify your compound</strong>: search a reference library for a compound matching your fragmentation pattern.</li><li><strong>Search for analogs</strong>: find structurally related compounds through similar fragmentation patterns.</li><li><strong>Aid in structure elucidation</strong>: link your molecule to a molecular class, to narrow potential assignments.</li></ul><p>With tandem mass spectrometry, you typically compare mass spectra by calculating the cosine score between them. A high cosine score tells you that the fragmentation profiles of two compounds overlap well.</p><p>You might assume a high cosine score correlates to high structural similarity. Unfortunately, cosine scores only tell you about the <strong>similarity of spectra</strong>. But when you want to annotate your compounds, you’re interested in <strong>structural similarity. </strong>And that’s a crucial difference.</p><h3>Spectral and structural similarity: Apples and oranges</h3><p>Let’s look at the differences:</p><ol><li><strong>Spectral similarity</strong>, for example cosine similarity, measures the overlap between two mass spectral profiles.</li><li><strong>Structural similarity, </strong>like the Tanimoto score, quantifies the overlap of two <strong>molecular fingerprints</strong> using a 2D-vector representation of the molecular structures.</li></ol><p>Spectral similarity can differ significantly from structural similarity. This can lead you to the wrong conclusions from your library searches. Let’s see how that can affect your work.</p><p>Take for example, the antibiotic daptomycin (top) and a hypothetical analog (bottom):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NfMsNSwi-XsimCOc.png" /><figcaption>Source: Author</figcaption></figure><p>Daptomycin (top) and it’s analog (bottom) have shifted fragmentation patterns, despite being very similar to each other overall. A cosine score comparison would give a low score and fail to detect that they are highly similar structures.</p><ul><li><strong>High structural similarity:</strong> The structure of the analog (bottom) is still highly similar to it’s un-modified form: daptomycin (top).</li><li><strong>Low spectral similarity:</strong> The modifications in the analog carry over to many of the fragments and shift many of the mass-spec peaks. As a result, few overlapping peaks remain, so the spectral similarity score is low.</li></ul><p>This means that if your sample included a daptomycin analog, you would <strong>NOT </strong>get a hit from either a library or an analog search, even if you had a daptomycin reference spectra in the library!</p><p>This means if you rely solely on cosine similarity,</p><ul><li>You can’t be sure that matches with the highest cosine score are really the best structural matches.</li><li>Your library might contain a close structural match, but you won’t see it because the match received a very low spectral similarity score.</li></ul><p>However, Florian Huber and his team have found a way to predict structural similarity directly from tandem mass spectra.</p><h3>How MS2DeepScore predicts structural similarity from tandem mass spectra</h3><p>MS2DeepScore can predict when compounds are closely related structural analogs, even when other comparison methods, like cosine similarity, may fail.</p><p>Florian Huber and his team trained MS2DeepScore using over 100,000 spectra from over 15,000 unique compounds. Once trained, the MS2DeepScore model predicts the Tanimoto similarity scores between two compounds directly from their respective MS/MS profiles.</p><p>Using what it learned, MS2DeepScore consistently outperforms both cosine similarity and Spec2Vec in relating structurally similar compounds, even when the compound’s fragmentation profiles are shifted. Importantly, the compounds on which the scores’ accuracy were compared were not included in the MS2DeepScore training dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y2XHuBjE4jBKBz8i.png" /><figcaption>MS2DeepScore outperforms cosine scores and Spec2Vec in precision vs recall. Source: Author</figcaption></figure><p>In our example, the cosine score between daptomycin and our analog was only 0.24. From this, we would assume that these compounds are not structurally close. But the MS2DeepScore model predicts a Tanimoto score of 0.95, very close to the actual Tanimoto score of 0.98.</p><h3>Working with MS2DeepScore</h3><p>Getting started with MS2DeepScore is simple, and you can begin comparing spectra with it in minutes.</p><p>You can use MS2DeepScore no matter what instrument you collect with. MS2DeepScore works with the <a href="https://blog.esciencecenter.nl/build-your-own-mass-spectrometry-analysis-pipeline-in-python-using-matchms-part-i-d96c718c68ee">matchms module</a>, so you can use a choice of several open source data types like .mgf, .mzxml and .mzml.</p><p>Florian and his team designed MS2DeepScore as a <a href="https://github.com/matchms/ms2deepscore">python package</a> that includes Jupyter notebook tutorials to get you started. You can begin comparing your spectra using the <a href="https://zenodo.org/record/4699356">model</a> pre-trained on <a href="https://zenodo.org/record/4699300">109,000 spectra of 15,000 compounds</a>. To learn more about MS2DeepScore and its development, be sure to check out the <a href="https://doi.org/10.1101/2021.04.18.440324">preprint publication</a>.</p><h3>What’s next for MS2DeepScore?</h3><p>We’re building new ways to leverage MS2DeepScore for library matching, including an API, an easy-to-use interface, and continuously updated models.</p><p>This new version will provide,</p><ul><li>A new model trained on over 230,000 spectra;</li><li>Library matching against GNPS public databases;</li><li>A new negative mode comparison.</li></ul><p>If you want to try it out, don’t hesitate to <a href="https://www.datarevenue.com/en-contact">contact us</a> to receive beta access.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef0f923428e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/going-beyond-spectral-similarity-with-ms2deepscore-ef0f923428e6">Going Beyond Spectral Similarity With MS2DeepScore</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[Open MLOps: Open Source Production Machine Learning]]></title>
            <link>https://medium.com/data-science/open-mlops-open-source-production-machine-learning-f4080f02e9f0?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4080f02e9f0</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Thu, 29 Jul 2021 14:41:56 GMT</pubDate>
            <atom:updated>2021-07-29T14:41:56.702Z</atom:updated>
            <content:encoded><![CDATA[<h4>We are releasing the beta of <a href="https://github.com/datarevenue-berlin/OpenMLOps">Open MLOps</a>: an open source platform for building machine learning solutions.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZCBSNAmj6cZAVT6NR4Tihg.jpeg" /><figcaption>Source: Author</figcaption></figure><p>All machine learning teams face the same tasks: Manage a preprocessing pipeline; train and test models; and deploy models as APIs.</p><p>And nearly every team builds their own hodgepodge collection of internal tools and scripts. The alternatives are to either buy into an expensive and limiting proprietary platform or spend months learning and configuring open source products. The former “just work” but are limiting; the latter are tough to set up, but are flexible.</p><h3>We wanted “flexible and easy” so we built Open MLOps</h3><p><a href="https://github.com/datarevenue-berlin/OpenMLOps">Open MLOps</a> is a set of terraform scripts and user guides for you to set up a complete MLOps platform in a Kubernetes cluster. And all of it is open-source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5-r84oRFbcs5a5_-.png" /><figcaption>Open MLOps works out of the box and you can easily adapt it to what you need. Source: Author</figcaption></figure><h3>Who is Open MLOps for?</h3><p>Open MLOps is for any engineering team. We built it so it’s easy to set up and can accommodate pretty much any machine learning use case. You’ll find Open MLOps useful if you’re,</p><ul><li><strong>A machine learning research team</strong>: You know you should be using best practices from MLOps. But you’re not sure how to start and you lack the engineering capacity to build your own framework.</li><li><strong>A machine learning startup: </strong>You need to release your PoC quickly. But it also has to be scalable. You know Kubernetes could solve your problems but you don’t have much expertise.</li><li><strong>An individual machine learning practitioner:</strong> Even on your own, you battle to track experiments you’ve run and you waste time and effort on repetitive work. You need an easier, faster way to wrap your models in APIs, track experiments, and manage data pipelines.</li><li><strong>A machine learning team at a larger enterprise: </strong>Pre-built solutions aren’t flexible enough for you. You know you should build your own but you don’t want to start from scratch.</li><li><strong>A machine learning student: </strong>If you want to make the jump from academia to industry, you can test the waters by setting up Open MLOps and following our guides.</li></ul><p>Open MLOps lets you deploy a configurable set of tools into a Kubernetes cluster. If you need to hook up your own authentication or configure the services in a specific way, you can simply fork the repository and build off the existing Terraform scripts.</p><h3>What is Open MLOps?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EQFcInPSxjq5y8GB.png" /><figcaption>By default, Open MLOps sets up and connects several open source machine learning tools. Source: Author</figcaption></figure><p>Open MLOps is an open source repository of Terraform scripts and walk-through tutorials to set up a variety of machine learning tools in a Kubernetes cluster.</p><p>By default this sets up:</p><ul><li><strong>Prefect: </strong>For scheduling tasks and building DAGs of dependent tasks. You can use it for cleaning data, training and deploying models, or other tasks that you need to automate. Tasks are defined using Python and you can easily build them into pipelines using intuitive decorators.</li><li><strong>JupyterHub</strong>: A shared Jupyter notebook environment for your team to run experiments, share code, and perform data wrangling.</li><li><strong>MLFlow</strong>: To track experiments and models, keeping a close record of results and runs, so you know what’s been tried and what’s working.</li><li><strong>Dask</strong>: To easily parallelize your heavy computation tasks across multiple cores or machines.</li><li><strong>Seldon</strong>: To convert your models into production REST APIs and serve them at scale.</li></ul><h3>What do I need to get started with MLOps?</h3><p>The easiest way to get started with MLOps is with AWS. All you need is access to an AWS account and permission to create new services.</p><p>You also need some experience using command-line tools. Specifically, you’ll use Kubectl and Terraform during the set-up process, but our guides walk you through everything so you needn’t be an expert.</p><p>You can get everything running and configured in a few hours using <a href="https://github.com/datarevenue-berlin/OpenMLOps/blob/master/tutorials/set-up-open-source-production-mlops-architecture-aws.md">our set up guide</a>. Within another hour, you’ll already be <a href="https://github.com/datarevenue-berlin/OpenMLOps/blob/master/tutorials/basic-usage-of-jupyter-mlflow-and-prefect.md">training your first model</a>.</p><h3>Why should I use Open MLOps?</h3><p>MLOps is an emerging but fast-growing field to help machine learning teams iterate quickly, deliver results reliably, and collaborate efficiently. Your team will benefit in several ways from the established open-source tools that make up Open MLOps:</p><ul><li><strong>Hire developers more easily. </strong>Developers don’t want roles that rely on proprietary software. They know these could be dead-end jobs where they can’t learn transferable skills.</li><li><strong>Don’t reinvent the wheel.</strong> It’s often tempting to develop an internal platform that does everything you need. But most teams find it’s more complicated than they expected. You can read our post on why <a href="https://datarevenue.com/en-blog/software-development-vs-machine-learning-engineering">machine learning engineering is more complicated than software engineering</a>. Even if you have intricate, custom requirements, you can start with Open MLOps as a base layer and build your custom solution on top.</li><li><strong>Build reproducible models.</strong> The biggest complaint machine learning teams have is the difficulty of reproducing their work, across different systems or over time. By using widely adopted frameworks and tools with MLOps practices you can ensure you’re never left with that large model binary that no one can build again.</li><li><strong>Collaborate efficiently.</strong> If everyone on your team uses the same system, it’s easier to work together, share, or hand over work to others.</li></ul><h3>Feedback, issues, or feature requests?</h3><p>If you’ve given Open MLOps a try and need support or want to share your experience, please <a href="https://datarevenue.com/en-contact">reach out</a>. Alternatively, feel free to open an issue or a pull request directly on the <a href="https://github.com/datarevenue-berlin/OpenMLOps/">Open MLOps repository</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4080f02e9f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/open-mlops-open-source-production-machine-learning-f4080f02e9f0">Open MLOps: Open Source Production Machine Learning</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[How We Track Machine Learning Experiments with MLFlow]]></title>
            <link>https://medium.com/data-science/how-we-track-machine-learning-experiments-with-mlflow-948ff158a09a?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/948ff158a09a</guid>
            <category><![CDATA[experiment-tracking]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mlflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Wed, 21 Jul 2021 15:53:37 GMT</pubDate>
            <atom:updated>2021-07-21T15:53:37.037Z</atom:updated>
            <content:encoded><![CDATA[<h4>Properly tracking your machine learning experiments is easier than you think</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4wwy7asY7iIjGmsNWYGyvQ.png" /><figcaption>Source: Author</figcaption></figure><p>When you build machine learning models, it’s common to run dozens or hundreds of experiments to find the correct input data, parameters, and algorithm. The more experiments you run, the harder it gets to remember what works and what doesn’t.</p><p>Sometimes you see a great result but because it took hours or days to produce, you’ve already changed the code. And now you can’t remember what parameter you used to get that result!</p><p>Of course, this is an eternal problem for all scientific research. It’s one that’s traditionally solved by the Lab Notebook: a journal where scientists carefully record every experiment they run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*it6s0HeHo8k1QukA.png" /><figcaption>A page from Linus Pauling’s Lab Notebook. Source: Author</figcaption></figure><p>Many data scientists follow a similar approach, keeping notes of their experiments digitally or by hand. But this doesn’t always work for machine learning. You need to keep track of three things: <a href="https://datarevenue.com/en-blog/software-development-vs-machine-learning-engineering">the data, the code, and the model</a>. And even if you’re super precise in your note-taking, it’s not feasible to record everything in full.</p><p>Luckily, you can automate experiment tracking with MLFlow. Not only is it simple to set up, and it adapts easily to your existing workflow.</p><h3>What is MLFlow?</h3><p>MLFlow is an extensive machine learning platform with several components. We’ll just focus on its experiment tracking features for now. We’ve talked before about <a href="https://datarevenue.com/en-blog/why-is-a-model-registry-valuable">model registries and why they’re valuable</a>. There’s definitely some overlap between experiment tracking and model registries, but they aren’t the same.</p><h3>Experiment tracking vs model registries</h3><p>Model registries are for system managers and focus on models that <strong>make it to production</strong>. On the other hand, experiment tracking tools are for scientists to track all experiments, including unsuccessful ones.</p><p>Registries track and visualise these models’ performance and associated metadata. But for every model in production, there are usually hundreds of failed attempts. Experiment tracking is designed for scientists and researchers to help make sense of unsuccessful and not-yet-successful experiments. It makes the research process more efficient by ensuring that work isn’t lost or duplicated.</p><h3>MLFlow’s Python library and dashboard</h3><p>The two components of MLFlow you’ll use for experiment tracking are its Web UI and Python library. You can get them both by running a single install command:</p><p><em>pip install mlflow</em></p><p>You can immediately view the dashboard where all your experiments will live by running <em>mlflow ui</em> and visiting <a href="http://localhost:5000/">http://localhost:5000</a> in your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3LWAu1O_SHhH_Ajc.png" /><figcaption>The MLFlow dashboard’s default view. Source: Author</figcaption></figure><p>This dashboard already has a bunch of similar features to a Lab Notebook: you can take notes, search through previous data, and set up new experiments.</p><p>Things get more interesting when you use this in conjunction with the same <em>mlflow</em> Python library you’ve just installed. By adding a few lines to your existing machine learning code files, you can easily track every single run. This automatically saves the parameters you used, the results, and even the full model binary.</p><p>The screenshot below shows how you can start to automatically track your experiments in around ten lines of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/0*R8YlrpBPcIweFvTk.png" /><figcaption>Code to predict wine quality with tracking using MLFlow. Source: Author</figcaption></figure><p>The highlighted lines are MLFlow-specific, while the rest is a standard scikit-learn example to predict wine quality.</p><p>Each time you run an experiment with this code, it logs an entry you can view in the dashboard. Note the following:</p><ul><li>In the Python code, we referred to an <em>experiment_id`. </em>You can see this in the dashboard after you create a new experiment in the UI. One experiment can have many runs, so you won’t need a new experiment ID each time you try new hyperparameters or other variations.</li><li>Your existing training and evaluation code needs to be within the <em>mlflow.start_run</em> block.</li><li>You can log parameters, metrics, and the entire model with the methods <em>log_param,</em> <em>log_metric</em> and <em>sklearn.log_model</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M8RMKLsBIluF2Rqb.png" /><figcaption>The MLFlow dashboard showing two runs. Source: Author</figcaption></figure><p>From here, you can change parameters as you like, without worrying about forgetting which ones you’ve used. For example, in the screenshot you can see that MLFlow tracked the result of two experiments where we changed the <em>alpha</em> and <em>l1_ratio</em> parameters, making it easy to compare how these metrics affected the r2 and rmse performance.</p><h3>Keeping free-form notes</h3><p>The reason many scientists keep their own notebook rather than using a structured platform is they feel that pre-created templates aren’t flexible enough.</p><p>Something we like about MLFlow is that you can keep notes at different levels: notes relating to an entire experiment, or to a specific run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*r4OezZJT2b_ePYxs.png" /><figcaption>The note-taking functionality of MLFlow. Source: Author</figcaption></figure><h3>How MLFlow works internally</h3><p>MLFlow can be set up in different ways. You can do it locally, as we did in the example above, or on a remote server, which lets you share a single dashboard among a whole team of scientists.</p><p>If you install it locally, you’ll notice it creates a directory called `mlruns` in the same directory where you executed your Python code. Inside this directory you can find the full model binaries (as <em>.pkl</em> files) for every experiment run.</p><p>If you want to track lots of models and you need more space, you can configure MLFlow to store these files on S3 or another cloud storage provider instead.</p><h3>Scaling up your machine learning infrastructure</h3><p>We use MLFlow as part of our <a href="https://github.com/datarevenue-berlin/OpenMLOps">Open MLOps architecture</a>. You can use MLFlow on its own but it also works well in conjunction with other MLOps components, such as <a href="https://datarevenue.com/en-blog/what-we-are-loving-about-prefect">Prefect for scheduling and managing tasks</a>, and a cloud-based Jupyter Notebook environment for easy collaboration.</p><p>We love discussing the challenges of building and keeping track of machine learning models. <a href="https://datarevenue.com/en-contact">Contact us</a> if you’d like to discuss your team’s approach to machine learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=948ff158a09a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-we-track-machine-learning-experiments-with-mlflow-948ff158a09a">How We Track Machine Learning Experiments with MLFlow</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[MLOps: The Ultimate Guide]]></title>
            <link>https://medium.com/data-science/mlops-the-ultimate-guide-9d902c752fd1?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d902c752fd1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mlops-platform]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Wed, 21 Jul 2021 14:46:58 GMT</pubDate>
            <atom:updated>2021-07-21T14:46:58.235Z</atom:updated>
            <content:encoded><![CDATA[<h4>A handbook on MLOps and how to think about it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15TYOgbH5N10cUq0I229kA.jpeg" /><figcaption>Source: Author</figcaption></figure><h3>‍What is MLOps?</h3><p>You’ll find conflicting definitions on MLOps: Is it a movement, a philosophy, a platform, or a job title? Most are either far too vague — a “philosophy” — or far too specific, just referring to one specific toolset.</p><p>Here’s our definition of MLOPs:</p><blockquote><strong><em>MLOps is a collection of industry-accepted best practices to manage code, data, and models in your machine learning team.</em></strong></blockquote><p>This means MLOps should help your team with the following:</p><ul><li><strong>Managing code: </strong>MLOps encourages standard software development best practices and supports continuous development and deployment.</li><li><strong>Best practice: </strong>Guidelines ensure you move seamlessly from ideas, to experiments, to deploying reliable models in production.</li><li><strong>Managing data: </strong>A framework and workflow help to process, save, and track versions of your datasets.</li><li><strong>Efficient collaboration: </strong>Teams can share code, data, models, and experiments; run and understand each other’s work; and iterate on previous work.</li><li><strong>Managing models: </strong>You can easily train models, track experiment results, and deploy robust APIs.</li></ul><p>MLOps is a broad field, so we’ll take a high-level view of the landscape then dive into topics you’ll encounter when adopting it.</p><h3>The MLOps landscape</h3><p>Deciding on the best tools to use and how to get started can be hard. <a href="https://datarevenue.com/machine-learning-software-tools">Our Machine Learning Tools page</a> offers an overview and simple explanations of the most useful tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yfyNIbBhVFq9sSYg.png" /><figcaption>An overview of the most useful machine learning tools and platforms that are part of many MLOps architectures. Source: Author</figcaption></figure><p>These MLOps tools cover everything from data wrangling, visualisation, and task automation, to training and deployment. We’ve focused on open source options but with so many proprietary platforms available too, is it worth shelling out?</p><h3>MLOps: Build vs buy</h3><p>Numerous commercial platforms aim to make MLOps simpler and “build vs buy” is a question many teams ask. People often “buy” because they lack confidence in building their own tools or using open source options. Expensive proprietary platforms promise to simplify all the complexity.</p><p>But proprietary tools often fail on their promises and end up costing and limiting your team instead. The shortcuts they guarantee are often impossible; and your team will still need internal MLOps expertise to use them effectively.</p><p>This is why we’re strong proponents of <a href="https://datarevenue.com/en-blog/own-your-mlops-pipeline-using-oss">Open Source tooling for MLOps</a>. Free, open source tools are often the correct choice: They result in lower costs, more flexibility, more learning, <strong>and </strong>easier onboarding — in spite of what the proprietary platforms would have you believe.</p><p>If you trust your engineering team, we recommend building your own solution from existing open source components over trying to fit your unique needs into someone else’s proprietary platform.</p><p>But if you want to build your own, how do you get started without wasting months researching all the options? We looked for an open source MLOps blueprint but couldn’t find one, so we built it.</p><p>Now you can skip the months of research and engineering we did and set up an open source, production-focused MLOps framework in a few hours.</p><h3>An open-source, ready-to-go MLOps architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xv7fW6rR-SEWUOvW.png" /><figcaption>Production machine learning solutions need to handle dataflow, experiments, features, and serving. Source: Author</figcaption></figure><p>If you want the power and flexibility of your own solution but the simplicity and speed of a managed proprietary solution, take a look at <a href="https://github.com/datarevenue-berlin/OpenMLOps/">our Open MLOps architecture</a>. It’s a set of terraform scripts to set up the same system we use internally on Kubernetes and you can be set up in under a day.</p><p>Here are the advantages of Open MLOps:</p><ul><li><strong>Free, flexible, and open source: </strong>We built Open MLOps entirely using open source tooling. This means that if you have other needs, it’s easy to adapt: Simply swap out the components for other tools or your own custom solutions.</li><li><strong>Easy to start:</strong> Many MLOps tools have steep learning curves. We’ve written <a href="https://github.com/datarevenue-berlin/OpenMLOps/tree/master/tutorials">step-by-step guides </a>so you can walk through an example project in a few hours, then start running your own.</li><li><strong>Scalable</strong>: Open MLOps runs on Kubernetes, so it’s easy to scale up or down, depending on your needs. If you’re running a huge workload, you can just add more compute power. If you’re on a budget, you can run it on a small cluster.</li></ul><p>Open MLOps includes the following components:</p><ul><li><a href="https://jupyter.org/hub"><strong>JupyterHub</strong></a>, a shared notebook environment for your team to collaborate.</li><li><a href="https://mlflow.org/"><strong>MLFlow</strong></a><strong> </strong>to track your experiments and models.</li><li><a href="https://prefect.io/"><strong>Prefect</strong></a><strong> </strong>to manage your workflows and scheduled tasks.</li><li><a href="https://www.seldon.io/"><strong>Seldon</strong></a><strong> </strong>to productionize your models and turn them into APIs.</li></ul><p>You can set up everything in your existing Kubernetes cluster or run our simple set up script to create a new one using AWS EKS. Even if you use pre-built solutions, you’ll probably still need to build internal expertise in MLOps so we’ve listed some good resources to get you started.</p><h3>MLOps resources</h3><p>We’ve written many articles on MLOps. Here are our favourites, to help you at different stages of your MLOps journey.</p><h3>Getting started with MLOps and Machine Learning</h3><p>If you’re looking to adopt MLOps and want to learn more before you start building, you should start with the following:</p><ul><li><a href="https://datarevenue.com/en-blog/the-4-ways-of-doing-machine-learning">The Four Ways of Doing Machine Learning</a>: Understand the different ways to adopt machine learning at a high level.</li><li><a href="https://datarevenue.com/en-blog/mlops-for-research-teams">MLOps for Research Teams</a>: Understand why MLOps isn’t just for industry but is important for research teams too.</li><li><a href="https://datarevenue.com/en-blog/machine-learning-project-architecture">Machine Learning Architecture Components</a>: Understand the important pieces for most machine learning solutions.</li><li><a href="https://datarevenue.com/en-blog/own-your-mlops-pipeline-using-oss">Open Source Software for MLOps</a>: Understand why open source is usually better than proprietary solutions.</li><li><a href="https://datarevenue.com/en-blog/software-development-vs-machine-learning-engineering">Software Development vs Machine Learning Engineering</a>: Understand why machine learning engineering has additional challenges that trip up even experienced software engineers.</li><li><a href="https://datarevenue.com/en-blog/mlops-for-model-decay">MLOps for Model Decay</a>: Understand why you can’t “fire and forget” your models, even if they perform well.</li><li><a href="https://datarevenue.com/en-blog/why-is-a-model-registry-valuable">Why is a Model Registry Valuable?</a>:<strong> </strong>Understand how and why it’s important to track your models.</li><li><a href="https://datarevenue.com/en-blog/why-you-need-a-model-serving-tool-such-as-seldon">Why You Need a Model Serving Tool</a>: Understand how to serve your models in a production environment.</li></ul><h3>Choosing tools to set up your own MLOps platform</h3><p>Once you’ve chosen to adopt MLOps, you’ll need some specific tools and platforms. Given the breadth of options, this is probably the hardest part so we’ve compared our favourites and cut through the marketing speak to make it easier for you.</p><ul><li><a href="https://datarevenue.com/en-blog/feature-store-feast-vs-hopsworks">Choosing a Feature Store</a>:<strong> </strong>Why you need a feature store and how to choose one.</li><li><a href="https://datarevenue.com/en-blog/what-we-are-loving-about-prefect">Why We Love Prefect as a Data and Workflow Platform</a>: Why you should consider Prefect as your task scheduler and workflow tool.</li><li><a href="https://datarevenue.com/en-blog/kubeflow-not-ready-for-production">Kubeflow: Not Ready for Production?</a>: The problems we found with Kubeflow before switching to Prefect.</li><li><a href="https://datarevenue.com/en-blog/ml-platforms-dataiku-vs-alteryx-vs-sagemaker">Comparing MLOps Platforms: Dataiku vs Alteryx vs SageMaker vs Databricks</a></li><li><a href="https://datarevenue.com/en-blog/data-dashboarding-streamlit-vs-dash-vs-shiny-vs-voila">Comparing Dashboarding Solutions: Streamlit vs Dash vs Shiny vs Voila</a></li><li><a href="https://datarevenue.com/en-blog/airflow-vs-luigi-vs-argo-vs-mlflow-vs-kubeflow">Comparing Workflow Platforms: Airflow vs Luigi vs Prefect vs MLflow vs Kubeflow</a></li><li><a href="https://datarevenue.com/en-blog/pandas-vs-dask-vs-vaex-vs-modin-vs-rapids-vs-ray">Comparing Data Wrangling Tools: Pandas vs Dask vs Vaex vs Modin vs Ray</a></li></ul><h3>Setting up Open MLOps</h3><p>Once you’ve chosen your tools, you’ll need to set up and configure them. If you want to emulate the setup we use internally at Data Revenue using Open MLOps, we’ve created some step-by-step guides to get JupyterHub, Prefect, Seldon, Dask, and MLFlow up and running quickly.</p><ul><li><a href="https://github.com/datarevenue-berlin/OpenMLOps/blob/master/tutorials/set-up-open-source-production-mlops-architecture-aws.md">Setting up Open MLOps: An Open Source Production Architecture for Machine Learning</a></li><li><a href="https://github.com/datarevenue-berlin/OpenMLOps/blob/master/tutorials/basic-usage-of-jupyter-mlflow-and-prefect.md">Using JupyterHub, Prefect, and MLFlow on Open MLOps</a></li><li><a href="https://github.com/datarevenue-berlin/OpenMLOps/blob/master/tutorials/deploy-model-seldon.md">Deploy Your Model as an API with MLFlow, Prefect, and Seldon</a></li></ul><h3>Getting help</h3><p>If you need help setting up your team with MLOps, feel free to <a href="https://datarevenue.com/en-contact">reach out</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d902c752fd1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/mlops-the-ultimate-guide-9d902c752fd1">MLOps: The Ultimate Guide</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[MLOps Can Help Fix Model Decay]]></title>
            <link>https://medium.com/data-science/mlops-can-help-fix-model-decay-f53573da6b1a?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/f53573da6b1a</guid>
            <category><![CDATA[model-monitoring]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Thu, 24 Jun 2021 16:05:40 GMT</pubDate>
            <atom:updated>2021-06-24T16:05:40.999Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why you should monitor your machine learning models after shipping them</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*548NO9tSy-D2VkPOXiHAYg.jpeg" /><figcaption>Source: Author</figcaption></figure><p>It’s common for machine learning teams to get great results on a test set, deploy the model to a real-world setting, spend two weeks watching to ensure it still gets good results, then move onto another project.</p><p>However, because machine learning models often interact with real-world events, not just static datasets, their accuracy can degrade over time. And without automated monitoring, it’s very possible that no one will notice for quite some time.</p><p>At some point, probably far later than ideal, you might pick this up. Your team will go back, retrain the model, push out an update to production, monitor manually for a couple of weeks, then move on again.</p><p>While this optimistic mindset of “assume things are working as expected” can work in cases where the results aren’t that important, it can be disastrous in higher-impact scenarios.</p><p>Here’s how you can automatically detect model decay, update a model, and deploy it to production using <a href="https://datarevenue.com/en-blog/mlops-for-research-teams">MLOps</a>.</p><h3>How to think about automated monitoring</h3><p>The first step to automated monitoring is to detect the issues. Proactively identifying model decay, not simply reacting when problems arise, is key. You can prevent a lot of issues, even if you need to invest some time to manually retrain and redeploy a model.</p><p>In theory, this is straightforward. You set up a monitoring system and it pushes you an alert when your system’s accuracy falls below a certain threshold.</p><p>In reality, it’s more difficult. You might have a manually annotated “gold” dataset for training, but in production, you <strong>don’t know </strong>if your model is getting things wrong: if you did, you wouldn’t need the model in the first place.</p><h3>Three strategies for monitoring models</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8R2jmTZMDUjQm9Gi.png" /><figcaption>You can monitor your model directly, by proxy or retrospectively. Source: Author</figcaption></figure><p>To calculate your predictions’ accuracy, you can do one of the following:</p><ul><li><strong>Monitor a metric that correlates with accuracy</strong>. If a spam classifier generally predicts 30% of messages as spam but one day predicts 75%, for example, there’s probably not been a huge rise in actual spam; it’s more likely the model is broken.</li><li><strong>Human-in-the-loop sample. </strong>For example, you might manually check 5% of all predictions, and monitor the accuracy of those..</li><li><strong>Monitor retrospectively.</strong> If you make predictions about the future, like whether a patient will recover in a month, then you’ll be able to verify your accuracy later on.</li></ul><p>Once you have a metric that acts as a reasonable quality check, you’ll need a tool to monitor it. This can either be a generic monitoring tool like DataDog or a specialized machine-learning monitoring tool. A specialized tool makes it easier to get more useful metrics for machine learning scenarios, like an error distribution or Mean Absolute Error. But if your use case is simpler and you’re already set up with another monitoring tool, it’s probably faster to start with that.</p><h3>Automatically retraining and deploying your models</h3><p>Detecting decay is the most important step, but it’s not that valuable unless you can do something about it. Manually retraining a model and deploying it is one option, but then your team needs to be constantly “on call”, waiting for the alarms to trigger.</p><p>Manual retraining involves a lot of effort and carries more risk of human error, especially if you need to do this frequently.</p><p>If you have a full <a href="https://datarevenue.com/en-blog/machine-learning-project-architecture">MLOps architecture</a> set up, you should have everything in place to automatically retrain your models and deploy them — either on a fixed schedule or when you detect model decay.</p><p>In software engineering, a CI/CD or “continuous integration/continuous deployment” framework is common. This means you’ve set things up so that new code can be automatically integrated into existing code, tested, and deployed.</p><p>In MLOps, you also want to retrain your models, so you need CT/CI/CD, or “continuous training/continuous integration/continuous deployment”.</p><p>You’ll need to invest time upfront to set up a CT/CI/CD pipeline, but in our experience, most teams do things manually for too long.</p><h3>Tools you can use against model decay</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pgR8PtLU48otxUoU.png" /><figcaption>You can combine your machine learning framework, like TensorFlow, with a workflow tool, a feature store, and model-serving framework to fight model decay. Source: Author</figcaption></figure><p>There are plenty of MLOps tooling options, but here’s what we use in automatically retraining our models to avoid model decay:</p><ul><li><strong>Prefect </strong>as a workflow and dataflow tool. This lets us define a graph of tasks to be run and then automatically execute them, monitoring and re-running if necessary. You can read more about <a href="https://datarevenue.com/en-blog/what-we-are-loving-about-prefect">what we love about Prefect</a>. Prefect not only handles the automatic retraining of models, but also the scheduled monitoring to help us analyse and detect decay.</li><li><strong>Feast </strong>as a feature store. With Feast, you can track changes to data and share features between models. Learn more about feature stores in our article, <a href="https://datarevenue.com/en-blog/feature-store-feast-vs-hopsworks">Choosing a Feature Store</a>.</li><li><strong>Seldon </strong>for serving models. With Seldon, you can easily turn any model into an API and serve it at scale, without writing serving code from scratch.</li></ul><h3>Do you need help setting up MLOps for your research team?</h3><p>What often makes teams hesitate to invest in a proper architecture is the number of unknowns: they don’t know how long it will take or how to start. We’ve done it before and would enjoy helping you skip the grunt work, so <a href="https://datarevenue.com/en-contact">contact us</a> if you want to chat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f53573da6b1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/mlops-can-help-fix-model-decay-f53573da6b1a">MLOps Can Help Fix Model Decay</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[Why Open Source Beats Proprietary Software for MLOps]]></title>
            <link>https://medium.com/data-science/why-open-source-beats-proprietary-software-for-mlops-b30e52f70f5b?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/b30e52f70f5b</guid>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[proprietary-software]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Thu, 13 May 2021 18:45:53 GMT</pubDate>
            <atom:updated>2021-05-13T18:45:53.451Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s important to own your ML pipeline for flexibility and control</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjKDA3SHd4yTTwBplQs31A.png" /><figcaption>Source: Author</figcaption></figure><p>Machine learning teams can use proprietary platforms like Knime or SageMaker, or build their own using open source tools. Companies often sell proprietary platforms as more powerful, more efficient, and easier to use. But in reality, they’re often more complicated and less powerful than open source alternatives.</p><p>We build our own MLOps architecture from purely open source foundations. Here’s why ownership of your platform is important.</p><h3>Open source is higher quality</h3><p>People are sometimes suspicious of free tools but open source software is often <strong>higher </strong>quality than paid alternatives. Megacorps like Google and Microsoft rely heavily on open source software and frequently have their best engineers working on these projects.</p><p>Open source projects also benefit from having many more eyes on them than closed-source alternatives. If a developer finds a bug, they can contribute a fix that benefits everyone.</p><p>Finally, open source software is usually not marketed, meaning incentives are better because quality is the key factor determining success. By contrast, the success of commercial projects can depend far more on marketing, partnerships, and branding. This means companies are often incentivized to spend more time and effort on these areas than engineering.</p><p>“You get what you pay for” is therefore a real misnomer when it comes to open source software.</p><h3>Open source leads to transferable skills, which makes hiring easier</h3><p>Engineers want to learn open source tools because they can use this knowledge at other companies, too. No one wants to be trapped in their current job because they spent ten years learning the ins-and-outs of some internal platform.</p><p>Training your team to use tools valuable to other companies, like TensorFlow and Kubernetes, might make some people nervous, but really it’s the only sustainable way to attract top engineering talent.</p><p>Your team can benefit from these transferable skills in other ways, too: it’s far easier to find expert consultants or even simple community-sourced help if you use the same tools as everyone else.</p><h3>Open source solutions are more modular</h3><p>Being “all-encompassing” is a key way enterprise platforms try to differentiate themselves. Instead of building only a training platform, or only a deployment tool, they sell themselves as “all-in-one” solutions or “the last tool your team will need”.</p><p>But being the best at everything is unrealistic. And the monolithic nature of these solutions makes it harder to swap out individual components. If your team wants to use the best model registry, often they just can’t plug it into their existing platform.</p><p>By contrast, open source software is usually more granular and has a strong focus on integrating with other platforms. This means an open source solution is more like playing with lego: if part of it’s giving you trouble, you can simply detach it and switch in an alternative.</p><h3>There are hidden costs in proprietary platforms</h3><p>Proprietary platforms are incentivized to constantly sell upgrades and new features to existing customers. In many cases, this means they’re not upfront about their limitations.</p><p>During sales, they might convince you that a low or mid-level plan suits your needs perfectly. Only after buying in do you realise they’ve strategically removed key features, or added specific limits designed to cripple your workflow until you pay for the next upgrade.</p><p>These platforms can also raise their pricing with next-to-no notice, so your team can either scramble to rewrite everything or pay more than you budgeted.</p><h3>When does it make sense to use proprietary platforms?</h3><p>If your team doesn’t have much engineering expertise, especially when it comes to DevOps and creating and managing infrastructure, then setting up and maintaining open source solutions can be challenging.</p><p>Open source tools tend to be built “by developers for developers”, so non-technical teams like marketing might also prefer proprietary platforms in some cases.</p><p>Finally, if you’re working on small internal projects or proof-of-concept applications, there’s often little need for infrastructure. If people aren’t using your solution as a product, an off-the-shelf tool for something like a quick visualisation is often good enough.</p><h3>Does your team need help adopting open source MLOps?</h3><p>We’re a machine learning agency that loves helping research teams set up open source MLOps infrastructure. <a href="https://datarevenue.com/en-contact">Contact us</a> any time if you’d like to discuss MLOps tools.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b30e52f70f5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/why-open-source-beats-proprietary-software-for-mlops-b30e52f70f5b">Why Open Source Beats Proprietary Software for MLOps</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[Spec2Vec: The Next Step in Mass Spectral Similarity Metrics]]></title>
            <link>https://medium.com/data-science/spec2vec-the-next-step-in-mass-spectral-similarity-metrics-b79c3db7511a?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/b79c3db7511a</guid>
            <category><![CDATA[cosine-similarity]]></category>
            <category><![CDATA[untargeted-metabolomics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mass-spectrometry]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Wed, 07 Apr 2021 21:27:28 GMT</pubDate>
            <atom:updated>2021-04-07T21:27:28.317Z</atom:updated>
            <content:encoded><![CDATA[<h4>Spec2Vec uses an unsupervised machine learning model to predict structural similarity from MS/MS mass spectra</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0toz9Ed67aT74a6xcE7cVw.png" /><figcaption>Source: Author</figcaption></figure><p>Calculating the similarity between two MS/MS mass spectra is an essential step in most untargeted metabolomics workflows.</p><p>However, it’s long been known that cosine similarity — the most popular similarity measure — has significant weaknesses.</p><p>Justin van der Hooft and his team have developed a new approach to calculating spectral similarity: Spec2Vec. This is really helpful for analyzing untargeted metabolomics results in biomarker discovery or natural product research.</p><p>Let’s see how Spec2Vec works and why it’s a good alternative to cosine similarity.</p><h3>Why mass spectral similarity metrics matter</h3><p>A datapoint in an untargeted metabolomics dataset is, at first, just a measured entity. We don’t know yet what molecule it might be. Hence, we can’t interpret its significance: Is it something new? What is it’s metabolomic function?</p><p>But if you can match this entity against a database, like the Human Metabolome Database, then you can add (annotate) important information to that entity. And in order to match your measurement and the entries in the database, you need <strong>a similarity metric</strong>.</p><p>This is how mass spectral similarity metrics are mainly used:</p><ul><li><strong>Spectral library matching</strong>: Matching a compound against a spectral library (such as HMDB).</li><li><strong>Analogue search</strong>: Finding the top hits in a large spectral library, to look for structurally related molecules.</li><li><strong>Mass spectral networks</strong>: Clustering related compounds in a mass spectral network.</li></ul><p>Any mistake can be costly: If you can’t find a match, then your compound might seem to be an exciting new drug candidate, when in reality, it’s a well-known molecule; If you only discover this at a much later stage of your research, then you’ve wasted a lot of effort.</p><p>The better your similarity metric is, such mistakes will happen less frequently.</p><h3>The drawbacks of cosine similarity</h3><p>Cosine similarity measures how much one mass spectrum <strong>overlaps</strong> with another mass spectrum. If two mass spectra have near perfect overlap, then the cosine similarity is high — and their molecular structures are likely very similar.</p><p>Sometimes though, you have structurally similar molecules whose mass spectra do not overlap — and in those cases, cosine similarity will likely fail. Here’s how that happens:</p><ol><li><strong>Large molecules modified in several places: </strong>Large molecules — as often found in plants and microorganisms — can easily get several small modifications in their molecular structures.</li><li><strong>Several fragments are shifted: </strong>If you fragment a molecule that has several modifications, then not one, but several of its fragments also retain a modification. As a result, several fragment peaks shift on the mass spectrum.</li><li><strong>Few peaks overlap perfectly:</strong> If lots of fragments are shifted, the overall spectrum no longer overlaps neatly with the unmodified molecule.</li><li><strong>Low cosine similarity: </strong>In terms of cosine similarity (overlap), the two molecules therefore seem unrelated and you’ll see a low cosine score.</li><li><strong>Wrong conclusions:</strong> As a result, you might think a library has no molecule similar to your compound, when in fact it does. This could provoke the conclusion that you’ve found a novel molecule, even though what you’ve found is just a slight modification of a well-described molecule.</li></ol><p>This is a well-known problem but no fundamentally alternative mass spectral similarity metrics have been proposed as solutions, until Spec2Vec.</p><h3>Spec2Vec: Unsupervised learning of spectral similarities</h3><p>At the basis of Spec2Vec is a powerful new assumption: If two fragmentation peaks often show up together, across thousands of mass spectra, then that’s probably because they come from the same molecular substructure.</p><p>So those two peaks are related in some way. And now, if you only see one of these peaks in one molecule and the other in another molecule, you can make a guess that the same substructure, maybe with small modifications, is present in both molecules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*P1A-mMSJbIxj_moW.png" /><figcaption>Learned relationships between peaks allow Spec2Vec to identify that two spectra are similar — even though their spectra don’t overlap in several places. Source: Author</figcaption></figure><p>Spec2Vec implements precisely this idea. But on a large scale, Spec2Vec takes a dataset of many thousands of mass spectra and <strong>learns</strong> from this dataset what peaks are related. Then you can use what Spec2Vec learned to calculate spectral similarity between any two mass spectra.</p><p>If this works, then a molecule with several small modifications — like the previous example — shouldn’t fool Spec2Vec. Now, does this work?</p><h3>Comparing Spec2Vec with cosine similarity</h3><p>Let’s look at the results of two tests. For the tests, we use a large molecular library from GNPS that contains molecule structures and their spectra.</p><h3>Test 1: How well do Spec2Vec scores correlate with structural similarity?</h3><p>First you need a ground truth against which you can compare Spec2Vec and cosine similarity. Justin and his team took 12,797 unique compounds and used their known molecular structures to directly calculate the structural similarity score (Tanimoto score) for each pair of molecules.</p><p>For each of the same pairs (81,875,206 pairs in total), they also calculated cosine, modified cosine, and Spec2Vec scores, but this time, only using the library spectra, not the known structures. This was the result:</p><ul><li><strong>Spec2Vec correlates considerably better with structural similarity</strong>;</li><li>Only when spectra overlap almost perfectly do all metrics perform similarly well.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*xXBuydesMQyXlNHo.png" /><figcaption>Spec2Vec finds considerably more highly similar structures (measured by Tanimoto score) among it’s highest scored spectral pairs. Source: Author</figcaption></figure><p>Spec2Vec’s high correlation with structural similarity (Tanimoto scores) is very promising, but does this translate to better library matches?</p><h3>Test 2: Can Spec2Vec find the right matches in a library search?</h3><p>In a second test, Justin’s team selected 1,000 unique molecules from the spectral library that also had at least four planar structural equivalents (these look the same in 2D) in the library. These near-equivalent molecules remained in the library.</p><p>The task then was to figure out if the molecules that had the same 2D structure would get the highest similarity scores.</p><p>The results were in line with the first test: Again, <strong>Spec2Vec found considerably more reliable matches</strong> than cosine similarity, across all score ranges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*FePCLKHeFFBPRT1O.png" /><figcaption>Across all score ranges, Spec2Vec’s hit rate was considerably higher then that of cosine similarity. Source: Author</figcaption></figure><p>But Spec2Vec has even more advantages.</p><h3>Spec2Vec is much faster</h3><p>Cosine similarity calculations are very expensive on mass spectra because of the preprocessing they need. They’re so expensive that it’s usually impractical to make comparisons against an entire large database.</p><p>A Spec2Vec model, once it’s trained, is extremely fast: roughly 100-times faster than cosine similarity scoring. Even if you include the time to train the Spec2Vec model, it’s still around 10-times faster overall (without taking any possible optimizations in cosine similarity into account).</p><p>This means that with Spec2Vec, you can easily run all-vs-all searches against large libraries, without any limitations.</p><p>And Spec2Vec isn’t difficult to implement, even though it’s a much more advanced approach to similarity scoring.</p><h3>How to integrate Spec2Vec into your workflow</h3><p>You can implement Spec2Vec with an easy-to-use, Python open-source package that is freely accessible on Github:<a href="https://github.com/iomega/spec2vec"> https://github.com/iomega/spec2vec</a>. You can install it with Anaconda (recommended) or pip.</p><p>You can even download the pre-trained Spec2Vec model Justin used for the tests above, <a href="https://zenodo.org/record/4173596#.YDRdT2puft0">from Zenodo</a>. And you can calculate mass spectral similarities without training your own model.</p><p><strong>&gt;&gt; Important to note</strong>: Spec2Vec is an unsupervised algorithm. This means you can train it on any set of MS/MS spectra you have, without any additional information.</p><h3>This is just the beginning</h3><p>Spec2Vec is a great approach and can probably be easily extended:</p><ul><li><strong>GC-MS</strong>: So far, Spec2Vec has only been tested on LC-MS data. It might be even more valuable for GC-MS studies because in GC-MS measurements, you can’t limit library searches by pre-filtering by the similarity of precursor ions.</li><li><strong>Supervised</strong>: It’s great that Spec2Vec is unsupervised. But you could also build a supervised model: For example, you could train a model that predicts the Tanimoto score directly from the spectral embeddings. This might give you even more accurate models.</li><li><strong>Improved Mass2Motifs</strong>: Spec2Vec vector embeddings could potentially be used to train more powerful Mass2Motifs.</li><li><strong>Improved Network Annotation Propagation (NAP)</strong>: Similarity scores are essential in building mass spectral networks, so if Spec2Vec produces more useful networks, it could also improve your annotation and speed up structural elucidation.</li></ul><p>In general, any tool that currently uses cosine structural similarity can probably benefit from integrating Spec2Vec as an alternative similarity metric.</p><h3>Further Reading</h3><p>If you want to learn more about Spec2Vec:</p><ul><li><strong>Try the </strong><a href="https://github.com/iomega/spec2vec/tree/master/spec2vec"><strong>Spec2Vec python package</strong></a><strong>;</strong></li><li>Try Spec2Vec within <a href="https://gnps.ucsd.edu/">GNPS</a>;</li><li>Read the <a href="https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008724">Spec2Vec paper</a>; and</li><li>Check out Florian Huber’s <a href="https://blog.esciencecenter.nl/build-a-mass-spectrometry-analysis-pipeline-in-python-using-matchms-part-ii-spec2vec-8aa639571018">Spec2Vec Tutorial</a>.</li></ul><h3>Do you need help applying machine learning to omics research?</h3><p>We can help your research team set up the right infrastructure for reproducible and easily deployable machine learning models. Just <a href="https://datarevenue.com/en-contact">get in touch</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b79c3db7511a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/spec2vec-the-next-step-in-mass-spectral-similarity-metrics-b79c3db7511a">Spec2Vec: The Next Step in Mass Spectral Similarity Metrics</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[How Zebra Medical Vision Developed Clinical AI Solutions]]></title>
            <link>https://medium.com/data-science/how-zebra-medical-vision-developed-clinical-ai-solutions-34b385617b65?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/34b385617b65</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[medical-image-annotation]]></category>
            <category><![CDATA[diagnostic-imaging]]></category>
            <category><![CDATA[notes-from-industry]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Sat, 27 Mar 2021 04:12:52 GMT</pubDate>
            <atom:updated>2021-04-02T20:05:43.522Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="https://towardsdatascience.com/tagged/notes-from-industry">Notes from Industry</a></h4><h4>Zebra Medical Vision has 7 FDA-approved solutions — here’s how they did it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlyEyH6ezCzUv8tHPN1F9A.png" /><figcaption>Source: Author</figcaption></figure><h3>The peculiar lack of clinical AI diagnostic solutions</h3><p>Many research studies have shown that machine learning models can perform as well as trained doctors on a range of tasks — especially in radiology — and can even find patterns a human doctor would miss.</p><p>But for many years, AI-supported diagnostic solutions were not actually being used in hospitals. In other fields, we’re used to a quick translation from research to practice: after a breakthrough in facial detection technology, you might see Facebook using the same technology to tag your friends in less than six months. But in medical diagnostics, innovation simply didn’t translate into practice. Why not?</p><p>This is exactly the situation Eyal Toledano faced in 2014, when Zebra Medical Vision was born: lots of breakthrough research, an obvious need for AI support in diagnostics, plenty of talent, but almost no solutions in day-to-day clinical use.</p><p>So they went looking for the reasons behind this reality. They found that research alone couldn’t address some of the critical challenges which needed to be solved before AI diagnostics could be applied in clinical contexts. Doctors and clinicians needed:</p><ol><li>Models trained on datasets that represent the population;</li><li>Seamless integration into clinical workflows;</li><li>A technology platform to connect research and hospitals.</li></ol><h3>Challenge 1: Building a representative dataset</h3><p>The first issue Eyal and his team discovered was that most academic research relied on small datasets. Not only were they small, but they also didn’t represent the variety of patient cases clinicians see in hospitals on a day-to-day basis. For real-world diagnostic solutions, representative data is absolutely crucial.</p><p>So the first challenge is getting a large, diverse dataset that looks exactly like what you’d expect to see in a hospital.</p><p>That’s why, for the first two years, Zebra Medical Vision hardly did any machine learning at all. Instead they focused on developing data partnerships with over 30 hospitals in Israel, the US, and India.</p><h3>Collecting a full view of the patients</h3><p>While many studies might simply compare doctors’ and machines’ diagnostic performance using one type of data, Zebra Medical Vision had to go further. They collected data on:</p><ul><li>Radiology images in many different modalities (X-Ray, CT, MRI, Mammography, PET, and Nuclear Medicine);</li><li>Lab analyses;</li><li>Patient admission and discharge;</li><li>Doctors’ diagnoses;</li><li>Clinical outcomes (meaning how patients fared after discharge, possibly years later).</li></ul><p>The key factor here was that the samples Zebra-Med collected had to represent the exact same diversity and complexity doctors face in the hospital every day.</p><h3>Proof-of-concept vs. a clinical diagnostic solution</h3><p>Let’s say you build a system that can take a radiology image and then correctly judge whether the image shows signs of lung cancer or indicates a healthy patient. At first sight this might seem very useful. But it wouldn’t be useful in a hospital.</p><p>So far, this is just a proof-of-concept — you’ve demonstrated that an algorithm can process radiology images and differentiate between two clearly described groups of patients. But does this scenario (lung cancer vs. healthy patient) really represent the problem a doctor would face?</p><p>In fact, this isn’t a question that comes up in a hospital. It’s more likely that a patient comes to you because they have some symptoms already, and you need to diagnose the cause: ground-glass opacity, pulmonary embolism, COPD, emphysema, and lung cancer might all present similar symptoms.</p><p>If the machine learning model is going to be of any use to the doctor, it needs to be able to differentiate among radiology images of patients with symptoms — not between healthy and unhealthy people.</p><p>To put it another way: the data you train the diagnostic model on needs to <strong>represent the population</strong> you expect to see in the clinic.</p><p>But this isn’t the only hurdle to making a useful model for everyday hospital diagnosis.</p><h3>Challenge 2: Integrating seamlessly into clinical workflows</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*hLcU_3YI8tRqavd7.png" /><figcaption>Zebra’s AI prediction integrates directly into the clinical workflow: It flags suspicious studies, and the doctor can easily sort them to the top. Source: Author</figcaption></figure><p>It’s safe to assume that doctors, like anybody else, want new solutions to make their work easier — not more complicated.</p><p>But academic research leaves this issue unresolved. For example, you might develop a very accurate machine learning model that only performs well when the image is taken with specific machine settings — settings a doctor wouldn’t normally use in a routine exam.</p><p>Solving the problem in this way is certainly a valuable research result, but it’s still far from a workable diagnostic model for clinical practice, because it requires a non-standard workflow.</p><p>In practice, the model has to fit seamlessly into the existing workflow. This means:</p><h3>Using the data produced in the standard workflow</h3><p>A clinically useful model should not require the clinician to perform any additional steps. It should only require the exact data — in the exact format — that’s already produced in the hospital’s normal diagnostic workflow.</p><h3>Working with the software doctors already use</h3><p>Zebra Medical Vision didn’t build a new software tool for doctors to add to their workflow. Instead they partnered with diagnostic workstations and integrated their predictions directly into the software tools the doctors were already familiar with.</p><p>This seamless integration is essential — not only because asking doctors to change their workflow is unrealistic, but because the whole point of using AI is to save time, not to create additional work.</p><p>But this wasn’t easy. There are a wide variety of workstation providers and software, as well as different kinds of environments (e.g., web-based or Windows based). Plus a lot of the software is quite old. Nevertheless, Zebra-Med has to integrate with each of them.</p><h3>Separating integration from computation</h3><p>Zebra-Med built a smart infrastructure that allows for flexibility while minimizing double work. The hospital only has to install an agent in their local system once, and this agent deals with privacy, security, and anonymity, as well as providing a local user interface.</p><p>On the other hand, all the heavy lifting and prediction happens in the cloud. This also makes it very simple for Eyal and his team to roll out new versions of the model. They simply update the model on their side, and the agents installed in the hospital communicate with the centrally hosted model. This means hospitals don’t need to do anything to receive updates.</p><p>Plus Zebra-Med calculates the predictions in advance, so when a physician clicks on an image, they can see the result immediately.</p><p>So let’s say you’ve managed to build a model that accurately represents the population, seamlessly integrates into diagnostic workstations, and fits the doctor’s workflow.</p><p>Even then, you still can’t be sure that the doctor would benefit from using your diagnostic model. Here’s why.</p><h3>Saving the doctor time</h3><p>Let’s say there are 6 cancer diagnoses for every 1,000 mammographies, and you’ve trained a machine learning model that can assess the images in real-time. The doctor now sees the AI model’s assessments next to all of their scans and can prioritize the cases that have been flagged.</p><p>Now we face two crucial considerations:</p><p><strong>The false-negative rate</strong>. How often does the model think a patient is healthy when in fact they are not? This kind of error is obviously very dangerous. If the doctor doesn’t look at a scan because the system says the patient is healthy when they aren’t, then the patient might miss their chance to get treated. This is a serious error that must be avoided at all costs.</p><p><strong>The false-positive rate</strong>. How often does the system flag a scan when the patient is in fact healthy? This error is much less problematic — the doctor will cross-check the scan because the system flagged it, and will discover it was a false alarm.</p><p>But overall, the false positive rate still determines whether the system saves the doctor time. Imagine you see that a scan is flagged. You’ll inspect it diligently, try to understand why the AI system might have deemed it problematic, and spend a lot of time deliberating before you conclude: “No, the AI made a mistake. This patient is actually healthy.” Let’s say this is the case for 49 out of every 50 scans the AI flags.</p><p>In this case, it doesn’t matter how much more quickly the AI can make a single assessment if the doctor has to spend extra time checking and refuting most of the cases the AI flagged.</p><p>To assess whether an AI solution can truly speed up a particular diagnostic workflow, you need to consider:</p><ul><li><strong>Integration.</strong> How seamlessly can your model integrate into the current tools? Does an AI assessment fit into the workflow?</li><li><strong>Presentation. </strong>Can you present the predictions in a way that makes sense to the doctor?</li><li><strong>Clinical prevalence</strong>. How many cases do you expect in a given number of scans? And can you reach a false-positive rate that the doctor can tolerate?</li></ul><p>So far, we’ve highlighted how important it is to get real clinical data as the basis for building a model that can perform on the exact population and data present in the clinic. And we’ve shown that simply having an automated diagnostic model doesn’t necessarily mean you’re saving a doctor time — seamless integration and a manageable false-positive rate are essential.</p><p>But if we want to connect research with the clinic — in a way that satisfies regulatory requirements — we’re still missing something.</p><h3>Challenge 3: Building the technological backbone of an AI diagnostic solution</h3><p>A proficient data science and research team is essential, but it’s not sufficient.</p><p>Once Eyal and his team had both the data and a means of getting solutions into clinicians’ hands, they had to build a highway on top of this bridge: the technological backbone that would make everything else possible.</p><h3>Annotating and curating data at scale</h3><p>Machine Learning models learn from the dataset. So if there are any mistakes in your data — like a wrong diagnosis — then the model will also learn those mistakes. Before you run any experiments, you need to double check and correctly annotate all the data points in your study.</p><p>For their studies, Zebra Medical Vision had to coordinate support from up to 60 different expert annotators worldwide — all working on the same clinical mission. At this scale, Eyal had to build internal tools to collect, compare, and consolidate all those annotations.</p><h3>Running thousands of experiments at a time</h3><p>In the past, a researcher might take the time to design the perfect experiment, implement it, and then assess whether their approach solves the problem. But this doesn’t work for machine learning: there are so many ways to slice the data and build a model, you would never reach the end.</p><p>So Eyal [and the team] needed to build a platform to allow researchers to test not one, but thousands of experiments at the same time. They also built tools to <strong>track</strong> all of these experiments and then <strong>compare</strong> the results.</p><h3>Separating research and clinical systems</h3><p>Many companies talk about feedback loops — where the model improves via user feedback. For clinical solutions, that’s not usually realistic or responsible.</p><p>A diagnostic model is considered a medical device, and any change has to go through the process of regulatory approval.</p><p>Zebra Medical Vision’s two systems for research (model training and testing) and clinical use are entirely separate. There is a firewall between them, and they’re even hosted in two separate physical locations.</p><p>Of course, the team still appreciates getting feedback from doctors so they can understand how the model is performing and put that learning to use in future iterations.</p><p>But this is just one of the hurdles of working in a regulated environment.</p><h3>Fulfilling regulatory requirements</h3><p>Everything connected to the development and use of a diagnostic model needs to be traceable, including:</p><ul><li>Product definition and system requirements;</li><li>Design;</li><li>Data curation;</li><li>Research, development, and engineering;</li><li>Testing;</li><li>Release processes;</li><li>Customer complaints.</li></ul><p>Zebra Medical Vision built a global quality management system which provides this information to the FDA on an ongoing basis, gaining trust through transparency. They also adhere to and are tested on three different ISO standards, as well as SOC 2 Type 2 internal controls reports issued by third-party auditors.</p><p>This required a huge investment in security, as well as making sure everything is logged and documented.</p><p>Now we covered partnerships, data, integration, and the technical backbone. They are all necessary. But these elements are still not sufficient to solve a machine learning diagnostics problem — or what Eyal calls a clinical mission.</p><h3>The Band: An interdisciplinary group with a clinical mission</h3><p>Zebra Medical Vision very quickly learned that data scientists can’t build a useful medical device all on their own. What’s more, if you pair clinicians with data scientists you’re still stuck, because even when they think they’re talking about the same thing, they’re usually not. Someone needs to fill the gap.</p><h3>Translating between two worlds: The role of the clinical information manager</h3><p>Zebra Medical Vision needed someone with clinical trials management experience — someone who could speak the languages of both the clinicians and the data scientists. They dubbed this role the “Clinical Information Manager” — and this person usally has a PhD in biomedical engineering or clinical research.</p><p>Each clinical mission also needs a project manager, a research engineer, and an operations engineer.</p><p>Eyal calls this unique interdisciplinary team <strong>the band</strong>: different talents, same clinical mission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Qs6KgANpNBICKDwR.png" /><figcaption>The Band: An interdisciplinary team that Zebra-Med uses to successfully solve clinical missions and bring AI diagnostics into the clinic. Source: Author</figcaption></figure><p>Each band member has a specific role:</p><ul><li>The <strong>project manager</strong> keeps the project on track.</li><li>The <strong>clinician</strong> brings knowledge about the complexity of everyday reality in the hospital.</li><li><strong>Data scientists and researcher engineers</strong> formulate and test assumptions on the data and also know how to train and validate machine learning models.</li><li>The <strong>clinical information manager </strong>understands clinical research and bridges the gap between clinicians and researchers.</li><li><strong>Operations engineers </strong>implement the clinical solution in a robust and scalable way.</li></ul><p>Having a band that works closely together means everything can be much more dynamic. As Eyal discovered, this flexibility is absolutely essential.</p><h3>Dynamic problem solving: The mission always changes along the way</h3><p>In university studies, the problem you’re working on is often fixed. But Eyal and the band found that they very often make discoveries along the way. And because those discoveries improve their understanding of the problem, they often change the clinical mission.</p><p>The band is very well suited to adjust to these changes. One reason is Zebra Medical Vision’s technological backbone, which allows them to work fast and to easily modify and rerun experiments — without starting from scratch.</p><p>With all this infrastructure and this team in place, Zebra Medical Vision can move at a dazzling pace. They’re already on their way to their seventh FDA-approved diagnostic solution, with more coming soon.</p><p>Now let’s look at two examples of diagnostic solutions Eyal and his team developed, and find out what they learned along the way.</p><h3>The difference between real-world and research approaches to medical image solutions</h3><h3>Example 1: Early warning for coronary artery disease</h3><p>Half of all cardiovascular-related deaths are due to coronary artery disease. Cellular waste products, proteins, and calcium stick to blood vessel walls and combine with fat to form plaque. If this happens in the arteries that supply blood to the heart muscle, then it can limit or stop the supply of oxygen to the heart and cause a heart attack.</p><p>Unfortunately, the buildup of calcifications in coronary arteries is often only diagnosed <strong>after</strong> a heart attack or similar cardiac event.</p><p><strong>The academic research approach</strong>: When Zebra Medical Vision looked into this problem, they found an academic paper saying that <strong>if you </strong>manually segment the areas of interest, and have a gated CT scan (a scan focused only on the heart), and measure with and without contrast in a specific protocol, <strong>then</strong> you could build a model that can provide the equivalent of the Agatston score (a risk measurement from 0 (low risk) to 400 (very high risk)).</p><p>Essentially this is a segmentation problem: you segment the white clouds of calcification in the coronary arteries.</p><p><strong>The problem with this approach</strong>: This particular CT scan protocol is something you would only run on a patient who is already known to have a risk of a heart attack. And therefore, this would not help all the other patients who are at risk but have no symptoms yet.</p><p>Considering how few patients have symptoms before a heart attack, it would be more helpful to find a way to diagnose a much larger group of patients.</p><p><strong>The more practical approach: </strong>Zebra Medical Vision realized that patients get CT scans for many other diseases. These so-called untargeted or ungated scans can include many organs, and also the heart. Eyal and his team found an approach where they could take these much more frequent scans and still achieve a similar accuracy — in predicting risk for heart disease — to the model that the researchers build for the targeted scans.</p><p>This means doctors now have an early-warning system for heart disease running in the background. This system automatically alerts them if a patient is high risk — even though they took the scan for another reason and may never have looked at the heart. Hence many patients are diagnosed earlier and receive preventive treatment.</p><p>Today this is one of Zebra Medical Vision’s leading solutions, and it’s proven to be effective on a large part of the population. It has even outperformed other solutions that only work on gated CT scans.</p><h3>Example 2: Vertebral compression fractures</h3><p>Early diagnosis and treatment for osteoporosis is essential. But vertebral compression fractures — a reliable symptom of osteoporosis — are often missed during routine exams.</p><p>Vertebral compression fractures (VCFs) — a condition in which part of a vertebra bone in the spine collapses — are often simply ignored by radiologists. It’s not part of their standard workflow, the diagnosis is often not acute, and they’re tedious to diagnose: The radiologist has to check another section of the scan and then compare each vertebra’s height to its baseline height. In the end, 75% of all VCFs go undiagnosed or unreported.</p><p>But most people in high-risk groups already have a scan somewhere on file. That means the pixels are there and the compression fractures are already captured in the data — they’re just not reported.</p><p>Even though the problem isn’t sexy and doesn’t receive much attention, the benefits of diagnosing VCFs — and consequently osteoporosis — are immense for the patients. For example, 50% of patients who fracture a hip die of complications in the next 10 years. Then there’s also the immense burden of rehabilitation.</p><p>So Zebra Medical Vision built an algorithm that locates and identifies these compression factors. This helps the clinicians who really care, who deal with osteoporosis prevention and treatment programs, to identify patients with VCFs.</p><p>Now hospitals that run screening programs on patients who are at risk of osteoporosis can run this model in the background and are automatically alerted to patients who likely have a fracture. Then doctors can confirm these cases with a manual check.</p><p>As Eyal says, “Sometimes we look at the problems that are meaningful and not sexy.” This is exactly the kind of opportunity you find when you look at large datasets with an exploratory mindset — a data scientist’s mindset.</p><h3>Accomplishing the impossible with naive optimism</h3><p>In May 2014, at the very beginning, Eyal and his colleagues went to a radiology conference in Dallas. Everyone told them: “There will never be anything like machine vision in radiology. That’s a fantasy. You’re nice Israeli guys. Enjoy your vacation, go back to Israel, and find something else to do.”</p><p>But their naïve optimism saved them. Eyal and his co-founder thought they could solve this problem, and fast. In the end, even if it took a bit longer, it would be an extremely meaningful challenge, and the impact and value of the project would be undeniable.</p><p>This mindset pushed them on through myriad challenges. But as Eyal said, “You need to be extremely stupid — in a positive way.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34b385617b65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-zebra-medical-vision-developed-clinical-ai-solutions-34b385617b65">How Zebra Medical Vision Developed Clinical AI Solutions</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[MLOps for Research Teams]]></title>
            <link>https://medium.com/data-science/mlops-for-research-teams-9d58ee8759f5?source=rss-902b7c650a38------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d58ee8759f5</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[feature-store]]></category>
            <dc:creator><![CDATA[Markus Schmitt]]></dc:creator>
            <pubDate>Mon, 22 Mar 2021 13:00:53 GMT</pubDate>
            <atom:updated>2021-05-07T13:54:49.286Z</atom:updated>
            <content:encoded><![CDATA[<h4>Ensuring your team’s work is reproducible, accountable, collaborative, and continuous</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fnT3Ow0JL4Hw69OxtyFnKQ.png" /><figcaption>Source: Author</figcaption></figure><p>Machine learning teams often face the same challenges. <strong>MLOps</strong> is a set of processes most machine learning teams should follow to address these problems.</p><p>To make MLOps more concrete, we’ll look at what problems it solves for research teams.</p><h3>Why does your team need MLOps?</h3><p>Many machine learning teams focus on building novel algorithms or on training high-performing models. While these are fundamental components of any machine learning solution, they’re relatively small compared to all the surrounding processes needed in a real solution, such as data engineering and monitoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*LnxEIwL4aIwcWXr2.png" /><figcaption>The algorithmic code is only a small component of any machine learning solution. Source: Author — inspired by <a href="https://papers.nips.cc/paper/2015/file/86df7dcfd896fcaf2674f757a2463eba-Paper.pdf">Hidden Technical Debt in Machine Learning Systems</a>.</figcaption></figure><p>Research teams tend to focus more on the machine learning code than the surrounding infrastructure. With an increasing need to collaborate, share results, and re-use work done on large datasets, research teams quickly reach the limit of this approach. MLOps solves these problems and allows research teams to achieve their goals despite the complexity that comes from dealing with large datasets, code, and machine learning models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TrgiYMftv-zrSNkk.png" /><figcaption>MLOps goals align well with the needs of research teams. Source: Author</figcaption></figure><h3>What challenges might you face without an MLOps architecture?</h3><h3>Challenge #1: You can’t rebuild existing models</h3><p>Your team has a trained model that works well but can’t be rebuilt. Data and software versions have changed, or the team member who set up the training pipeline on their local machine has left. Your team can share the trained model file directly but you can’t improve or update it, because some of the steps to build it are now lost.</p><h3>Challenge #2: You can’t effectively audit or monitor your models</h3><p>The results of your team’s model were excellent at an evaluation stage. But there is no ongoing auditing or monitoring to ensure the model’s predictions still make sense. Your team needs to exercise a blind faith that the model is operating as expected.</p><h3>Challenge #3: You can’t easily share models</h3><p>Each member of your team has built their own pipeline to manage data and train models. It’s difficult to collaborate or share results because you can’t easily work on each other’s models, or re-use each other’s intermediate data.</p><h3>Challenge #4: Your proof-of-concept looked promising but training at scale crashes your hardware</h3><p>You were able to train your model on a small dataset on your laptop, but it’s difficult to scale, either by pushing it out to a more powerful machine or by taking advantage of compute clusters.</p><p>This means translating the proof-of-concept to a production solution takes significant effort.</p><h3>Challenge #5 You find errors too late</h3><p>Because your team builds infrastructure and glue code from scratch for each project, bugs and other issues occur frequently and are often only caught after results have been released. The same problems reoccur for each project because you can’t easily re-use code.</p><h3>How can MLOps architecture address these challenges?</h3><p>Implementing MLOps practices and using a standardized architecture can help solve all of these challenges. Most machine learning teams should have an architecture that includes the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*31SFcdH2_HITWCr0.png" /><figcaption>Our MLOps architecture consists of several integrated components that together address the difficulties most teams face. Source: Author</figcaption></figure><h3>An experimentation hub</h3><p>An experimentation hub lets your researchers develop notebooks, experiment with new models and architectures, and validate hypotheses. It helps team members share code and ensures they can reproduce each other’s models.</p><p>You only need to set things up once because you’re all working in the same environment. The shared hub prevents headaches over hardware-specific issues, like team members using different operating systems or having underpowered development machines.</p><p>We use <strong>JupyterHub</strong>.</p><h3>A model registry and experiment tracker</h3><p>A model registry stores each model your team produces with a name and one or more versions. An experiment tracker is similar but works at a higher level: defining names, versions, and metadata for your team’s experiments.</p><p>By storing and versioning every single model and experiment your team produces, you can always reproduce results performed in a specific experiment. You won’t be blocked because you don’t know which model produced specific results or what parameters you used for a historical experiment.</p><p>This will also help you comply with any necessary legal requirements to justify your results.</p><p>We use <strong>MLFlow</strong>.</p><h3>A model serving tool</h3><p>A model serving tool automatically deploys your model to staging or production environments and makes a unified API accessible to your team and your end users.</p><p>A unified API and infrastructure across all of your models make it easier to use and monitor them. Automatically deploying your models to staging and production environments means the latest versions can be put to use immediately.</p><p>We use <strong>Seldon</strong>.</p><h3>A dataflow tool</h3><p>A dataflow tool keeps track of every step in your pipelines, and can monitor and rerun steps as required. This helps prevent cases in which a model can’t be rebuilt, because you can easily rerun the exact same steps you used each time.</p><p>It also saves your teams’ time and prevents human errors in any repetitive work.</p><p>We use <strong>Prefect</strong>.</p><h3>A feature store</h3><p>Sometimes your team needs the exact features used to train a specific model but the underlying data has since changed. Or maybe you’ve spent time building specific features and now want to re-use these for a new model. A feature store keeps versions of every feature for your team to re-use and therefore collaborate more easily.</p><p>We use <strong>FEAST</strong>.</p><h3>Is MLOps ‘nice-to-have’ or is it essential?</h3><p>While some research teams still operate without MLOps tools or best practices, we believe MLOps has become an essential ingredient for nearly all teams. Unless your team is very small or working only on trivial problems, your machine learning research also needs to be <strong>reproducible, accountable, collaborative, </strong>and <strong>continuous. </strong>Without MLOps, meeting these goals is very challenging.</p><h3>Do you need help setting up MLOps in your research team?</h3><p>We love finding the right MLOps architecture for machine learning research teams. <a href="https://datarevenue.com/en-contact">Contact us</a> to find out more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d58ee8759f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/mlops-for-research-teams-9d58ee8759f5">MLOps for Research Teams</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>