<?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 Jeroen Franse on Medium]]></title>
        <description><![CDATA[Stories by Jeroen Franse on Medium]]></description>
        <link>https://medium.com/@jeroen.franse?source=rss-83972347a3ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Jeroen Franse on Medium</title>
            <link>https://medium.com/@jeroen.franse?source=rss-83972347a3ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 20:04:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeroen.franse/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[BookFlow]]></title>
            <link>https://medium.com/@jeroen.franse/bookflow-4e0c1662ddcc?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e0c1662ddcc</guid>
            <category><![CDATA[mlflow]]></category>
            <category><![CDATA[academic-writing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 20:09:38 GMT</pubDate>
            <atom:updated>2020-10-29T20:09:38.245Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let your reports auto-update to your code’s results</h3><p>This is something I’ve been wanting to create for a long time. Only this year I’ve really started looking into it, and quite recently my enthusiasm was sparked anew by the release of Jupyter Book. So here it is, and I dub thee “<a href="http://bookflow.jeroenfranse.com/">BookFlow</a>”!</p><p>BookFlow is a combination of a certain workflow and some tools. My current guide uses MLFlow and Jupyter Book. I am also working on a version with MLFlow and R Bookdown. This Jupyter Book version is a bit of a smoother experience I think and has a lot of cool and powerful features, as long as you stick to the html output. It can also output pdf and Latex, but if those are your primary formats you should go for R Bookdown because that looks better and gives you way more control (R Bookdown also has additional formats over Jupyter Book). Otherwise all the principles are the same.</p><p>Don’t think that just because it includes the acronym “ML” in one of the tools, BookFlow is only useful for machine learning practitioners! In fact, it’s useful for anyone that works with both code and data and sometimes has to communicate the results. Data scientists, academics, analysts and statisticians in any field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*6KAkcNsXE9E21wHiySszMw.png" /></figure><h3>The Point of BookFlow</h3><p>The goal of BookFlow is to have both your runs and your documents in version control, connect them, and have your reports automatically update to new runs. That means:</p><ol><li>Never having to manually update the numbers, tables and figures in your papers or reports after you’ve made a change in your code and your results changed.</li><li>You are always sure that the numbers, tables and figures in your documents match with your most recent run (and are in fact from the same run!).</li><li>In fact we will <em>track</em> which code and which runs created which versions of the documents. Never will you be in doubt when someone asks you “are these the most recent numbers?”. And when someone shows you an old report and asks you pesky questions, you will know exactly how old it is and what’s wrong with it.</li><li>You can always reproduce the code and the results of any old report.</li><li>Obviously, your documents are version controlled, so that makes editing and collaborating much easier.</li></ol><h3>Sneakpeak</h3><p>You can find the entire guide at <a href="http://bookflow.jeroenfranse.com/">bookflow.jeroenfranse.com</a>, but here is a sneak peak:</p><ol><li>pip install -U mlflow jupyter-book jupytext</li><li>write your code as normal, add mlflow logging, and run it</li><li>write your report in the MyST format, which allows you to paste variables and plots from your mlflow runs with a few simple tricks</li><li>compile your report with a single command</li><li>when you have a new run, simple recompile the report</li></ol><p>It’s really mostly that simple. Only step 3 has a few more details regarding first-time set-up, but after that step 5 is all you need for your daily workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e0c1662ddcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting my MLOps Thoughts Straight]]></title>
            <link>https://medium.com/@jeroen.franse/getting-my-mlops-thoughts-straight-14434aa1a17c?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/14434aa1a17c</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Fri, 29 May 2020 14:57:30 GMT</pubDate>
            <atom:updated>2020-05-29T14:57:30.494Z</atom:updated>
            <content:encoded><![CDATA[<p>MLOps has a lot of moving parts, I’m trying to make sure I’ve given them all a spot in my thoughts.</p><p><em>(as I expect my thoughts will develop, I will maintain this document on my </em><a href="https://github.com/jfranse/MLOps_problem_definition/blob/master/MLOps_problem_definition.md"><em>github</em></a><em>, which displays the multilevel lists properly as well)</em></p><h3>Introduction</h3><p>I’ve written one blogpost about MLOps previously, which was like an introduction to the subject I guess. Both for me and for the reader. I talked about some ideas for making the data scientist’s work more efficient, more reliable and more enjoyable.</p><p>But there are so many moving parts to developing and productionalizing machine learning, that I wanted to set down all my ideas as clearly and concretely as possible, in maximum detail stopping just short of actually going into the technology.</p><p>I’m basing the ideas in this post upon my thoughts and frustrations build up over let’s say 8 years of working with data and code. On purpose I’m trying to not let myself be influenced too much (yet!) by the big players’ technology and platforms. I feel that this is the best way to judge later where there are gaps in my understanding or assessment and where there are gaps in the technology that’s on offer.</p><p>So what you will find below is a bit like a problem definition, and it’s an exercise as much for my own sake as for anyone else’s. I will try to define as exactly as possible all the tasks that a data scientist does that are related to model development and maintenance, and which will need to be covered by our MLOps method (tech platform plus way of working).</p><p>Ideally, this definition should be complete enough to allow someone to design and build this method without missing any important features. Because I believe that if your method does not cover all the modes of working, then your data scientists will need to work around your method and you’ll end up with shadow systems, quick hacks and technological debt that will cancel out all the progress you thought you were making.<br><br>Another reason to do this, is so that it may help us explain succinctly and accurately why it is so important to practice MLOps, and why MLOps is so complex, and why existing software development methods and existing IT infrastructure are usually not sufficient.<br><br>So let’s see how far we can get.</p><p>This will probably be a series of posts. At the moment, there are 3 major subjects I think should be tackled.</p><ol><li>Code reuseability. Your ML pipeline consists of many functional parts, let’s say; ingestion, data engineering, model building, training, inference, evaluation. Most of these functional parts appear multiple times in different combinations at different stages throughout your project. It is not just efficient to reuse those pieces of code, it is imperative in order to make sure every functional instance is doing the same thing. If you are not sure that the inference code at training time is the same as at serving time, you open yourself up to a world of pain.</li><li>Debugging and analysis of models. Even if the pipeline does not crash (in particular when the pipeline does not crash), it must be possible, nay easy, to look into your model or pipeline at the smallest detail, and be able to compare it at that level to other versions. Coming up with the infrastructure required to facilitate this in a generic way that does not compromise the integrity of our pipeline is very difficult. (what I mean is, debugging and analysis should require as little custom code to access the details as possible, because every bit of custom code takes you further away from reproducibility and robustness)</li><li>Workflows and tracking. A single model pipeline looks trivial enough to manage, even through into production serving, but most of my projects tend to explode in complexity in terms of versions, experiments, configurations, datasets and variations very quickly. Management of these has to follow all workflow tasks, always allowing for more generalization of your pipelines and models.</li></ol><p>I will start with this last one. It is possibly the ‘easiest’ thing to fix, because there are not a lot of dilemma’s (as opposed to the first two), and may be seen as ‘simply’ automating the work. Also, the overview of the workflow will help the most in communicating the nature of the complexity of running an ML organisation.</p><h3>Single Model Workflow Description</h3><p>First I will describe a typical workflow, in somewhat excruciating detail. None of this will be surprising, but I need it as a starting point.</p><ol><li>Let’s say at this point we already have a repository with some working code that produces a working model. I also have the location of the (training) data and can access it.</li><li>Now I want to continue to develop my pipeline and model. I need an environment to do this is, which I will call ‘dev’. This dev environment can be my local machine (in which case I need to set it up myself), or some cloud/on-prem compute resource (in which case it would be nice if there is some compute provisioning service that can manage my environment as well).</li><li>In my dev environment, I can write and try out new code, start pipeline runs (which should be tracked), create pipeline configurations (which should also be tracked), and analyse the results of my runs and compare them to other runs, at the highest detail level.</li><li>When I’m somewhat happy with my new changes, I want to do some hyperparameter optimization (HPO). I define my search space and search strategy (which should be tracked), and then I give my pipeline to the HPO service. I do not need to make major change to my code in order for the HPO service to pick up my pipeline. The HPO service kicks off many runs automatically and tracks them all.</li><li>In my dev environment, I explore the results of the HPO. At first I just need to compare parameters and metrics. I will do this often, so it will be nice to have a set of tools or libraries that I can reuse. Then, I will probably want to compare a couple of models in more detail, at the level of the resulting datasets. Also for this it would be nice to have a set of tools for this.</li><li>As expected, occasionally I need to do some model debugging when my pipelines produce models that do not behave as I would expect. For this, I want to be able to load the entire state of the pipeline in a notebook-like interface.</li><li>After a while developing and testing, I am confident enough in my model that I want to deploy it. Because I know I will always have to update a model at some point, model deployment always happens through a retraining and deployment service. I give the retraining service my model and config (which were already tracked of course), and also give it a retraining schedule (which will be tracked).</li><li>The retraining service will kick off a pipeline run according to the schedule, which will be tracked. After training completes, the retraining service checks the model for quality (the checks I have coded up, and the threshold I have configured are tracked). The retraining service logs the results of these checks, and sends messages if needed.</li><li>If the model passed the tests, the retraining service will instruct the deployment &amp; serving service. It will provide the code, the configuration and the trained model. The service will deploy the model so that it can be approached through an API endpoint(s). The deployment and serving service may receive specific instructions or configurations for more complicated serving strategies. All served results will be tracked.</li><li>There is also a monitoring service, that is instructed to monitor the newly deployed model (or detects this automatically). It monitors the quality of the consequtive retraining runs and models, and of the served results. There is a dashboard for this. It may compute additional metrics over multiple models.</li></ol><p>The ordering of these points, as you have guessed, is not absolute. You will come back to various steps at different times.<br><br>I am assuming here that all my trackers (versioning of code, data and models/runs) are set up, and when you develop your pipeline code, you know from the beginning to incorporate them. The setup described here already allows for CI/CD/CT. So are we done? No, I think that there are 2 more additional layers of complexity. And I think that it is important to make this very explicit, because only that will enable us to identify what our MLOps method should be able to do.</p><h4>Level Up: parallel versions</h4><p>This level is a bit obvious of course. CI/CD/CT implies it. The workflow described above is always being executed simultaneously multiple times in parallel, with many versions at different stages in this workflow at the same time. I mention this as a seperate level of complexity, because the parallel versions are not independent of each other. In CI/CD in the development of non-ML software, each version (even forks) may be considered to be more or less independent; each subsequent version supersedes the last version for most intents and purposes. In MLOps, however, each version and each run are in themselves important data points and we want to be able to compare the results of any pipeline runs at any time. Because an ML pipeline run is defined not just by code version, but also by data version and pipeline/model configuration (and random seed), this puts additional requirements on the infrastructure and on the management of our versions and configs.</p><h4>Level Up: subprojects</h4><p>This is something that tends to happen even when you really did not expect it when you started model development: you end up with multiple variations of your model that will be used for similar but slightly different purposes. An obvious example is if you’re creating forecasts of ticket sales for example, and you end up with 5 different forecast models for 5 different ticket categories. I will call this phenomenon ‘subprojects’, in order to distinguish them from ‘versions’. So a Subproject is where you use the same code but with different configurations in order to produce separate models that will be served side by side for different purposes.<br><br>This level up actually does create a new hierarchy level for tracking and management. This hierarchy should be as much a possible defined ‘as code’, because you may end up with hundreds or thousands of functional variations and they all need lifecycle management. The good thing is that the lifecycle management of the subprojects is probably very similar, so should be easy to automate.</p><h3>Project and Object Hierarchies</h3><p>It&#39;s going to be useful to be clear about the terms that we are using, and it will also help the overviews we are going to create later to get a sense of hierarchies between entities.</p><p>(apologies that these are pictures, Medium doesn’t do multi-level bullets)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*nYdyVEAbagIx_Qj7V_c1SQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*SmAQcwu3jeBGRj2o6QRR4A.png" /></figure><p>There is something we have not talked about yet. Cross-validation. Because all results are always a sensitive function of your dataset, your model&#39;s capability to generalize is always uncertain to some degree. In cross-validation you create multiple permutations of your dataset and observe how your results change. This provides a sense of how your live data may change (under a number of strong assumptions). <br><br>Cross-validation does not really complicate this hierarchy further. You will have multiple runs for a specific configuration, each run corresponding to different permutations of your dataset, as we&#39;ve already noted. If there&#39;s one place where cross-validation happens, it&#39;s during the hyper-parameter optimization. Analysis of the HPO results always involves analyses of the <em>distribution</em> of the results for each configuration.</p><h3>Creating Some Overview</h3><p>Now we&#39;re probably on the same page so far I hope. As I said, I think it&#39;s important to have a good definition of the problem. An interpretable definition will benefit from some visuals as well. The following schema details which things (code, objects, artefacts) live in which environments and at what time. <br><br>I&#39;ve made two schematic views that tie the hierarchy and the workflow already described above together in different ways. I&#39;m trying to show:</p><ul><li>that you are working with many versions at the same time</li><li>which things we need to keep track of</li><li>how the things we need to keep track of relate to each other</li><li>some suggestions for which objects, environments or services can or should be managed. In other words, which actions by the data scientist should be supported at what level.</li><li>which information is needed where and when</li></ul><p>What I&#39;m <em>not</em> trying to do:</p><ul><li>show the data flow (already covered in previous post)</li><li>show the tracking of runs, models and data in too much detail (this was also in my previous post)</li><li>show stages of deployed models (meaning that in reality you would have multiple simultaneous versions in the retrainer and server environments. This enables controlled releases and advanced deployment strategies. )</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DIN4E7qyMUgSUYN-egdFGQ.jpeg" /></figure><p>I hope the schema is somewhat intuitive, but here is some explanation. Of course, this is a bit of a simplified example. I&#39;ve separate the rows into the different environments/services; dev, HPO, Retrainer, Serving and Monitoring. The columns indicate an example of time going forward. The colors indicate all objects associated with a particular version of the code. So in week 3, version 3 lives in the dev environment, some feature branch (that will be abandoned later) lives in the HPO environment, and v1 lives in the retrainer/serving/monitoring service.<br><br>Some notes:</p><ul><li>In the dev environment, we want to be able to compare runs and models, also between versions. In that sense, multiple versions live in the dev environment at the same time.</li><li>In the HPO environment, there is nothing stopping you from running many versions (branches) of the code at the same time. This is not shown in the schema for simplicity. The HPO service will run separate containers anyway.</li><li>The search space definition I consider here to be &#39;constant&#39; over the versions. After all, even if I change the configuration of my HPO search space between HPO run, all of those runs combined still span the same parameter space. If a new version of the code adds more parameters, or significantly changes how something works, one may consider this either as a new parameter space, or as an extension of the parameter space with an extra binary dimension.</li><li>All configs of all runs are stored, and therefore the &#39;best config&#39;, the one that will be deployed, is stored by definition as well. But in addition, it should be tracked which configs were considered best and when they were deployed.</li><li>The retraining schedule is independent from code version or runs. There should be a configuration file for it, which should be managed, but the updating of it will usually not be related to code or model development.</li><li>The monitoring service probably reuses some evaluation code from the repository, which is why it is indicated in the schema that it is related to a particular version of the code.</li><li>Troubleshooting happens in the dev environment. Based on observations made about the models that are deployed, there will most likely be occasions when unexpected or undesirable behaviours happen. When this is the case, troubleshooting will happen by loading up the model and the pipeline in the dev (or dev-like) environment, and comparing the model, the results its serving, the results from its training to the nominal version of that model (same code, same config, different training data, the last model trained during development).</li></ul><p>The next schematic focuses more on the actions of the data scientist, the control flow, and the passing of information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-9dWafs3HhBuggHFNh6Gw.jpeg" /></figure><p>This diagram has some suggestion of time flowing toward the right, but again, you will probably find yourself going back and forth at will, especially if you have many versions or subprojects.</p><p>Some explanations:</p><ul><li>the Tracker is a single service in this view (although it doesn&#39;t have to be) that tracks all runs, models, results, metrics, etc. This should be a familiar concept by new.</li><li>the &#39;project manager&#39; is a service that organizes the hierarchy that we talked above earlier. It will help you keep an overview of all these objects. Which subprojects are part of this project, what are their subproject configurations, what are their associated schedules and deployment configs, what is the current best pipeline (run) config, etc.</li><li>the run, check and model objects (the diamond symbols) are (pieces of) your pipeline that have to run in a specific environment of packages.</li><li>every circle is an activity performed by a data scientist</li><li>the top half of the diagram is some sort of development environment, where the data scientist is free to write, run and debug code with the greatest possible freedom. It is also a place to analyse results and models, because of this freedom. If there are notebooks involved anyway, it is here.</li><li>the bottom half of the diagram are the &#39;production services&#39;. These services are part of your MLOps platform, and managed by a central platform team in your organization (or something like that). This is the automated production layer of your ML operations. The data scientist does not have to write any code to perform HPO, retraining, deployment, serving or other lifecycle management duties.</li></ul><p>That last thing might be the crux of the definition of the MLOps problem. Everything on the top of the diagram is done by the data scientist by coding. Everything on the bottom is automated. So, if a data scientist wants to run HPO, they only need to tell the HPO service which code version to use, the subproject ID, and which search space configuration. Then the service finds all the objects associated in the &#39;project manager&#39;, creates the environments (containers, f.e.) for the runs, starts and tracks them. <br><br>When a data scientist creates the configurations (run config, search space config, schedule, deployment config), they do it by code and associate those to the proper hierarchy by code. Because maybe they want to create 1000 subprojects, which will have to be managed. Even if it&#39;s just a handful, you should still do that by code and not by hand or GUI. The association is also important, because that way the project manager will be able to provide the production services with the correct objects, without the data scientist needing to manually supply the objects. So again, if a data scientist wants to deploy a model, they only need to provide to the project manager the code version, the subproject ID, and which Stage to deploy in, because they have already created and associated the subproject config, schedule, best run config, and deployment configuration to the (each) subprobect.</p><h3>Final remarks</h3><p>I&#39;ve made this overview or problem definitions to help myself. With this, I can either build/design my own MLOps method, or be properly informed if I shop for one. I can also overwhelm anyone that doubts the need of proper ML infrastructure and organization with diagrams now. <br><br>Of course this is work in progress. I am in fact going to use it in the near future for implementing MLOps in a large enterprise structure. I look forward to the lessons I will learn while doing that, but I am happy that I can go into that with a clear vocabulary and vision of my own so that my thinking won&#39;t be limited by the standard services on offer by the cloud provider of choice.<br><br>I will keep writing about MLOps as my understanding and ideas develop, and will appreciate any feedback from other ML(Ops) practitioners.<br><br>Last caveat; I repeatedly mention that everything should be tracked. Of course this no longer holds if there are privacy or security concerns.</p><p><em>(as I expect my thoughts will develop, I will maintain this document on my github, which displays the multilevel lists properly as well: </em><a href="https://github.com/jfranse/MLOps_problem_definition"><em>https://github.com/jfranse/MLOps_problem_definition</em></a><em>)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14434aa1a17c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Responsible ML Workflow — Paper Summary]]></title>
            <link>https://medium.com/@jeroen.franse/responsible-ml-workflow-paper-summary-8f3c72344018?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f3c72344018</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[responsible-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[explainable-ai]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Mon, 16 Mar 2020 17:28:16 GMT</pubDate>
            <atom:updated>2020-03-18T17:11:28.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>Responsible ML Workflow — Paper Summary</h3><p>I recently came across this paper on LinkedIn, which I thought was a particularly valuable source, both in itself and for further reading. I enjoyed reading it and learned a lot of new things, made a summary for myself and figured I would share it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Y9UTSD3xCuUV9evdvKpDMg.jpeg" /></figure><p>You can find the paper <a href="https://www.mdpi.com/2078-2489/11/3/137">here</a> and it&#39;s about responsible machine learning (ML), obviously, a subject that is very close to my heart. It has suggestions for how one can go about it practically along with an example case study, and focuses mainly on (as the title says) interpretable models, post-hoc explanations and discrimination testing. All figures in this post are taken directly from the paper.<br><br>The area of responsible AI is gaining more and more traction and attention. I think this is a very good thing. In this post I will not try to convince you why it is important or how important it is, I will merely say that the application of AI/ML brings with it the potential for large risks in the areas of discrimination, privacy, transparency and security, and assume that the interested reader is indeed interested for precisely those reasons.<br><br>As the authors note, the field is amorphous and vague and despite the increase in written and spoken communication and material about it, the practical application of responsible AI seems to be fraught with uncertainty. The authors express they hope this paper helps give practical handholds, and I am inclined to say that they succeeded in that.<br><br>I&#39;ll start with the flowchart from the paper depicting an example responsible ML workflow. None of it should come as a surprise, and I won&#39;t go into much detail about this chart, but it is a very valuable chart because it is complicated to take care of this entire flow well, and easy to lose sight of when you are in the trenches of development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4g9ps8ay9To4Vs-AuGM5w.png" /><figcaption>More details regarding this figure at <a href="https://github.com/jphall663/hc_ml">https://github.com/jphall663/hc_ml</a></figcaption></figure><p>The paper focuses, as said in the title, on the orange boxes. It does so in the order indicated by the flow, and uses both a simulated dataset with known properties, and the HMDA mortgage dataset.</p><p><strong>Constrained and interpretable models</strong></p><p>Step 1: to prevent undesirable behaviour from black-box models, simply make the box less dark. We know that throwing XGBoost or autoML at a problem is likely to give us the best accuracy vs coding effort trade-off, but the authors show that at least for these two datasets using uninterpretable models does not offer convincing accuracy benefits. They show this using the following models:</p><ul><li>an unconstrained gradient boosting machine (GBM) and a monotonically constrained GBM (MGBM). An MGBM simply put just makes sure that the function that represents a single tree is always a monotonic function with regard to the tree&#39;s input.</li><li>a &#39;normal&#39; artificial neural network (ANN) and an explainable neural network (XNN). The output of an XNN is essentially a linear combination of K functions, where each function k has one input and one output, and the input is a linear combination of features. Each function k is itself also a neural network, but I repeat it&#39;s 1-d function, so the purpose is to be able for each subnetwork (function k) to have the freedom to become a suitable simple analytic function. It&#39;s trained with large L1 regularization so that the input linear combinations for the functions k consist of only a few significant contributors.</li></ul><p>The tables of fit results for both the simulated data and the mortgage data are below, but the short story is that the MGBM is at most 3.5% worse than the GBM, and the XNN at most 1% worse and in some cases actually a little better than the generic ANN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*qNRlqKkfoxNlO5w6Nul2Dg.png" /></figure><p>So far we&#39;ve claimed that these constrained models were more interpretable mostly by saying that the resulting learned functions are less complex. This sounds plausible, but let&#39;s eat the pudding and see if we actually like it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1nkB7BC9jvJ--mmCDhPniA.png" /></figure><p>This is the interpretability view of the XNN trained on the simulated dataset. On top are the weights in the output layer of each subnetwork, bigger weights indicate more important functions. Then, in the middle, are the most important actual subnetwork functions. Note that this is an exact representation, each function has 1 input and 1 output. And on the bottom, for each subnetwork, the input weights for the linear combination of features. <br><br>Now, I&#39;m showing you the model trained on the simulated dataset, because then we can check these interpretability results against a known ground truth analytical function. That function is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cIsC9b1TJ7NG7SMQuSQy1A.png" /></figure><p>and the authors added 2 binary features and 1 categorical feature to that. So we can see in the figure that subnetwork 1 has learned to represent the square of feature 3, subnetwork 4 has successfully learned the correct relative contributions of features 4 and 5, and subnetworks 7, 8 and 9 together approximate the sine of features 1 and 2. So yes, I think this is a nice and accurate way to try to interpret this model.<br><br>Of course, we cannot make a plot like this for the MGBM, the paper uses Partial Dependency (PD) and Individual Conditional Expectation (ICE) plots instead. If we&#39;re talking about &quot;explanation&quot; vs &quot;interpretation&quot;, I think PD&#39;s and ICE&#39;s are a bit ambiguous in that regard. You have to use data to create them, just like post-hoc explanations, but you don&#39;t use PD&#39;s and ICE&#39;s to check individual predictions, you use them to interpret what your model is doing. So let&#39;s keep them in this section then. What are PD&#39;s and ICE&#39;s?<br><br>Conceptually PD&#39;s are pretty straightforward, you just marginalize over all but one input features so you get the 1-dimensional behaviour of your model with respect to that one unmarginalized variable. Put another way, you take your dataset and set your chosen feature to some fixed value, the same value for each datapoint, and apply your learned model to this change dataset, and take the average of the output. Repeat for a bunch of values for the chosen feature, and you have the 1-dimensional plot as function of the chosen feature. <br><br>PD&#39;s have problems if there are strong correlations or interactions (as you may be able to imagine), so you can never use them on their own. This is where the ICE&#39;s come in. You are going to plot the ICE in the same graph as the PD, because both of them map a value of the chosen input feature to the model output. However, 1 ICE only applies to 1 datapoint, and you just change the value of your chosen input feature for that 1 data point and see how the output changes. Now, what is the added value of plotting 1 data point like this? None. The trick is to take a number of individual data points and their ICE, and you pick them in such a way that you sample the output space of the model. Below, you can see a example from the paper, they pick 10 data points along the percentiles of the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KBcvfb3ZkTn2sNwFCyJqQ.png" /></figure><p>In plots like this, you can observe the general behaviour of your model as a function of a single parameter. This is nice and interpretable, if both PD and ICE&#39;s are well behaved. If they are not, i.e. the PD and ICE curves diverge, that is a sign that you have strong correlations or interactions, and apparently fluctuating ICE&#39;s can also be a sign of overfitting or leakage from strongly non-monotonic signals in constrained features into non-constrained features. Lastly, it is informative to put the distribution of the feature values in a histogram below the PD/ICE plot, so that you can check the behaviour of the model in sparse regions.<br><br>I like this method as well, it contains a lot of information in a single view that is still pretty straightforward to read. So we see that having an interpretable model comes down to constraining the space of allowed functions <em>coupled</em> to a suitably understandable view. You cannot have an interpretable view without a constrained model, and a constrained model without a suitable view is not interpretable. <br><br>It may seem very restricting, but I like to remember this paragraph from <a href="https://arxiv.org/abs/1412.6572">Goodfellow, Shlens &amp; Szegedy (2015)</a>:</p><blockquote>&quot;[...] LSTMs (Hochreiter &amp;Schmidhuber, 1997), ReLUs (Jarrett et al., 2009; Glorot et al., 2011), and maxout networks (Goodfellow et al., 2013c) are all intentionally designed to behave in very linear ways, so that they are easier to optimize. More nonlinear models such as sigmoid networks are carefully tuned to spend most of their time in the non-saturating, more linear regime for the same reason. [...]&quot;</blockquote><h3>Post-hoc explanations</h3><p>Step 2: so you think you know what your model is doing, let&#39;s check that with global and local explanations. Also, this can be a feature that is nice, useful or even required for your users (for appeal and redress f.e.). The authors go all-in on Shapley values for their post-hoc explanations instead of, for example, LIME, because they are apparently the only known locally accurate and globally consistent explanations. What that means is that a) the individual explanation values per feature for an individual explanation always sum to the actual model output and b) that explanation values change in the correct direction when the model changes.</p><p>Conceptually and theoretically, the explanation values are computed by taking all possible subsets of input features, and for feature j check the difference of the model output between each pair of subsets that only differ by inclusion/exclusion of j. I don&#39;t know about you, but although this makes sense to me on an abstract level, on a practical level I don&#39;t really have a feel for it yet (unlike LIME, which is very intuitive to me, but suffers from some downsides - probably good for a whole separate blog post). In practice however, you need more tractable algorithms to compute Shapley values (which are supplied in many packages) that I don&#39;t know anything about yet.<br><br>Point is, you can easily compute SHAP (Shapley Additive Explanations) nowadays for your models, and you should. Apart from providing them to your users, you can check your global SHAP values (in general the mean of all local explanations over your dataset) and some individual datapoints to check consistency with your domain knowledge. If you pick your individuals along the percentile axis of the model output, you should be able to check that SHAP values change in a consistent manner, like in the plot from the paper below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UI3KP0mfL-J7MfV5EpzApg.png" /></figure><p>Post-hoc explanations are important for transparency, trust and providing impacted individuals an opportunity for appeal. For the people developing the models, post-hoc explanations provide important redundancy (together with the interpretable models) for checking that the model is sensible. Regarding the latter, I think I would like more though. We&#39;re effectively checking consistency with domain knowledge either at an overall level, or by spot-checking. But (let&#39;s just consider SHAP only at the moment) I can imagine looking at distributions of Shapley values over the dataset (and by sub-groups) and doing statistics on them. I expect that should allow you to find smaller inconsistencies or peculiarities. Besides SHAP of course, there are many other ways of doing things that are similar to post-hoc explanations, which is a subject outside of the scope of this paper and this blog, but I hope I&#39;ll get around to researching them and writing a dedicated blog about them at some point.</p><h3>Discrimination Testing</h3><p>Step 3: don&#39;t be evil. I don&#39;t think I have to explain why it&#39;s important to not discriminate. So why is it so easy to find examples of algorithms that discriminate? Well, I&#39;m not going to burn my hands on trying to give an exhaustive answer, but two components of an answer may be that a) there are so many different mechanisms by which bias can enter your dataset or your model that it&#39;s difficult to keep an eye on all of them and b) even if you think you took the necessary precautions, all correlations and causal effects are biases (the only difference between bias and signal is in the interpretation), and algorithms are designed to find them, so they may find a way around your precautions. Therefore, you should check afterwards.<br><br>There are a lot of different measures of bias and discrimination (also known as Disparate Impact, DI). Many of them are mathematically incompatible, meaning it will be fundamentally impossible to create something that is &#39;fair&#39; according the every definition of &#39;fairness&#39;. So picking which measures are the ones that count is a political matter and depends on the particulars, but the least we can do is measure the measures and report them. The authors employ a limited number of measures that are well established in regulatory and legal standards in the US.</p><ul><li>Marginal Effect (ME): difference in percentage of members of subgroups receiving a favourable outcome. Pr(y=1|male)- Pr(y=1|female).</li><li>Adverse Impact Ratio (AIR), aka relative risk: ratio of percentage of members of subgroups receiving a favourable outcome. Pr(y=1|female)/Pr(y=1|male). Values that are statistically significant and below 0.8 are typically considered evidence of discrimination.</li><li>Standardized Mean Difference (SMD), aka Cohen&#39;s d: for continuous variables. Average outcome for protected class minus average outcome for control class, all divided by a some measure of the standard deviation of the (sub)population. Effects are considered small, medium or large when values exceed 0.2, 0.5 and 0.8. Because of the normalization, it becomes possible to compare between outcomes.</li></ul><p>A useful term to apply to discrimination testing is <strong>practical significance</strong>, which is the case when a measure is both statistically significantly non-parity <em>and</em> the measure crosses some chosen threshold. This threshold acknowledges the fact that in any large enough dataset, statistically significant but meaningless measurements of non-parity will show up from time to time as a matter of course. <br><br>Common thresholds are already mentioned above, while the common standard in regulatory context for statistical significance has become the 5% two-sided test (or 2.5% one-sided). In the table below, the AIR regarding race for both XNN and MGBM models are below the threshold of 0.8 (and also statistically significantly so - not shown) and in should warrant investigation into the cause and validity of the disparity, and application of remediation techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*fsnuzSKbN5aFLc8dRucBpw.png" /></figure><p>The authors also report accuracies and FPR&#39;s per subgroup and FPR ratio. Their results already contains an example of a dilemma. If, as a model developer, you have to chose between two models, and one model gives lower FPR for the protected class, but the other model gives you lower FPR ratio, then which is the more fair model?<br><br>This is one of the reasons why post-hoc explanations for users are extra important. A single objective fairness measure does not exist, so it becomes essential that individuals get a transparent opportunity for appeal, override or redress.<br><br>Specifics of remediation in practice are outside of the scope of the paper and we are referred to <a href="https://arxiv.org/pdf/1802.04422.pdf">this paper</a>, for this topic is a large body of work in its own right. Roughly speaking, we can divide the strategies in two categories: across-algorithm (algorithm search) and within-algorithm (auxiliary loss function, f.e.) approaches. Both approaches are becoming more feasible and effective with the enhancement in computing resources. Which specific remediation is suitable will depend on the specific case, but it is discussed that in general approaches that do not need to use class information are more likely to be acceptable in highly regulated settings. What I find interesting here is the implication that you can now perform a search over an increasingly large space of algorithms to optimize for accuracy <strong>and</strong> non-discrimination simultaneously, although this requires that hold-out validation should be done with even greater care than before.</p><h3>Lastly</h3><p>Okay, let&#39;s wrap it up. I think we&#39;ve talked about the most important things in this paper for the community as a whole (in my opinion); a practical example of a responsible ML workflow. This is not the end of course and for that reason I do recommend that you read the paper yourself, there&#39;s a lot of material and references in there to keep you busy. Among other things technical details and discussion of nuances of the different techniques, and discussion of policy and protocol. In addition their source code is available at <a href="https://github.com/h2oai/article-information-2019">https://github.com/h2oai/article-information-2019</a>.<br><br>I think the workflow described in this paper, and the techniques showcased are very valuable, and also quite practical to use, so use them we should. Personally, going forward, I think I would like to see more statistical analyses, like bootstrapped distributions and explicit hypothesis evaluations (and I&#39;m not simply talking about p-values of course). Because every dataset is just a single instantiation of the truth (kinda), no matter how large it is, I expect that may help in interpreting results and informing decisions based on them.<br><br>Finally, the authors provide a very nice list of packages and references to do various Responsible Data Science tasks, which I also encourage you to look up. <a href="https://www.mdpi.com/2078-2489/11/3/137">Here</a> is the link to the paper again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f3c72344018" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MLOps: not as Boring as it Sounds]]></title>
            <link>https://itnext.io/mlops-not-as-boring-as-it-sounds-eaebe73e3533?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaebe73e3533</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Tue, 25 Feb 2020 17:46:12 GMT</pubDate>
            <atom:updated>2020-03-13T08:27:53.736Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you heard of MLOps? When I first heard the term, I admit my first reaction was; ‘Boring!’, and I rolled my eyes like you’re supposed to when you say stuff like that. No-one wants to baby-sit, maintain, and troubleshoot their own models once they are in production. Every data scientist secretly hopes they can pawn that job off to an engineering team, or maybe an intern, right? Well, in fact MLOps is going to make your data science life a lot better. Most of us will not be in the cushy position where you only need to write the ML code and then toss it over the fence; we will be called upon to productionalise more and more often. To make this un-cushy work the most bearable I recommend to get into MLOps as soon as possible!</p><p>All of this is essentially all about saving time in the long run; reduce manual and repetitive work in development, and reduce troubleshooting. So actually it is about both saving time and our sanity.</p><p>I’m going to approach MLOps in this article the same way I approached it in my head, and how I broached it to my team; I’m going to start with my daily work developing ML models, and then along the way realize all the overhead that’s associated with it and wishing there was something to pip install it away with.</p><p>So, we’re happily coding away on our data cleaning, feature engineering and model training pipeline (I will just call it <em>The Pipeline</em> from now on). We’ve got some raw data in a data dump someone made, the pipeline stopped crashing, we’re getting some results, and the sun in shining. OK, maybe the model is full of confidence but mostly wrong and so we get into a bit of a back-and-forth between improving the features, training with different parameters, and cleaning the data better. Some of this involves changing the code, some of it changes the processed data and all of it has an influence on your performance. After a while we’ll lose track. Was the model exhibiting this strange behaviour before? Did I use another version of the cleaned dataset, different parameters, or did I just introduce a bug?</p><p>Already at this point we want versioning of everything. For our own peace of mind, but also for speeding up our iterations and enabling better and quicker diagnostics and debugging. What do we version? The code, of course, we were already versioning. But now we add versioning for the data and for the models, and we associated them between each other, and we associate the artifacts created (datasets, model binaries, results) with the runs (timestamp, commit hash, entrypoint, parameters, performance).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEBhTYF9ZUGGcZKS71U8vw.jpeg" /><figcaption><em>Part 1 of the view of the workflow we are describing. Gives a good impressions of the functions that need to be supported, but leaves all of the complicated architecture/infrastructure/engineering parts as an exercise for the reader.</em></figcaption></figure><p>Excellent. We continue to develop, and we keep going back and forth between code development and model runs. Obviously we’ll need to do some hyperparameter-search and we implement it in one form or another, making sure we keep all the runs attached to our trackers and versioners. That is one overhead that is nowadays easily solved using a nice package. Conceptually and functionally we are now ready to start picking our best model (for some value of “best”).</p><p>So having chosen the best model, maybe it’s tempting to wrap it in an API (maybe with Flask) put it in a docker image and send it on its way into the cloud. This will work (mostly/sort of/maybe), in the sense that we will get some output and we’ll probably keep getting some output as long as your connections don’t break and the data format doesn’t change. But even if we assume this is a fire-and-forget model (fat chance), it will not work in the sense that we have no idea whatsoever what our model is doing and how it’s performing in reality or why.</p><p>In reality, there will be three main things that we will want to do, and which are going to give us a lot of overhead(aches). Firstly, in many cases you will want to keep updating your model with new data, in an automated way. Secondly, your project is never actually finished and we will want to continue developing the model by adding features to the data and to the code and fiddling with the settings (which will mean manually starting runs and training models). Lastly, we will remember about monitoring the performance of our model on the only really representative hold-out dataset we’re ever going to get: live data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RllbrYrHD-MaFD6bBaelKQ.jpeg" /><figcaption><em>Part 2 of the view of the workflow we are describing. The block called ‘production serving’ is exactly the block in the previous figure. Note that the red boxes called ‘Train’ are the same code, but they may be different versions or branches. Same caveats apply as in previous figure (gives a good impressions of the functions that need to be supported, but leaves all of the complicated architecture/infrastructure/engineering parts out).</em></figcaption></figure><p>Because there is no such thing as the ‘best’ or ‘final’ model, and the model that is in production will keep changing, it’s a good thing we got this versioning shenanigans set up early. In order to get the most out of our versioning in terms of speed-up of R&amp;D and troubleshooting we want to be able to stick to the following protocol.</p><p><strong>Any</strong> time we train a model, be it R&amp;D, experimentation, hyper-parameter search, retraining, or production serving:</p><ul><li>we should be using the same git repo for The Pipeline, at most using a different version of it depending on the stage we are in. These versions are meant to converge in the usual manner, althoug while experimenting these may be branches.</li><li>we should be accessing The Pipeline through the same configuration and triggering systems.</li><li>we should be accessing our data through the data versioning system, either: 1) explicitly declaring and storing which code is loading and transforming which data using which parameters, or 2) explicitly declaring and storing which previously cleaned dataset we are loading</li><li>we should be saving all our results in the model versioning system</li><li>we should be interacting (loading, inference) with trained models the same way in every environment, be it R&amp;D, debugging, deployment and serving, or monitoring.</li></ul><p>So that we can <strong>always</strong> inspect, compare, troubleshoot and rollback <strong>any</strong> models (and know where the changes are) consistently and reliably. Finally that brings us to monitoring, which is not only about producing a nice dashboard and maybe some alert threshold, but also about designing the environment and code in such a way that it’s easy to get into the guts and other nasty details of any (set of) model(s) for diagnosis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMRDsFZNNIwUcy7nzyiLuw.jpeg" /><figcaption><em>Part 3 of the view of the workflow we are describing. The monitoring is conceptually and technically perhaps the simplest part. But I don’t want us to forget about it! The block called ‘production serving’ is exactly the block in the previous figure. Note that the red box called ‘Train’ is the same code as in all figures before, but they may be different versions or branches. Same caveats apply as in previous figure (gives a good impressions of the functions that need to be supported, but leaves all of the complicated architecture/infrastructure/engineering parts out).</em></figcaption></figure><p>Conceptually it may seem to us that once we’ve got The Pipeline ready, all of this other stuff is just a small effort that builds on the core we already built. We will turn out to have grossly underestimated the artificial complexity of these tasks. What I mean is, the ‘essential’ complexity of each of those three tasks is low in that as an isolated case the problem is easily understood and the solutions easily imagined. But we increase the complexity exponentially because of how we want to work (therefore I call it ‘artificial’, as this complexity is man-made and not a fundamental property of ML); we want to be able to do all these things <em>at the same time</em> and using <em>the same codebase</em>. Because the more we would decouple the pipeline that we do our experiments with from the pipeline that does the hyper-parameter search and from the pipeline that does the retraining and from the pipeline that does the deployment and monitoring, the higher the risk of bugs (in fact, I’m prepared to guarantee a plague of bugs).</p><p>That is the most challenging part of all of this; we want both our tools and the architecture of our code to support us doing a lot of things simultaneously. “Simultaneously” here means that we can do two different <em>functional</em> things without having to do much manual work to change back and forth, <strong>and </strong>keep as much of the code the same for safety reasons.</p><p>For example, on the one hand I have a pipeline with an interface that can be picked up easily by Katib (my hyper-parameter search algorithm on kubernetes), but on the other hand I also want to be able to do some development on the model code in a Jupyter notebook where I can easily interact with my data, pipeline and model. If I have to write a lot of code in my notebook to access different parts/functions of the pipeline or model — code that is not used when I kick off the pipeline in the automated way -, or if I temporarily hack my pipeline to skip/reuse some parts of previous runs to save time, then the probability is high that when I try to implement this new feature, I will get inconsistent results when I run the pipeline properly. However if I try to avoid this by rerunning my complete pipeline in the proper way every time I make a small change during development, this will take a lot of time!</p><p>That is the main complexity issue here. If you want to boil it down: flexibility and saving time, versus reproducibility and robustness between environments. I am not sure we can avoid it completely, due to the law of Conservation of Misery, but I think it should be possible to achieve a very decent standard.</p><p>Maybe you are now expecting me to tell you which amazing package you can pip install to do all this. But I won’t, unfortunately. There are definitely a whole bunch of packages, frameworks and tools out there that will help with one or more of the things I mentioned, but I am myself still looking around and trying things out. This is not a solved problem yet, as far as I’m aware. I will give a number of references at the end, but I won’t go into any how-to’s, and please don’t treat it as any kind of definitive answer.</p><p>Before we get there, however, I want to point out a number of things that we haven’t mentioned yet, but should also be considered when trying to find our MLOps solution:</p><ul><li>we may be in the situation where we want many variations of the same model (variation of The Pipeline) that are in use at the same time for somewhat different applications. In this case, we again want to be using the same codebase for The Pipeline for all the variations, but we need to allow for extra flexibility in configuration, and extra flexibility in infrastructure architecture (for all the parallel hyper-parameter search, retraining, deployment, and monitoring).</li><li>we may need to allow for different serving and retraining strategies for different models. Your garden variety inference model requires different infrastructure than static predictions, analyst-in-the-loop, or online learning.</li><li>we may want to vary our deployment strategy if, for example, our model is business critical (canary deploy) or if we are interested in A/B testing our models.</li><li>we may need to consider DTAP development practices. I don’t want to go into it, but I invite you to think about it, because I think it’s not nearly as simple as just replicating all the infrastructure we just talked about 4 times.</li><li>and last but certainly not least, we need to be able to work on our models with our entire team, so we need to be able to share all the results and resources while making sure we can experiment and develop without messing with other people’s work-in-progress.</li></ul><p>So, time for some references.</p><p>Frameworks I or my direct colleagues have played around with:<br>Model versioning: <a href="https://mlflow.org/">MLFlow</a><br>Data versioning: <a href="https://www.pachyderm.com/">Pachyderm</a><br>Hyper-parameter tuning: <a href="https://github.com/kubeflow/katib">Katib</a><br>Deployment and serving: <a href="https://www.seldon.io/">Seldon</a><br>Orchestrator: <a href="https://www.kubeflow.org/">Kubeflow</a></p><p>I like what I’m seeing from this combination, but it’s not finished yet. I am particularly fond of MLFlow at the moment.</p><p>Some other (open source) frameworks that might be interesting for building parts of this solution are Airflow, Luigi, Polyaxon, DVC, any of the Feature Store implementations, and AirBnB’s announced BigHead.</p><p>ML lifecycle management services are (beginning to be) offered as well by the big platforms (Azure, AWS, Google, Cloudera), and by dedicated players (<a href="https://www.cubonacci.com/">Cubonacci</a>, <a href="https://www.dataiku.com/">Dataiku</a>, <a href="https://www.h2o.ai/">H2O</a>, <a href="https://algorithmia.com/">Algorithmia</a>). I cannot possibly hope to represent the current state of developments on all of these accurately, so I shouldn’t try, but I’ve seen nice things first-hand from Cubonacci, second-hand from Azure and Dataiku, and heard promising things about Dataiku’s next release and about Cloudera.</p><p>I am always interested to know your take on this, or about your own experience with MLOps.</p><p><em>Big thanks to my colleague Jesse Beem, without whom the diagrams would not have looked nearly as professional.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaebe73e3533" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/mlops-not-as-boring-as-it-sounds-eaebe73e3533">MLOps: not as Boring as it Sounds</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 5 Things I want in my Data Science Projects]]></title>
            <link>https://itnext.io/the-5-things-i-want-in-my-data-science-projects-79dd3840bd24?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/79dd3840bd24</guid>
            <category><![CDATA[data-science-teams]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-driven-decisions]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 19:16:02 GMT</pubDate>
            <atom:updated>2019-12-18T19:49:25.080Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we believe you get happier people and better data products</h4><p>A little while ago my colleague Dimitris Stafylarakis and I gave a talk at the Big Data Expo in Utrecht which we called “Better data products and happier people: our philosphy”.</p><p>We are part of a data science team at KLM’s digital transformation department (Dimitris as a consultant from LINKIT, me as one from Sogeti), and this is pretty much the first time in my life that I’ve been able to structure our work the way I believe data science work should be done (okay, caveats apply, but you get the point).</p><p>I also believe that this approach makes everyone involved happier, and creates a better product at the end (those two things being intrinsically linked as well, of course).</p><p>So in this post I’ll write about that; our team’s philosophy about how to organize data science work. I will talk about 5 aspects in some detail, but I may expand upon single aspects in future blog posts. I will be assuming we’re talking about some sort of user-facing application that uses machine learning.</p><p>Because this post looks pretty long, I will tease the 5 here: User Research; Data-Driven Decision Making; Versioning; Infrastructure; Team. Hmm, sounds kinda obvious when I put it like this, which makes it all the more worrying that I don’t see it done like this more often.</p><p>If you prefer looking at less text, our slides are available <a href="https://www.slideshare.net/webwinkelvakdag/better-data-products-happier-people-our-philosophy-big-data-expo-2019">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lLRGu6Cldhg42hQF" /><figcaption>Strap in! Photo by <a href="https://unsplash.com/@jonflobrant?utm_source=medium&amp;utm_medium=referral">Jon Flobrant</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>User Research &amp; Human-Centric Machine Learning</strong></p><p>The main goal here is to find out what you should actually create. If people who are not data scientists are going to use your application, you should be careful to understand what they actually want. This is what is referred to as “user research” and many other names besides (you could probably see <a href="https://medium.com/google-design/human-centered-machine-learning-a770d10562cd">human-centric machine learning</a> as a specialization of it). User research involves a formal methodology to find out what users (the people who are going to use your application) do and why they do it. Putting the human needs as input for the development ensures that your ML application will solve real problem, and not imaginary ones. With formal methodology I mean that you can’t just ask a stakeholder or some manager somewhere what your app should do. And you also can’t just go the the prospective users and ask them “I’m going to make this cool app for you, you would use that right?”. It has to be approached as objectively as possible, taking care to not influence any of the responses you are going to get. User research helps people understand, rather than simply assume, what the problem is. It involves speaking to and spending time with people who are affected by the issues, such as observing users in their day-to-day work, and conducting interviews with carefully crafted questions. Another nice tool is for example what is called a <a href="https://www.gv.com/sprint/">design sprint</a>, where you bring a representative sample of users (and stakeholders) together for a full week, and essentially design and test a prototype mock application, without actually doing any coding.</p><p>In the end, when you do all of this, it should lead to better products as long as the stakeholders are prepared to accept the results, even if that result is that an solution is needed that is different from what was imagined at first. But all of this is an iterative process of course, you don’t just conduct some user research once. It will be a constant back and forth between user insights and data insights as your project develops. All of this user research is particularly important for applications that are data heavy. In those applications the data that is shown is almost always derived and interpreted, which means that your user is also going to interpret it, but not necessarily in the same way! Doing user research in iterations is very import to iron all of this out.</p><p>I highly suggest getting an expert service designer for this. This is entirely it’s own expertise. My team was blessed with an excellent service designer that I learned a lot from, but it is still such a specialization that I wouldn’t leave home without one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*mnO3qU1u6h0frceOc63qJg.png" /><figcaption>Did I mention yet that you should read <a href="https://hackernoon.com/data-inspired-5c78db3999b2">Cassie’s “Data-Driven? Think again” post</a>? You should. Illustration by <a href="https://twitter.com/pivotservices/status/1062234390493884416?s=19">Paul J.</a></figcaption></figure><p><strong>Data-Driven Decision Making</strong></p><p>“Data-driven” is of course a huge buzzword, and as such it can mean a lot of different things (including ‘nothing’). But here I want to talk about something very specific with a rather strict definition. I’ll start with a silly example (I am heavily <a href="https://hackernoon.com/data-inspired-5c78db3999b2">influenced by Cassie Kozyrkov</a> here). Data-driven decision making (DDDM for short) means that when I’m in a shop and I see something I like, I do <em>not</em> look at the pricetag. The first thing I do is decide what the maximum price is that I’m prepared to pay for it. Only after that decision do I look at the price-tag. At that point the choice is automatic. I do not actually do this personally when I’m in shops (although I probably should). But in our work this is in fact how we decide how to run our project.</p><p>Let’s go back to how most of the projects at KLM Digital Transformation are run. This will probably be very familiar to many of you; it’s an innovation funnel consisting of ideation, groundwork, PoC, MVP. You can skip to the next paragraph if you’re already doing this. For those still reading; Digital Transformation generates a lot of ideas to “Help our people do what they do best” (our actual mission). Out of these a bunch will be studied, which we call ‘groundwork’ and consists of figuring out the feasibility, viability and desirability. Some of them will be deemed worthy of being taken to the next phase of a proof-of-concept. Finally some PoC’s will be developed further into a Minimally Viable Product.</p><p>How do you determine if an idea or project gets to go on to the next phase? Our team does it through data-driven decision making! Before we start any work on any phase, we first decide the decision boundaries that we will check against at the end of the phase. Usually determining the decision boundaries means that we figure out which questions we are going to answer or which metrics we are going to measure during the phase. Then we tell the decision maker(s) that this is the case, and ask them to set the boundaries for the Go/No-Go. Instead of a Go/No-Go decision, this could also be a choice between any number of different follow-up scenarios, of course. Maybe the decision maker wants to change something about the questions we’re going to answer or the metrics we’re going to measure, but that is excellent! This means you will have a pretty definitive discussion on scope before the work starts. With the decision boundaries set, we do the work (keeping the stakeholders well-informed of course), get to the end of the phase, report the results of the questions and the metrics defined, and then you <em>automatically</em> get the decision for the Go/No-Go (or other scenario’s).</p><p>The main objective of DDDM is to make better decisions, or at least more informed and less biased. People in general are pretty bad at making decisions, among other reasons because of confirmation bias. We tend to only see or consider the data or observations that confirm the opinions that we already had, on a subconscious (hopefully) level. Practicing DDDM prevents wasting money and time on expensive analyses or projects if the decisions are going to be made based on gut feeling anyway!</p><p>For me, for our team, there is something that is more important than that even. It is the clarity of scope and stakeholder management. Most simply put, because of the set decision boundaries we always know what our team and our work will be judged on, there will be no uncertainty in that regard. This mechanism also sort of forces stakeholders into more reliable behaviors when it comes to scope creep, roadmaps, reviews, and it’s more difficult for them to keep changing their mind!</p><p><strong>Version Everything!</strong></p><p>This one comes straight from the heart. I’ve done a lot of projects in both academia and business that involve writing code (and executing it of course) for data, modelling and evaluation pipelines. Among all those projects, there is 1 constant: the hassle (and futility!) of trying to keep track of what you’ve been up to, why it didn’t work, and “how did I manage to get this one result from a couple months ago?”.</p><p>In any project that involves data, data processing, modeling and evaluation, your results depend on: raw data, processing code, modeling code, evaluation code, parameters for all those codes, stochasticity in your data, random seeds, etc., etc. So keeping track of <em>all</em> of this is majorly important for the following reasons:</p><ul><li>reproducibility</li><li>understanding your models</li><li>debugging your code</li><li>diagnosing your results</li><li>efficiency</li></ul><p>During development, you will run your pipelines a <em>lot</em> of times, and they probably also can take up quite a lot of time. So you want to re-use the intermediate results where-ever possible. Or maybe you would like to, but it’s too much effort to change the code now to re-use some old stuff, so you just rerun the whole pipeline, but suddenly the results changed! What? How? And you don’t know because you have overwritten the old files because you did not think anything would be different. Can you piece your shit back together enough to figure out what happened? How long will that take?</p><p>So, version <em>all</em> your stuff, and never run a custom command (or dirty hack) without a way to recover and reproduce it.</p><p>There are many frameworks out there that you can use for this. Personally at the moment, we’re using <a href="https://mlflow.org/">MLFlow</a> for keeping track of all the parameters and results. In addition, gin-config to create configuration files (because I have a lot of parameters) that are in turn saved to MLFlow, so it’s literally no effort to rerun an old run. Note that MLFlow also keeps track of the commit and entrypoint with which the run was started, so you can also recover the code and command you performed a run with (if you’re using Git of course, but if you are not, what are you even doing?). Just remember to commit any changes before doing a serious (non-code-development) run.</p><p>For data versioning we are playing with Pachyderm. This is mostly useful for versioning of raw data. The second type of data versioning that is important is more like caching; you want to re-use intermediate results to save time (and/or storage space). For this second type, we have not yet implemented anything. We could hack it together ourselves with some MLFlow or MLFlow like stuff, but what would be really useful is a framework that detects automatically which parts of a DAG have changed code or changed parameters, and re-runs only the necessary down-stream parts of it. Airflow, Luigi or d6t-pipe may be candidates for our attention in the future in this regard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydTUzCB9mZKI0QyAqThqww.png" /><figcaption>From a <a href="https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems.pdf">paper </a>by Sculley et al.: “Only a small fraction of real-world ML systems is composed of the ML code, as shown by the small black box in the middle. The required surrounding infrastructure is vast and complex.” And that makes your life that much harder.</figcaption></figure><p><strong>Infrastructure and Architecture</strong></p><p>The data science workflow is often illustrated with some variation of a “load data, feature extraction and engineering, training, evaluate, serve” flow, with an occasional loop-back arrow to indicate iterations. There are also a lot of diagrams out there about the interactions between data exploration, data understanding, business understanding and model training. All of these are useful and describe essential parts of the data science work. But as a blueprint to structure your actual day-to-day workflow, not to mention to explain it non-data-science engineers or architects or to setup the tools and infrastructure to support it, they are rather useless.</p><p>The data scientist’s work is very iterative. And a productionalized model is a complicated beast with many moving parts. Both of these things should ideally be supported by infrastructure that on one hand automates (or hides, or takes away) repetitive or complex but generalizable work, but on the other hand also enables the data engineers and scientists to create what they feel they need to create instead of putting them in a straitjacket.</p><p>The infrastructure that supports that workflow (and the versioning we talked about) is currently under a lot of development in many shapes and forms. I do not believe there is at the moment an accepted industry standard (no, for all that I use them for, Jupyter Notebooks do not count as infrastructure — unless you go all <a href="https://medium.com/netflix-techblog/notebook-innovation-591ee3221233">Netflix</a> on them). But there are a lot of open source tools out there (based on Kubernetes more often than not) that are already doing great work in making our lives a lot easier.</p><p><strong>Team</strong></p><p>Lastly, out of all aspects mentioned, the thing that is actually most important to me on a personal level is the Team. I have spent enough time of my life doing projects on my own, and although I have admittedly learned a lot from that, in the end it just sucked the enjoyment and motivation right out of me. Based on my conversations with many current and former colleagues, a lot of (data) scientists feel the same way. It is probably also the main reason I left academia.</p><p>Being part of a team is quite essential to many people in order to enjoy their work. In the rest of this piece I’m going to imply that this applies to everyone, but that’s of course not quite true. So, the Team makes the work more enjoyable because of any number of reasons; there’s more social interaction, you can exchange interesting thoughts, you can iterate on ideas quickly, it’s easy to ask for quick help or a quick tip, you can get through a project more quickly, share the suffering of and time spent on the boring parts but share the interesting parts, etc, etc.</p><p>You don’t just throw some people together in a room and call it a team though. Equally important it is to have the right mix of skills. All of the aspects I have mentioned before in this piece require quite specific skill sets. On the one hand there’s the technical skills; the mathematical &amp; statistical part, the machine learning , the data engineering, the infrastructure, and the software architecture. On the other we have the translational skills from business and users to data science (and back), and all the other non-technical expertise that is involved in creating data-driven user-facing applications, like stakeholder management and Scrum/Agile. That’s quite a broad spectrum, even without considering the required depth!</p><p>A typical team, I would say, should consist of at least 7 people: 4 technical (let’s say 2 data scientists and 2 data engineers), a product owner, a user experience expert and a scrum master. But this is not a blueprint of course. What matters most is that you get people with the required skills, and it is not so important how the different skills map to the different people. For example, the senior data scientist on the project might share with the product owner the tasks of prioritizing the backlog and translating to the business. This could be a good idea if it is the case that the product owner is really good at stakeholder management (while this senior data scientist is not) but does not have a data scientific background. What does matter is that there be overlap in skills between people, meaning that there’s always someone else on the team that you can really spar with about your subject. In my experience this is particularly important to and for the data scientists. That is why I say at least 2 data scientists, and 2 data engineers. If you’re into buzzwords, you’re allowed to insert ‘T-shaped’ somewhere in the previous sentences, as long as you don’t interpret it as “everyone has to do a bit of everything”.</p><p>Maybe not all the people need to be on the team completely full time, and maybe you need add or subtract some skills depending on your project. A few more technical people is also fine (maybe even encouraged) up to, say, 9 people in total before you get too much overhead and chaos within the team.</p><p>There are also a lot of more practically business related advantages to having work done by teams. What I still see around me happening a lot is that data scientists are put on a project on their own or maybe with 1 other data scientist. Of course they may perfectly well deliver some amazing work, and maybe you are or have found a Unicorn with all the skills in one neat package. But the probability of finding a Unicorn or getting really impressive results (high quality and high efficiency at the same time) is really just very small. If you happen to have a Unicorn in your stable, you become very dependent on a single individual that is at the same time very likely to receive better offers all the time and not stick around for very long. And for efficient <em>and</em> high quality work, the number of required skills is so large that most people (maybe even including the Unicorns) will be bound to just not be so good at at least some of those skills.</p><p>To be more explicit, having a complete project team has all of the following advantages:</p><ul><li>more reliable and flexible to changes (in team or in project)</li><li>more future-proof with regards to retaining knowledge and expertise</li><li>more bang for your buck (I will claim with confidence that 1 team of 8 people doing 4 projects in a row (or partially overlapping) will be more effective than 4 teams of 2 doing 4 separate projects)</li><li>everybody is happier because they can focus on what they do best</li></ul><p><strong>Closing Remarks</strong></p><p>So there it is, these are the 5 things I want in place when I embark on a data science project. I’ve clearly been influenced and inspired by other people’s thoughts and writings on these issues, which I appreciate because these things have a huge impact on my satisfaction with a project regardless of its technical contents. Do you disagree strongly? I’d be very interested to hear!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79dd3840bd24" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/the-5-things-i-want-in-my-data-science-projects-79dd3840bd24">The 5 Things I want in my Data Science Projects</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quality of coding life with a terminal multiplexing startup script]]></title>
            <link>https://medium.com/analytics-vidhya/quality-of-coding-life-with-a-terminal-multiplexing-startup-script-cd8dd7abf18e?source=rss-83972347a3ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd8dd7abf18e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Jeroen Franse]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 18:58:35 GMT</pubDate>
            <atom:updated>2019-12-20T04:50:30.886Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Saving minutes every time I (re-)boot or remote login to a machine, using terminator, screen and ssh.</em></h4><p>For my various jobs (academic and business) I have spend a lot of time behind a computer doing code-related things. I have been in the situation many times (actually, I should say all the time, before I started doing what I will describe below) where I had many windows open; specifically a bunch of terminals, editor windows (and browser of course). Like, way too many. Different terminals had different purposes, and were grouped and named so I could find them back easily; I would be working on multiple projects simultaneously in different workspaces; a couple of terminals would be remotely logged in to other machines. So every time I had to reboot (or lost connection) I would have to go back and open all the windows, and start all the processes again, and rename all the terminals, and put them all back in the same place (because I had gotten used to everything being in a certain place).</p><p>This could take a lot of time. My guess is up to 15 minutes every time, although I never timed it. It did take waaaay too long for me before I finally automated this whole thing, but I did in the end. Perhaps some of my findings can be useful to other people who have a mild anxiety attack every time they have to reboot.</p><p>I use terminator for my terminal multiplexing nowadays. Just</p><pre>apt-get install terminator</pre><p>and the important thing is that you can configure various layouts, and make it so that each terminal window executes a predefined command when they start.</p><p>For the layout, start terminator, and begin creating and resizing the windows to your fancy. It’s very easy. Then save this layout by right-clicking any terminator window &gt; Preferences &gt; Layouts &gt; Add, then give it a name and hit save.</p><p>Open the config file in an editor (should be in ~/.config/terminator/config) and then then manually set all of the following for each terminal</p><pre>directory = /home/me/projects/someproject<br># which directory to start in, obviously</pre><pre>profile = default   <br># the visual profile: colors, fonts, etc. You can create these from the terminator settings.</pre><pre>title = jupyter notebook  # the name of this terminal window</pre><pre># here is the important bit<br>command = &#39;&#39;&#39;bash --rcfile &lt;(cat ${HOME}/.bashrc; echo &#39;export PROMPT_COMMAND=&quot;source activate my_env; jupyter notebook; unset PROMPT_COMMAND&quot;&#39;) -i&#39;&#39;&#39;</pre><p>This layout has a name (you set it before in the preferences window), but you can edit the layout name in the config file as well. If you edit the layout named ‘default’, this will be the layout that is loaded by default when you start terminator without any options (what’s in a name, huh?). Let’s call it mylayout for now. So after (re)booting my system, I just do:</p><pre>terminator --layout=mylayout</pre><p>and then, for example, automatically I will get my jupyter notebook server in the correct virtualenv, pycharm, a window running htop, a continuous rsync process for pushing code to a remote, and whatever else have you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Uc6DYDv5rfqfdAYPbrvvg.png" /><figcaption>My terminator after start-up</figcaption></figure><p>I’ll explain a little about the command, because it is a bit fiddly. First of all, terminator can only execute a single command, so we have to hack everything we want to happen into one command: `bash`. Props to <a href="https://stackoverflow.com/questions/31524527/using-python-virtual-environments-with-terminator">this</a> stackoverflow answer. The explanation below is mostly a copy-paste from that SO answer, but I’ll add some notes of my own. Here is the command again:</p><pre>command = &#39;&#39;&#39;bash --rcfile &lt;(cat ${HOME}/.bashrc; echo &#39;export PROMPT_COMMAND=&quot;source activate my_env; jupyter notebook; unset PROMPT_COMMAND&quot;&#39;) -i&#39;&#39;&#39;</pre><ul><li>We execute bash in interactive (-i) mode. So the bash session stays open at the end.</li><li>We execute commands from a custom command file ( — rcfile) instead of .bashrc.</li><li>This file is created with the contents of .bashrc plus one more command.</li><li>This extra command exports PROMPT_COMMAND with a value of “whatever we want to execute”.</li><li>The PROMPT_COMMAND is a bash built-in, and gets executed at <em>every</em> new prompt line.</li><li>Therefore, the PROMPT_COMMAND must be unset just after it is executed the first time to avoid multiple executions after each interaction with the shell.</li><li>Within the PROMPT_COMMAND I can mostly chain together all the commands that I want. So in this example, I activate my virtual environment, and start my jupyter notebook server inside it.</li></ul><p>Another example; starting some application but having it run in the background, so we can use the terminal windows for something else afterwards:</p><pre>command = &#39;&#39;&#39;bash --rcfile &lt;(cat ${HOME}/.bashrc; echo &#39;export PROMPT_COMMAND=&quot;unset PROMPT_COMMAND; pycharm &amp;&quot;&#39;) -i&#39;&#39;&#39;</pre><p>To run in the background, you usually add the ‘&amp;’ at the end of the command, but apparently this doesn’t work if you want to chain another command after it using a semicolon. Luckily, we can switch the commands around so the ‘&amp;’ is at the end, and the unsetting of the ‘PROMPT_COMMAND’ doesn’t interfere with the execution of itself.</p><p>Another very related issue is doing things on remote machines over ssh. We have the same problems as above, having to re-setup the ssh connections every time we reboot our own system. But there are two more liabilities when working over ssh (seasoned ssh users will know the solutions to this already, of course): if you lose connection to a process on a remote machine, the process will exit, and if the remote machine reboots, you obviously also have to restart all the stuff that you were running there. My most convoluted terminator startup command solves all three of these at the same time.</p><p>For connection loss / client machine reboot, we are going to use good old screen. The essential primer is this: type screen, hit enter, and you just started a new terminal session, but it is sort of like a background process. You are currently connected to it, and it is practically indistinguishable from when you normally work in a terminal. However, if you close the window, or press CTRL-A CTRL-D, this sessions get detached. This means it is still running, it’s just no longer attached to a user I/O. To reconnect simply do screen -r. Screen can do a LOT more that I won’t go into right now.</p><p>For convenience, instead of writing out the entire command into the PROMPT_COMMAND, I make an alias out of it. So</p><pre># in my terminator config file<br>command = &#39;&#39;&#39;bash --rcfile &lt;(cat ${HOME}/.bashrc; echo &#39;export PROMPT_COMMAND=&quot;unset PROMPT_COMMAND; remote_tensorboard &amp;&quot;&#39;) -i&#39;&#39;&#39;</pre><pre># and in my ~/.bash_aliases:</pre><pre>remote_tensorboard () {</pre><pre>   SCRIPT=&#39;bash --rcfile &lt;(cat ${HOME}/.bashrc; echo &quot;source activate tf_env; cd project/output; tensorboard --logdir=runs&quot;)&#39;</pre><pre>   ssh -t myremote &quot;screen -RR -q -S tensorboard bash -c &#39;${SCRIPT}&#39;&quot;</pre><pre>}</pre><p>This command is going to:</p><ul><li>ssh into my remote machine (`myremote` is the ssh alias defined in my ~/.ssh/config, defining username, ssh-key location, port forwarding, etc)</li><li>execute a command on this remote machine (the -t option)</li><li>this screen will get a name (-S tensorboard in this example) and will not show the standard screen welcome screen (using -q)</li><li>if there is already a screen session with the same name, we will attach to that screen session instead without running the bash command (-RR)</li><li>run a ‘single’ bash command inside this screen session using bash -c (the -c tells bash to execute a command from a string)</li><li>if inside this bash command we want something complex, we use the same — rcfile trick as before. In this case, we start tensorboard from a virtual environment and from a specific directory.</li></ul><p>Honest disclaimer: I always have to muck about with the quotation marks and string escapes and such in bash, so there might be a better way to compose all this, but at least it works!</p><p>Having set all this stuff up has made me inappropriately happy, and has probably saved me between 5 and 15 minutes (depending on the project) every time when I reboot/reconnect, not to mention the annoyances!</p><p>Of course I’m on a linux system here. I expect macOS probably has something very similar. I’m using terminator and screen, but tmux I think has combined functionality, and byobu as well I believe. Haven’t tried them yet, but they look nice and I might try them in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd8dd7abf18e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/quality-of-coding-life-with-a-terminal-multiplexing-startup-script-cd8dd7abf18e">Quality of coding life with a terminal multiplexing startup script</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>