<?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[Cheffelo  — Tech &amp; Data - Medium]]></title>
        <description><![CDATA[The leading mealkit provider in the Nordics - Medium]]></description>
        <link>https://medium.com/godtlevert?source=rss----e430e9c6fedf---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Cheffelo  — Tech &amp;amp; Data - Medium</title>
            <link>https://medium.com/godtlevert?source=rss----e430e9c6fedf---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:18:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/godtlevert" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Yet another Churn blog!]]></title>
            <link>https://medium.com/godtlevert/yet-another-churn-blog-c52fd0a73e32?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/c52fd0a73e32</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[churn]]></category>
            <category><![CDATA[meal-kit]]></category>
            <dc:creator><![CDATA[Niladri Banerjee]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 13:26:31 GMT</pubDate>
            <atom:updated>2022-12-12T13:26:31.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*bAYDAOAEaEpp9wkS9PxxQg.png" /></figure><h3>Introduction</h3><p>So, churn…. isn’t there already like a whole ocean of articles devoted to this topic? So why <em>another churn article? </em>Give me 2 minutes and be illumined! Wisdom granted!</p><p>Well, jokes aside, it just signifies how important the topic is and just how many nuances there are to every churn project. Every company is different, every branch is different and so are the use-cases.</p><p>This article will seek to shed some light on how we go about it in the mealkit industry. Mealkits you say? Whatever on earth are those things? And why should anybody care?</p><p>Well, fair point so let me take a minute to explain that.</p><p>Mealkits as the name suggest are a brilliant way to a) save time b) eat delicious c) eat healthy d) maintain food budget e) reduce carbon footprint f) reduce food waste g) help the environment. And more. Much more.</p><p>Just imagine for yourself all the hassle it takes to figure out what to eat for dinner — something that needs to be done daily and must be tasty, healthy, not boring! And not necessarily in that order! Add kids and other family members into the mix and it can soon require the logistic planning of military general to get everyone satisfied.</p><p>Or.</p><p>Choose a mealkit- set your personal taste preferences and voilà! Food gets delivered to your door according to you and your family’s preferences and everybody is happy.</p><p>Unfortunately, as it so happens, people do tend to not see all the upsides of the product. And with that comes the phenomenon of churn- people who simply stop buying. And that brings us to the unique case of churn for mealkits. Or as we like to call it REACT. I leave it up to you to figure what that could stand for — but it is related to churn and attrition.</p><p>Right, so my 2 minutes are over and if you want to dive further, well read on!</p><h3>The technical bits</h3><p>How do we define churn was the most important part of the project. Because let us admit, when exactly does a person churn? When they stop ordering? What if they stop ordering for 4 weeks and then buy on the 5th week. Is that considered churn?</p><p>Together with business and project owners we produced a definition that works for our business and purposes. Something that has the crucial time element of customers who have stopped purchasing and are unlikely to purchase in the next N weeks.</p><p>Once the definition was set up, the next task was to fetch the all-important data and try and implement the definition in code and then check if the behaviour of customers was possible to predict at all!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*CkM_Ue9gENySCrBgTh0loQ.png" /><figcaption><em>🔮 Yes…we know you will keep reading… 🔮</em></figcaption></figure><p>We considered for the first version of our crystal ball quite a few input variables including demographic data which we obtain through third party aggregators. Perhaps the fact they were aggregated data, but we found no predictive power whatsoever in them. Or maybe we simply needed to perform more feature engineering.</p><p>Anyhow, experimenting with various combinations of models and inputs and eliminating those that had limited to no predictive power, we were quite happy with the first version of the model using logistic regression.</p><h3>Data</h3><p>Any discussion of churn is of course incomplete without discussing the datasets that are going into the prediction module.</p><p>In total, in the first version of the model, we used 6 variables which we found was either protective or non-protective of churn. As an example, the following image shows a customer which the model predicts will <em>not </em>churn: -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFJoi1o8lPrGQDOI3D8Qag.png" /></figure><p>When taken across the full training cohort, so the analysis appears as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKnkzOPLaEBc9uOGGoiZhg.png" /></figure><p>Common thread amongst all the relevant variables was the aspect of time — how long a customer has been with us, how many orders were taken, when was the last time an order was placed and how long has it been since the last complaint was sent in.</p><p>We also analysed the performance of the model in real-time, monitoring the prediction and order frequency of cohorts marked at risk for churning vs not-churning. We were quite reasonably pleased(?) that we were actually managing to capture at-risk churn customers!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*-WwfE96Hh6_lINO2YWoBZw.png" /><figcaption><em>Order frequency between different churn cohorts</em></figcaption></figure><p>And finally, to wrap up the discussion, here is the rough birds-eye view of the full end to end machine-learning pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*pPPnLPw2pLil8N1Lj_rfPw.png" /></figure><p>As can be inferred, there are quite a few components of the pipeline but in brief they can be understood as follows:</p><ul><li><strong>Python:</strong> no brainer, the code is written in python using scikit-learn. Yes, sometimes the simplest solution works.</li><li><strong>Azure repos:</strong> Code base is stored in the git enabled repository</li><li><strong>Azure DevOps</strong>: Our master coordinator that connects and brings the code for execution into the Databricks workspace</li><li><strong>Databricks:</strong> while being primarily a distributed environment (Spark), we have restricted it to work more as a scheduler, automating the execution of various ML jobs written in Python. We have not found it beneficial to refactor the code to PySpark.</li><li><strong>Azure SQL Database: </strong>The output of the predictions is sent to our database customised for ML workloads.</li><li><strong>PostgresDB: </strong>Our customer data platform does not support direct reads from Azure and thus we use pipelines in Azure Data Factory to pipe the predictions to postgresDB formatted in a way that CRM teams can use the predictions out of the box</li><li><strong>Segment — </strong>Our customer data platform that works as a landing stage for both incoming (e.g., web data) and outgoing data (e.g., predictions/annotations).</li><li><strong>Customer.io</strong>: Tool used by the CRM to receive customer specific insights. It is here they receive the likelihood of a customer churning in the next N weeks displayed as an attribute. They can subsequently run targeted churn-mitigation campaigns on diverse groups of customers.</li></ul><h3>Future Work</h3><p>Even though we recently put the model to production, our work is not complete yet. Amongst the most important development required going forward –</p><ul><li><strong>Weekly churn threshold — </strong>Every week the churn distribution changes shape and thereby the underlying distribution of churn risk scores. It needs to be evaluated if this weekly variation has any practical significance in our ability to predict churn. What complicates the issue is the fact that the churn scores predict N weeks in the future and thereby determining the exact consequence of variation in scores is no trivial task. But there are ways to approach this, all from simple frequentist methods to more sophisticated Bayesian approaches.</li><li><strong>Seasonal variation — </strong>In addition to weekly variation, we expect variation in seasons. This is because historically we know there are periods when customers do not take orders but at the same time not necessarily churn e.g., holiday periods. One of the future iterations of the model will take the seasonality into account.</li><li><strong>Monitoring </strong>— We also need to set up monitoring of customers with high churn scores that eventually do churn. At the same time, internal communication feedback loops from the CRM team on retention will be another vital information to monitor. Furthermore, going forward it will be interesting to uncover trends if any, on the kind of customers who do churn vs those who respond to anti-churn measures.</li><li><strong>Additional features — </strong>We still have a fair number of variables and features we would like to explore if it helps improve the churn model and/or retention metrics. These include but are not limited to different demographic data and information on the types of mealkit combinations/frequencies/sizes etc. In addition, we have anonymised web data that could be interesting to take a deep-dive and check if they have any role in prediction of churn.</li><li><strong>Model tuning — </strong>At present we have tuned a Logistic Regression model to perform the job. While we have analysed some other models, this has not been prioritised in the first phase of the project and will be required for us to be sure we have the best model always working under the hood.</li><li><strong>MLOps — </strong>Lastly, a good deal of work remains on the ‘OPS’ side of things- everything from Data Ops to MLOps whereby monitoring of data drift, model drift, prediction drift needs to be in place.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c52fd0a73e32" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/yet-another-churn-blog-c52fd0a73e32">Yet another Churn blog!</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing tests for data science products]]></title>
            <link>https://medium.com/godtlevert/writing-tests-for-data-science-products-2184e8d713bb?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/2184e8d713bb</guid>
            <category><![CDATA[pytest]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[unittest]]></category>
            <dc:creator><![CDATA[Thomas Sve]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 13:04:36 GMT</pubDate>
            <atom:updated>2022-12-12T13:04:36.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*l73Recyf_nXGohKxbQC5gQ.png" /></figure><p>Here at LMK Group, data and machine learning have a central role in creating a good customer experience. Over the years, we have built products that are now essential to the company. As a result, writing good tests has become an increasing focus.</p><p><strong>Why testing is important</strong></p><p>It is common for testing to be underprioritized when building data science products. This can happen for a variety of reasons, such as time constraints, a focus on quickly developing and deploying a working product, or a lack of understanding about the importance of testing. However, underprioritizing testing can lead to problems in the long run, such as unreliable or faulty code, difficulty maintaining and updating the product, and potentially serious issues in production. It is important to prioritize testing as part of the development process to ensure the quality and reliability of your data science product.</p><p><strong>Unit test with </strong><strong>assert</strong></p><p>Unit testing is an important part of the data science development process. It allows you to test individual units or components of your code, such as functions or modules, to ensure that they are working properly. This can help you identify and fix issues early in the development process, before they have a chance to cause problems in the final product. Unit testing can also help you maintain and update your code over time, by providing a suite of tests that can be run to ensure that changes to the code do not break existing functionality. Additionally, unit testing can provide valuable documentation for your code, helping new team members understand how the code works and how it should be used.</p><p>For instance, imagine we have a function that calculates the maximum of a list of numbers. We can use the assert keyword to check that the function is returning the expected result. For example, if we pass the function the list [4, 7, 3, 2, 8, 1], we would expect it to return 8 as demonstrated in the block below:</p><pre>def test_max_function():<br>  l = [4, 7, 3, 2, 8, 1]<br>  assert max(l) == 8, &quot;Maximum number in list should be 8&quot;</pre><p><strong>Pytest</strong></p><p>When working with a product, we might create several function that cleans and preprocess our data. To ensure that these works as intended, we might use unit testing to test the function. For instance, below we test a function that moves dishes that has previously been recommended to the end of the list. In order to ensure that the function works properly, we need to test it with different sizes and lengths of input data using the parametrize function in pytest. This will help us determine whether the function is working properly and identify any potential issues that need to be addressed.</p><pre>@pytest.mark.parametrize(<br>    &quot;recommended_dishes, expected_output&quot;,<br>    [<br>        (<br>            [[1, 5, 21, 30], [2, 5, 1, 6], [10, 3, 5, 7]],<br>            [[1, 5, 21, 30], [2, 6, 5, 1], [10, 3, 7, 5]],<br>        ),<br>        (<br>            [[2, 3, 21, 30], [2, 5, 1, 6], [10, 3, 5, 7]],<br>            [[2, 3, 21, 30], [5, 1, 6, 2], [10, 7, 3, 5]],<br>        ),<br>        (<br>            [[1, 5, 21, 30], [2, 5, 1, 6], [10, 3, 5, 7]],<br>            [[1, 5, 21, 30], [2, 5, 1, 6], [10, 3, 5, 7]],<br>        ),<br>    ],<br>)<br>def test_deprioritize_repeated_dishes(<br>    recommended_dishes, expected_output<br>):<br>    assert (<br>        test_deprioritize_repeated_dishes(recommended_dishes)<br>        == expected_output<br>    )</pre><p><strong>Azure pipelines</strong></p><p>At LMK Group, we use Azure and as part of that, we use Azure Pipelines to perform continuous deployments for our data science products. This allows us to automatically build, test, and deploy our code whenever there are changes to the codebase. As part of the deployment process, we also run all of our tests and publish the code coverage, which provides us with important information about how much of our code is being tested and how effective our tests are at finding potential issues.</p><p><strong>Summary</strong></p><p>The data science team at LMK Group delivers product that are essential to the company and it is key that these works as intended. Writing tests is therefore very central tool and is essential when delivering high impact solutions. And just as with any other python solution, unit testing and pytest works great to make sure that our product works as intended.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2184e8d713bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/writing-tests-for-data-science-products-2184e8d713bb">Writing tests for data science products</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forecasting Process]]></title>
            <link>https://medium.com/godtlevert/forecasting-process-32271a9efa74?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/32271a9efa74</guid>
            <category><![CDATA[purchasing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[forecasting]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Marie Noel Chanthavong]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 13:04:17 GMT</pubDate>
            <atom:updated>2022-12-12T13:04:16.931Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><h4>Why do we need these forecasts?</h4><p>LMK Group is a food tech company which operates in Nordic countries under the brands Linas Matkasse, Godtlevert, Adams Matkasse and Retnemt. We offer large weekly quantities of meal kits to simplify the everyday life of customers. Sustainability is one of our essential values. We have developed several forecasting models to predict the quantities of meal kits from 2 days up to 11 weeks in advance which are used for ordering the raw materials that we need to pack the meal boxes. Our forecasts could help the food producers also know the quantities of ingredients that they need to cultivate and reduce food waste.</p><h3>Forecasting Process</h3><p>The forecasting process includes meal boxes, flex dishes (which are the dishes that the customers choose for themselves), and grocery forecasts. We have come up with both short-term and long-term forecasts. The short-term forecasts are based on the estimated values of products which the customers have chosen in their baskets at the current standing. For the long-term forecasts, we use historical data to make the estimation and/or do machine learning models.</p><h4>How does it work?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*PLSLVS30DMg2Fv4RRUWB_g.png" /><figcaption>Forecasting Process</figcaption></figure><p>First, we insert manual forecasts of meal boxes, add-on products or some grocery items having campaign prices which have been done by the Data Analyst team into the table in database which is called the ‘temp’ table in our Analytics Database (ADB).</p><p>In Retool (a low-code platform that makes it fast and easy to build internal tools), we developed an internal user interface (UI) application that can help us run the forecasting process easier. In fact, this UI application connects to ADB and triggers the Store Procedure that we created for executing all existing forecasting models. We have a possibility to run the forecast for a specific week or available weeks.</p><p>This Store Procedure consists of several steps. First, it will archive the old forecasts and then insert the new manual forecasts into the final forecast table in our ADB where we will serve it through an API in PIM later, where PIM is a product information management platform which is the process of managing and enhancing the product information across menu, ingredients and purchasing products.</p><p>Then, the forecasting model of flex dishes is triggered. If the week we trigger the model is from 1 to 19 days (about 0–3 weeks) before the cutoff date, we will use the estimation data (which is the quantity of variations that customers choose at the current standing) and outputs from manual forecast to adjust the estimated value for each flex dish, which is called the short-term model. If not, we will use the long-term model which is based on the Dishes Forecasting Machine Learning model. This model consists of an ensemble of 5 trained models where the blended model uses consensus among estimators to generate final predictions by consuming: ingredients, recipe main ingredients, recipe name, and cooking time.</p><p>For the grocery model, if the week to forecast is the next delivery, we use the estimated value to calculate the proportion of grocery items, and with some adjustments to compute the final estimation for the grocery items by multiplying the calculated ratio earlier with an average number of grocery items per order and an average number of orders having grocery items in the past 2 weeks. If not, we use the historical data to calculate the ratio of groceries and do the same adjustment.</p><p>All outputs will be inserted into the analytics forecast table in ADB. It will be served later by our API endpoint.</p><p>The procurement team can send a request to the API to get the outcome, and then the endpoint will return the response corresponding to the quantity of each dish for a specific week.</p><h3>Deployment and monitoring</h3><p>There are at least 5 models being run every week. Some have been running daily to predict total orders 11 weeks ahead, dishes forecasting has been running once per week to predict the quantity of each flex dish for 11 weeks in advance on Databricks. When making changes to the code, we use unittest and pytest to verify the code before merging changes. For the forecasting process, we run it at least 3 times per week per brand through Retool. PIM makes a request to our internal FastApi application to get the forecasts which have been run. Usually, we run this forecasting process several times per week: one for 11 weeks in advance, the others for the next delivery.</p><p>To monitor models, we created reports in tableau helping us to track the performance of our forecasting models (figure below). The performance of forecasts gets better when we are closer to the cutoff date. We use several statistical metrics to measure our model quality over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuygRsSzjvT85RbjmyRWHA.png" /><figcaption>Forecasting follow-up</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32271a9efa74" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/forecasting-process-32271a9efa74">Forecasting Process</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Picking Optimisation]]></title>
            <link>https://medium.com/godtlevert/production-optimization-algorithm-ee0143b89f57?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/ee0143b89f57</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-driven]]></category>
            <category><![CDATA[production]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Navdeep Singh]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 12:14:20 GMT</pubDate>
            <atom:updated>2022-12-12T23:36:46.352Z</atom:updated>
            <content:encoded><![CDATA[<p>Written by <a href="https://medium.com/u/e2780104dc6d">Navdeep Singh</a> &amp; <a href="https://medium.com/u/cac4ff1083e6">Thibault Daoulas</a></p><p>Credit to: Ståle Berg &amp; Marie-Noel Chantavong</p><h3>Intro</h3><p><strong>The meal kit business</strong></p><p>LMK group delivers meal kits to around 30K households in Norway, Sweden &amp; Denmark every week. Customers can choose between default meal kits where dishes are selected for them or choose their dishes from a pool of 50–80 dishes every week. This allows us to deliver tailor-made and personalised dinner experiences for Nordic households.</p><p>Let’s say we have 50 new dishes every week, varying the number of portions and number of dinners per week gives us potentially over 2 million unique combinations of meal kits. This increased flexibility for our customers naturally puts pressure on the production and purchasing that must purchase the right amount of ingredients from our suppliers and pack these meal kits.</p><p>These tailor-made meal kits are getting packed on their own production line, the “free-pick” line. On this line, the ingredients for every week are placed in certain positions. This placement was done manually by people with experience to make sure that the production went smoothly and efficiently. When the production starts, the cart boards are made by a machine and sent down the line for printing on the box and printing of menu leaflets before they reach the “free-pick” line. The cart boxes are getting filled with the right ingredients as they are moving on the line. Each box stops at every station and gets filled up with the right ingredients and then is sent to the next station.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6h_LpUOAWdoe-5sbpDHdA.png" /><figcaption>Figure 1: Line and station illustration</figcaption></figure><p><strong>Challenges</strong></p><p>The main challenge, in this case, was to minimise the queue time that appeared on the line. That happened when the person at the next station was taking more time to put in the ingredients than the person behind him. That person must wait and that is how the queue appears and slows up production. This happened because it is difficult to estimate the workload on each station manually based on how many picks there are on each station after the placement.</p><p>The other challenges were to place fragile, heavy, or special ingredients in the right places at the line. We don’t want fragile ingredients to get squashed by the heavier ones, and therefore they must be placed at the end, and the heavy ones at the beginning.</p><p>This placement of ingredients was done by the line leaders, who have the most experience and domain knowledge when it comes to production. When the cutoff came, the ingredients list is generated, and they start placing the ingredients. Once a week. They did it with two aspects in mind; Fast production and protecting the ingredients. Even though it was placed by experts, some ingredients were misplaced from time to time, and the workload per station didn’t become equal either. That is very difficult to do 100% correctly when you have 200–300 ingredients that must be placed on equal amounts of slots, with several constraints.</p><h3>Approach</h3><p><strong>Observation phase</strong></p><p>To ensure we address the challenges with the greatest impact on the meal kit packing process, we observed full packing cycles on-site and interviewed stakeholders to gather information from different angles, including employees picking ingredients on the supply chain, and delivering ingredients, as well as chain supervisors and logistics managers.</p><p>This allowed us to understand and formalize performance measures and translate perceived bottlenecks into hypotheses to test on hard data. Having a data representation of the challenges would open the path to data-driven methods and maximize the targeted performance.</p><p>In the present case, the main performance measure to maximize was the number of meal kits packed over time.</p><p>Gathering feedback from stakeholders, we made an initial list of observations, hypotheses to validate, and best practice recommendations:</p><ul><li>Walking back and forth between ingredients is inefficient and puts a strain on workers, which leads to physical and mental fatigue over time</li><li>Since workers wait for incoming boxes at the left side of their respective station, ingredients placed towards the left are packed faster</li><li>Large-sized ingredients, when packed far down the line, often lead to disruption due to all ingredients not fitting; the box is then put aside, and packing must be restarted</li><li>Fragile ingredients packed late on the line may be damaged</li></ul><p><strong>Data exploration</strong></p><p>Examining the physical setup on-site and exploring the available data helped us define the scope of the solution. We started with a several week-batch of historical data containing the following information:</p><ul><li>Ingredient (reference, name, weight, category)</li><li>Time when scanned</li><li>Ingredient position on the line</li><li>Stations setup</li><li>Meal box the ingredient belongs to</li></ul><p>Scanning time and order data allowed us to define several performance metrics for meal box packing, while the position on the line and station setup allowed us to test hypotheses around the relative positions of ingredients on the shelves.</p><p><strong>Formalize hypotheses and test</strong></p><p>While station setup, via trial and error, eventually led to equally sized stations of 16 slots for dry ingredients and 24 slots for cold ingredients, historical data required cleaning and imputation to create a common baseline to test the hypotheses.</p><p>To test hypotheses, our approach was to create features as a proxy to the assumptions to test and train a supervised model that would learn the relationships between these features and the performance metrics, allowing us to validate the impact of the features and decide on which ones to optimize.</p><p><strong>Design setup — Transform hypotheses into features</strong></p><p>One of the first pieces of feedback we received was that workers were walking too much back and forth between slots, affecting their physical condition over time and their efficiency. A first hypothesis to test was therefore whether ingredients near each other tended to be picked faster, both early on during a shift and later in the shift due to cumulated fatigue.</p><p>Instead of looking at the time packed per box, we used the time spent packing ingredients on one station as our performance indicator. The cleaning of this data consisted of removing periods where lunch or other breaks occurred.</p><p><strong>Feature 1: Connectivity</strong></p><p>We created a feature that represents how much a worker on a station must walk to fetch different ingredients for a given box. Based on the Moore Neighborhood, we defined a feature proportional to how connected ingredients are for any given order on a station. As illustrated in Figure 1, neighboring ingredients will belong to one cluster, whereas non-neighboring ingredients will belong to 2 distinct clusters. The hypothesis to test was therefore the positive correlation between the packing time and the number of clusters in one station, given the equal number of unique ingredients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4SIQA-PVEErvKTlMvau6w.png" /><figcaption>Figure 2— Station with 2 clusters of ingredients to pick from for one order</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLWo4wgNRl7uGFFwOa9xBw.png" /><figcaption>Figure 3 - Schematic view of ingredients shelves and clusters of ingredients. 1 person is assigned 1 station.</figcaption></figure><p><strong>Feature 2: Leftness</strong></p><p>To test the effect of positioning ingredients towards the beginning of a station, we created a feature “leftness” per ingredient, a linear coefficient from 0 to 1, where 1 is an ingredient placed as far left as possible on a station, and 0 is at the far right. A station is then assigned a leftness score based on the average leftness of each picked ingredient on this station.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0ZyxHi1azWVQKqKZtXOkg.png" /><figcaption>Figure 4 — Schematic view of ingredients leftness and stations leftness score</figcaption></figure><p>We then built a supervised learning model to test the hypotheses that connectivity and leftness contribute to greater packing throughput per station, where the target is the time spent packing ingredients on one station based on scanning timestamps, and the features being the number of clusters, leftness, number of unique ingredients, ingredients weight, station size. Adding features such as station weight and station size allowed us to make different training sets per group of comparable stations to isolate the effect of the features we intend to control, namely connectivity and leftness.</p><p>For all clusters of training sets, using linear regression, random forest, and xgboost modeling with the SHAP framework, the number of clusters did have consistently a positive impact on packing time, while leftness had a negative correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*vLrX03bd3OoXvC_bx2BiQw.png" /><figcaption>Figure 5 — Features impact on packing time in one data cluster</figcaption></figure><p>Unsurprisingly, station leftness and the number of clusters showed a strong negative correlation, as a great leftness value implies that ingredients are clustered together towards the beginning of a station. We, therefore, chose to focus on the leftness feature per station and maximize it under provided constraints. In other terms, to reach a global maximum leftness, ingredients with the highest quantities were to be stacked towards the left of each station.</p><p><strong>List constraints (organizational &amp; physical)</strong></p><p>Now that we had a feature to optimize, we had to set constraints and best practices after the observation phase and suggested improvements to embed in the design of the algorithm:</p><p>- Fragile ingredients to be placed towards the end of the line</p><p>- Large-size ingredients to be placed towards the start of the line</p><p>- Heavier ingredients to be placed on the lower shelf</p><p>- Priority groups: some ingredients must be placed last, such as pizza dough, no matter their weight, fragility, cold status, or amount, for better fit due to their shape</p><p>- If all dry ingredients do not fit in the dry area, they need to be placed at the start of the cold area</p><p>- If there are too few unique dry ingredients, therefore, leaving empty slots on the dry side, cold ingredients are imported from the cold side</p><p>- Each station has a provided capacity, allowing trainees or employees with reduced capacity to process their respective stations without affecting the overall flow on the line. This capacity per station varies over weeks, lines, and stations and is provided at the program execution time, i.e., when new orders data come into the system</p><p>- Stations may have a varying number of slots, provided at execution time</p><p>Optimize features under defined constraints</p><p>Defining constraints in the algorithmic sense means setting rules to where ingredients can be placed and reducing or filtering the domain of possibilities. While some rules can be directly applied like fragile ingredients going to the furthest down available slots, large ingredients to the first 3 stations or heavier ingredients being placed on the lower shelf, setting a constraint based on station capacity required an optimization approach. Indeed, any given set of ingredients and their quantities, given some constraints, do not guarantee that the exact desired number of picked ingredients per station can be reached.</p><p>To summarize, at this point:</p><p>What we know:</p><ul><li>Unique ingredients and their properties (big, fragile, heavy, etc.)</li><li>Available slots and properties (for big ingredients, for fragile, for heavy, etc.)</li><li>Maximum number of ingredients to fit on each station</li></ul><p>What we want:</p><ul><li>Match ingredients and slots properties (fragile ingredients in fragile slots, etc.)</li><li>Fit the number of ingredients in each station as close as possible to the maximum capacity calculated</li><li>Place ingredients so that each station’s leftness coefficient is highest as possible</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*TecjcGPnmq3XwwqLmeLLSA.png" /><figcaption>Figure 6— Example of a map of available slots given the constraint that a slot should be free, not reserved for a light ingredient, not for fragile, and not for large-size ingredients</figcaption></figure><p>This challenge looks a lot like the bin-packing problem with conditions on ingredients properties to identify the bins to choose from. In a nutshell, the bin-packing problem is a situation where we want to use the smallest number of bins or containers with limited capacity, to pack groups of objects of varying sizes.</p><p>In our case, we opted for the First Fit Decreasing algorithm implementation, which is a great compromise between efficiency and precision to reach the targeted station capacity.</p><p>Essentially, for us this means:</p><ul><li>Sorting the ingredients by decreasing the amount</li><li>Sorting the available slots by decreasing remaining station capacity and leftness</li><li>Filtering available slots based on properties of the next ingredient to place</li><li>Iterate until the last ingredient is placed</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6nu4FYhUHap6mpG5AcuMA.png" /><figcaption>Figure 7 — Example 1st fit descending: batch of 600 ingredients goes in the station with the greates capacity. Next batch of 500 ingredients goes in the slot belonging to the station with greates capacity, and with greatest leftness.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9jFNsDT5WZY_8jfcf5khg.png" /><figcaption>Figure 8 — Effect of bin packing optimization: even spread of load per station, where 1st station has 50% capacity and the last station 75%. Colors represent the ingredients’ priority groups. The second half of the stations are located in the cold area of the warehouse.</figcaption></figure><p><strong>Execute, feedback, iterate</strong></p><p>Once the implementation of the algorithm was in place and tested on historical data, we were able to compare the difference between the setup made and the one suggested by the algorithm. Both on historical data and for a couple of weeks, where the suggestion was only given to the line manager for review, improvements were noticed at first glance:</p><ul><li>The amount of ingredients is more evenly spread over the stations</li><li>No more anomalies where large-size ingredients could be placed late on the line</li><li>Distribution of highly demanded ingredients is a lot more organized towards the left of each station rather than seemingly random distributions</li><li>Better division of heavy and lightweight ingredients between lower and upper shelf</li><li>Fragile ingredients are consistently placed toward the end</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtS3OuvLm35DbSuYaScjCA.png" /><figcaption>Figure 9 — Ingredients quantity distribution over slots by ascending order. Stations are recognizable as ingredients in quantity are placed towards the left of each. Dark blue bars show the fragile, dry ingredients, now consistently placed last.</figcaption></figure><p>After two weeks of simulation and adjustments after feedback from the warehouse, the output from our model was taken for production. On Wednesday morning, as a list of orders, ingredients and quantities entered the system, the algorithm was run to read and produce a CSV file with the assigned slot for each ingredient in under 8 seconds. Line managers then only had to distribute the ingredients to their assigned position and start the packing procedure.</p><h3>Results</h3><p><strong>Productionalize</strong></p><p>To further streamline the process, we integrated the optimization application with the picking application production used so it would require no manual intervention from the development team. All the line managers had to do was to trigger the optimization via a button on their picking platform, which executed our python application and populated their forms they could just print out and distribute in the production center. Should a trainee, employee with limited capacity, or packing crew be understaffed, they could manually adjust the station’s capacity and rerun the optimization application.</p><p><strong>Feedback from direct stakeholders</strong></p><p>Although data speaks the truth, the most tangible feedback comes from people’s perceptions. In our case, the two main groups of stakeholders we could gather feedback from were workers on the packing line and warehouse managers. While the latter informed us of the process of integrating our new tool into their workflow, the former could give us direct feedback on the impact of our optimization.</p><p>The Monday following the first weekend packing our optimized setup, these were some of the comments we received from the production manager and people working on the packing line:</p><ul><li>“Saturday (last shift) finished earlier than usual”</li><li>“People are more stationary; they walk less back and forth”</li><li>“On average they were packing around 10 more boxes per hour”</li><li>“Less weight to carry from upper shelves”</li></ul><p>While some final adjustments were needed regarding new fragile ingredients, the first data-driven setup for meal kit packing could be considered successful so far. Now hopefully the data will follow and confirm that indeed the impact was positive on the packing production.</p><p>Performance measure</p><p>One challenge with data is that there are many moving pieces, thus making it difficult to establish a baseline. For us, this meant varying scanning device systems, station sizes, or personnel. After some discussions with production managers, we took their usual performance indicator and compared two weeks in with optimization versus two weeks prior. The ultimate KPI is the speed of packing full boxes, in the first 2 weeks we went from 197 to 212 meal kits packed per hour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*txsfPf__kk2LELfZAqNwlg.png" /><figcaption>Figure 10 — Average boxes packed per hour per day. From From 2020–10–08 with optimized ingredient placement.</figcaption></figure><p><strong>Conclusion</strong></p><p>Even though the improvement measured of around 10% increased packing productivity might not appear drastic, it does have a significant impact when a large number of employees are involved in the process. However, an immediately perceptible yet more difficult-to-measure impact has been the improved working conditions and reduced physical strain on employees, who now both work shorter hours on the line, carry lighter weights, and need to walk less back and forth through their shifts. Stressful situations related to rightly preordered ingredients, queues, and repacking have also reduced, leading to better working conditions overall.</p><p>Building the placement optimization tool took about a month from scratch to being fully integrated into existing workflows, so there is great room for improvement, but it opened the opportunity for further improvements with minimal effort across production centers.</p><p>Finally, beyond the desired improvements, the tool now gives better control over the packing flow and gives the knobs for line managers to adjust stations, for example for trainees, people with reduced capacity, or reduced staff.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee0143b89f57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/production-optimization-algorithm-ee0143b89f57">Picking Optimisation</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recommendation Engine — with a twist of flavour]]></title>
            <link>https://medium.com/godtlevert/recommendation-engine-with-a-twist-of-flavour-463dd6e2f09e?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/463dd6e2f09e</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[foodtech]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Navdeep Singh]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 08:06:18 GMT</pubDate>
            <atom:updated>2021-09-02T08:06:18.327Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Recommendation Engine — with a twist of flavour</strong></h3><p>Written by <a href="https://medium.com/u/d07b9d5ccff">Niladri Banerjee</a></p><p><strong>Introduction</strong></p><p>Food, such a wonderful delight!</p><p>Food, such a delightful sight!</p><p>Food that makes an imagination take flight,</p><p>Food that lightens up the day bright!</p><p>Our lives are all about food. Good, timely, nutritious food is vital not only to us as humans for survival, but it is also essential for our well-being! Here at LMK Group, food is what we do! On a daily basis!</p><p>And not just provide food. That many people and indeed businesses worldwide are involved in.</p><p>Our mission, however, is to make everyday lives simpler. By making it easier to plan, obtain and cook delicious meals loved by everyone in the family while at the same time making sustainable production a non-negotiable priority.</p><p>It is precisely for these reasons developing an AI-driven recommendation engine for our customers was no mean task! There is no plug-n’-play system out there that considers the unique business model of our meal kit system and is ready to deploy out of the box!</p><p>So, in this blog, we will go through some of the salient features of our recommendation engine that make it so unique and that helps fulfil our goal of making everybody’s daily lives, a little bit simpler and enjoyable!</p><p><em>P.S If a general introduction to recommendation engines is what you are looking for, there are plenty of great resources, e.g., check out </em><a href="https://en.wikipedia.org/wiki/Recommender_system"><em>here</em></a><em>, </em><a href="https://towardsdatascience.com/what-are-product-recommendation-engines-and-the-various-versions-of-them-9dcab4ee26d5"><em>here</em></a><em> and </em><a href="https://towardsdatascience.com/introduction-to-recommender-systems-6c66cf15ada"><em>here</em></a></p><p><strong>Materials &amp; methods</strong></p><p>Like many recommendation engines out there, the first and foremost priority is to ‘know thy customer’. Because indeed we wanted to make personalisation a top priority- to recommend dishes and meals based on what we personally like and prefer! So how did we go about it?</p><p>Well, we did this by making a taste profile for every active customer based on past orders. This involved a fair amount of data munging and wrangling.</p><p>There were complex business rules to adhere to, intricate JOINS to perform and a good measure of Pythonic magic to whip into shape the data that forms the base for our recommendation engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JhtZnJI98Zd5KiNKGBcXxg.png" /><figcaption>The real matrix is what you are staring at…</figcaption></figure><p>While the business rules might be boring to write much about, they actually acted as useful constraints. Talk about making lemonade out of lemons!</p><p>We at LMK Group are all about sustainability and planning. Thus, our weekly menus take into account the seasonal fresh produce, availability of ingredients and various logistics measures to minimise food wastage. Additionally, there are rules pertaining to the specific variety of dishes to provide for the customer each week. Thus, our recommendation engine deviates from the classic e-commerce-based recommendation engines.</p><p>At its core however, the overall principle follows a content-based approach to recommending dishes to each customer for each week using past orders data, ingredients and taxonomies of each dish in addition to the seasonal recipes available. The end result is not that different than chopping, cutting and grinding the raw materials needed to make a lip-smacking dish!</p><p>Without going into too much technical details, the overall flow of steps can be summarised into the following steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dTOQ6gLnrUvWI_zN1ZWD5A.png" /><figcaption>From a distance…everything looks so simple!</figcaption></figure><p>Thus, every week each of our customers get 8 dishes to choose from. Why this number one may ask? Well again it comes down to business rules such as basket sizes and a trade-off between drowning a customer with a flood of options, in which case it would not be personalised at all or the other extreme- giving way too few options!</p><p>The above flow chart however is just on the model side, which consists of many matrix operations. Getting the recommendations out to the customer while he/she browses on the website/app is a whole different ball game. That is where the dark art of productionising machine-learning models comes into the picture! Speaking of pictures, take a look below to get a bird’s eye view of the various steps and interconnected pathways involved in serving the recommendations!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IAG1VRYuBOPimq5CI8s9NQ.png" /><figcaption>The flow</figcaption></figure><p>As we can see, delivering a machine-learning end product to the masses, i.e., the ‘consumable’ requires an orchestration of considerable number of processes across various systems in both backend and frontend infrastructures. And this will vary from company to company and use-case to use-case of course!</p><p>In our case, the broad route basically involves delivering the recommendations to the customer on the website through Segment, which is a customer data platform that is a pretty powerful tool for coordinating the final display of items to the customer. This data is pumped from a PostgreSQL database that obtains its data in a JSON format from our Azure SQL Database. All of this coordinated through pipelines and stored procedures triggered from Azure Data Factory.</p><p><strong>Workform</strong></p><p>The way we like to work with Data &amp; AI products in LMK Group is to “Nail it, then scale it”. Get the minimum viable product to production as fast as possible and learn. When you are sewing data components in a data product together is when one really exposes the faults in the solution. This pushes the platform team to orchestrate everything with precision, the frontend team to make smooth customer facing UI and it forces the digital experience team to think about UX from the customers perspective. Especially for recommendation engine products the UI really influences the results of the data product.</p><p>This approach is one of many approaches we have tried and tested. We also work with person-based approaches, association rules, ML ++. We also have different types of products we can recommend spread across 4 brands in 3 countries. In other words, this blogpost highlights a small amount of work we are doing across our company, but also a very nice introduction of our ways of work.</p><p><strong>Results</strong></p><p>Okay, enough talk about the technical implementation, does our recommendation engine work? Does it help push the needle when it comes to tempting customers with dishes customised to each and every one of them? Preliminary analysis says YES!</p><p>The following is a graph from one of the cohorts we tested the recommendation engine on, and we were quite pleased that customers receiving the personalised recommendations not only purchased more recommendations, but more customers were purchasing! This was a very welcome news from the viewpoint of customer engagement and satisfaction!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wurNGmqFYsmoHWB5Z_93cg.png" /><figcaption>Some very interesting results!</figcaption></figure><p><strong>Discussion &amp; Conclusion</strong></p><p>So, what can we conclude about the recommendation engine? Well for starters, the good news is that it is working! The plan going forward would then be to expand to all the companies under the umbrella of LMK Group.</p><p>The other big advantage is that this application supports our chefs. With the recommendation engine, one part of their workload gets automated leaving them free to focus on doing what they know best….making delicious lip-smacking dishes for all of us to savour upon!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*p5BcHP_V9E2D5LHpW1Igng.png" /><figcaption><em>Delicious meals…coming right your way!</em></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=463dd6e2f09e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/recommendation-engine-with-a-twist-of-flavour-463dd6e2f09e">Recommendation Engine — with a twist of flavour</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A quick and easy way to get going with CLV]]></title>
            <link>https://medium.com/godtlevert/a-quick-and-easy-way-to-get-going-with-clv-27bfa019ebdd?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/27bfa019ebdd</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[customer-lifetime-value]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Navdeep Singh]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 08:29:01 GMT</pubDate>
            <atom:updated>2021-08-16T08:29:01.802Z</atom:updated>
            <content:encoded><![CDATA[<p>Written by <a href="https://medium.com/u/af10e37175ee">Peder Kraugerud</a> &amp; <a href="https://medium.com/u/d07b9d5ccff">Niladri Banerjee</a></p><p>Back in the spring of 2020 our newly hired group CMO asked us in data science and analytics to calculate the customer lifetime value (CLV) for of each of our brands. A natural enquiry for a newly appointed CMO that would like to get a quick overview of our customers, their value and performance. CLV can be used for many purposes but fundamentally it shows how valuable a customer is to a company and what drives value. It is an important metric to understand company performance and if we as a company are making sound investment decisions. i.e., are we acquiring customers that are valued above their acquisition cost?</p><p><strong>What approach to choose? Do not overthink, just get going!</strong></p><p>Up until our new CMO’s request CLV had mostly been calculated on an ad-hoc basis and definitions were not agreed upon across the company. To proceed we needed an approach we felt gave an informative view of our customers and an approach all relevant departments would agree on. We aligned definitions and how we would work with CLV between the tech, commercial and finance departments. Lastly, we needed a relatively simple approach to quickly get going. We realised that the project would languish if we overcomplicated our approach early on. And by choosing a relatively straightforward method we could quickly share results with our CMO and discuss how to continue to develop our CLV project. We landed on the approach below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjjsjD_ycZtd-EN9Okb7fQ.png" /></figure><p>Lifetime value is the result of multiplying average transaction value, order frequency and lifespan (1 / churn rate). Then to calculate customer lifetime value, we chose to use a variable contribution margin. This is because we want to use the CLV to evaluate our investment decisions (customer acquisition). We want to understand if the customers we acquire are valued above their acquisition cost and provide an acceptable rate of return on investment. To do so we want to include all extra costs associated with acquiring new customers. Like food costs, other COGS (cost of goods &amp; services), production (meal kit production) and logistics costs. And we want to exclude all fixed costs that we would incur regardless of the customer was acquired or not, like real estate rentals and overhead. Then to understand how customer behaviour and value have development over time we have calculated our CLV on a 12-month rolling basis. When visualising CLV, and its parameters, it is then easy to understand performance over time.</p><p>Lastly, we calculated CLV for all customers in our chosen time horizon. This CLV value for all customers is a great metric to understand your company’s (or brand’s) overall performance but it is misleading when evaluating any investment decision relating to new customer acquisition, at least given how typical cohorts develop in our industry with high initial churn rates but long tail relationships lasting years. To do this we needed to further segment our data, only looking at new customer that have signed up during the last 12-months. The was further segmented by sales channel as the customer acquisition cost between for example web channels and telemarketing are significantly different and have different cohort behaviour.</p><p><strong>From ad-hoc to automation</strong></p><p>With the expansion of our Data Science team, the journey from ad-hoc reports to automation could truly start! This process involved onboarding the data scientist to the concepts of CLV and general marketing and finance jargon followed by a better understanding of business rules and logic. The result is a CLV report generated in JupyterLab once a month.</p><p>Presently the CLV report analyses all the brands within our group for a) all customers b) new customers c) Web entry channel d) Telemarketing entry channel. The process broadly works by fetching live data once a month from our SQL database, data munging and cleaning followed by applying a broad set of custom functions adjusted to each company.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*0zDBl0QQ61m100lbXP4wMw.png" /><figcaption>The initial setup of the notebook</figcaption></figure><p>Amongst the libraries used, the most important one was datetime, both the module and the method! And that is a bit of a pain point in the sense both the module and the method are named the same and can become very confusing if not careful with the code structure!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*epRf16XDOnvIIuYA4Nk6eA.png" /><figcaption>Same? Note same.</figcaption></figure><p>The reason both needed to be imported was due to the different functions each of them provide access to e.g., strptime is a classmethod in datetime while timedelta belongs just to the class datetime only!</p><p>Amongst the custom functions written the most important ones relate to calculation of delivery weeks (which are specific to business rules). Thus the prebuilt functions available to calculate needed to be tweaked. To automate this process custom functions considering year, if the year has leap weeks and whether a year begins on Thursdays needed to be considered. Who would have thought that a calendar can be that complicated!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*Y7l8dnd-OWSKM9xguoEY6g.png" /><figcaption><em>A simple function to spit out the last delivery week numbers for a month, that under the hood isn’t so simple!</em></figcaption></figure><p>When all is said and done however, a simple one-liner computes the CLV for a given company, month and whether we want info on new customers as well.</p><p><strong>Value to operational marketing</strong></p><p>This report gives a retrospective overarching look at the customer base and its value. It can have strategic implications and gives a nice overview of how the customer base is changing.</p><p>As far as operational value for marketing, we often do more ad-hoc deep dives that give marketing and CRM more tools to customise their content to the right audience at the right time. The typical activities can be to do Kaplan-Meier analysis to understand the retention behaviour of different segments or make Shap values to help them understand their real drives for marketing activities. Shap values breaks down the effects of variables in a ML model and makes it easier for us to interpret the impact of each variable. <a href="https://www.kaggle.com/dansbecker/shap-values">You can read more about it here.</a></p><p>This is a back-and-forth job where we have a mix of people with different knowledge and skillset working together over time to pinpoint needs, hypotheses and resulting actions based on data. That could be marketing representatives, CRM experts, Analysts and Data Scientists</p><p>Going forward we have two goals for this project. The first one is to increase accuracy of how we calculate parameters used in the CLV calculation. Like testing out the Kaplan Meier estimator, Traditional ML, Gaussian approaches or among other alternatives, to estimate customer’s retention rate. The other one is to the bridge the gap even more between the marketing- and data science experts, as we think that is the key to really extract more value from our data to our business units. The more our analysts know about specific marketing activities, and thus more our marketing department gets comfortable using data and advanced analytics, the project will hit a new gear.</p><p><strong>CLV part 2 — Future work</strong></p><p>Looking even further ahead we have plans for expanding the project as we have learned more about what type of approach fits a subscription-based ecommerce company best. We aim to predict the CLV of each individual customer in our customer base so we can operationalise the metric across our business. The purpose will be to give our customer service and marketing teams another metric to understand and segment our customers by. It will be a system om models running at different times predicting the CLV of customers as they progress through the onboarding journey. What they do, what they order and what they receive (campaigns) in the onboarding face can often be a good indicator of whether somebody will be a loyal customer or not. More to come.</p><p><strong>Charts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zND5vZYntFuqw8m2nDhqhA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27bfa019ebdd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/a-quick-and-easy-way-to-get-going-with-clv-27bfa019ebdd">A quick and easy way to get going with CLV</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we scaled analytics @ GodtlevertGruppen/LMK group]]></title>
            <link>https://medium.com/godtlevert/how-we-scaled-analytics-godtlevertgruppen-lmk-group-cd4babc78dd8?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/cd4babc78dd8</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[godtlevert]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Fredrik Gabrielsen]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 11:34:10 GMT</pubDate>
            <atom:updated>2021-04-08T08:11:20.540Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we scaled analytics @ LMK Group</h3><p>It is interesting to look back three years when the in-house tech department was formed and we decided to move reporting out of manually updated Excel workbooks and start the journey towards data science and machine learning.</p><p>Back then we read this really good article from Tristan Handy called «<a href="https://thinkgrowth.org/the-startup-founders-guide-to-analytics-1d2176f20ac1">The Startup Founder’s Guide to Analytics</a>» which featured a pyramid of different analytics capabilities required in the different organizational stages and we decided it would be our guiding star when treading into the world of data and analytics. 3 years and 2 organizational merges later, each doubling our employee headcount, we are sitting comfortably in the «growth stage» at the top of the pyramid with an analytics stack featuring integrated machine learning processes and a data lake being fed by multiple data flows.</p><p><strong>This is the story of how we got there.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cNn-6ehUAY2T9YOCSL7Uiw.png" /><figcaption>The pyramid we used for strategic planning. Image fetched from Tristan Handy’s original post: <a href="https://thinkgrowth.org/the-startup-founders-guide-to-analytics-1d2176f20ac1">https://thinkgrowth.org/the-startup-founders-guide-to-analytics-1d2176f20ac1</a></figcaption></figure><h3>Phase 1 — Starting with SQL-based analytics</h3><p>The story starts with Godtlevert. Like most other small companies we relied upon Excel to do all our analytical work (which at this stage was very little). We would have huge pivot tables that regularly crashed the computers if the calculation was too heavy or the dataset too large. At this stage, most of the analysis and «dashboards» were built on top of two single flat datasets: orders and customers.</p><p>This solution had several shortcomings, but the ones that caused the most problems were:</p><ul><li>no centralized place for definitions</li><li>everyone was looking at their own version of the dataset (when did they last update it)</li><li>no data governance</li><li>requires lots of maintenance</li></ul><p><strong>We knew we had to act quickly to avoid people losing faith in data.</strong></p><p>After reading up and discussing internally we had a pretty good idea of what the next few steps would be, as well as the article described above for more long-term planning of how we eventually would reach the machine learning stage. The first big win would be to use a dashboard service/tool to solve our pressing business intelligence needs.</p><p>We decided we wanted something simple to set up and maintain since we did not want to spend the time and resources to maintain a solution ourselves. This led us to <a href="http://modeanalytics.com/">Mode Analytics</a>, an excellent tool that allowed us to write SQL queries and make graphs and dashboards on top with filters, automated emails and everything we needed. With this new way of creating data directly on top of the database, we solved the following challenges we had:</p><ul><li>a partly centralized place for definitions through database views</li><li>everyone was looking at the last run of the report with the same data</li><li>data governance became a lot easier since the Analytics team created and updated all the graphs and dashboards</li><li>really simple to set up for new employees and use since it is just in the browser</li><li>everything is controlled either in the database or on the Mode Analytics webpage, making maintenance a lot easier</li></ul><p>This served us well for about a year until we merged with our largest competitor in Norway, <a href="https://adamsmatkasse.no/">Adams Matkasse</a>, bringing them onto our platform and increasing our headcount and users to 100 employees and increasing our analytics team from 1 to 3, which leads us to …</p><h3>Phase 2 — Getting a dedicated data warehouse</h3><p>With the employee headcount doubling, the reporting needs seemed to quadruple. Extracting marketing lists directly from SQL and creating curated dashboards for all the employees with an interest in data was both time-consuming and we started to notice the impact of having employees updating dashboards with analytical queries directly on our production databases. Combining data from different databases were also something we lacked. To address these challenges we decided we had to the following:</p><ul><li>create a separate analytical environment</li><li>create some sort of tool that marketing and sales could use to get their lists without using resources from the Analytics team</li></ul><p>The main objective of the analytical environment was to separate the load and the code from the production databases, allow us to combine data from all the production databases and give us SQL access to marketing and web usage data. We also wanted to go fully Software-As-A-Service for the analytics environment, making it both easier to set up and maintain, and more flexible so we can swap out marketing tools without having to build new ETL pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVQuEvuctUkZNWdcGq9kwQ.png" /><figcaption>An overview of the first analytics architecture (end of phase 2)</figcaption></figure><p>We decided on <a href="https://aws.amazon.com/redshift/">AWS Redshift</a> for our data warehouse. It seemed like a safe choice since they were so widely used. Another benefit of using Redshift in our data strategy was how many tools and services that had built integrations with Redshift. It seemed like every single one of the tools that provided some kind of pipeline to a data warehouse all supported Redshift.</p><p><strong>Data lake approach</strong></p><p>Creating and updating the views directly in the data warehouse gave us some issues, primarily that we had no version control or backup if we were to accidentally delete something. To solve this we decided to use a tool called “<a href="https://www.getdbt.com/">dbt</a>” (data build tool) from Fishtown Analytics. That way we could create the views as SQL-scripts that reference each other, but instead of doing the scripts directly on the database, we ran builds inside dbt that committed to git at the same time as the script was running, making sure that all changes to the views had logs and version control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ytYIc53C421avKG4kosig.png" /><figcaption>Image fetched from getdbt.com, dbt is the area above the data warehouse</figcaption></figure><p>For gathering web usage data we decided to go for <a href="https://segment.com/unified-customer-data/">Segment</a>. Segment allows us to define events once, then send them to Mixpanel, Google Analytics, Intercom, and our Redshift data warehouse through their integrations. It also functions as a data pipelining tool directly, allowing us to connect to our marketing tools and fetch the data just by adding an API-key then pipe that into our data warehouse. Creating a new data pipeline from a new marketing tool we want to try out and send it to our data warehouse doesn’t have to take more than 5 minutes.</p><p>Instead of doing the typical ETL (Extract, Transform, Load) we like to do ELT (Extract, Load, Transform). This way we have a large pool of data available at all times without having to modify pipelines or jobs when we wanted to do changes. To achieve this, we used <a href="https://www.stitchdata.com/">Stitch</a> for the data pipelines from the core databases. Creating pipelines with Stitch was incredibly easy, as we only had to create two database users, one in each database with the right permissions, before pressing «check» on the tables we wanted to send over. Stitch could not track actual changes in the database and rely instead on primary keys and timestamps to say if a row had to be updated or not. If we added a new column to a table, <a href="https://www.stitchdata.com/">Stitch</a> would know and simply add it in the next run, and since we specified the column names in the views we really didn’t notice or give the new field any attention until we needed it.</p><p>Even though Mode Analytics worked great for most dashboards and reports, we noticed its limitations in some regards, like its limited graph and report elements. For this reason, we decided to use <a href="https://www.tableau.com/">Tableau</a> on the side for the heavier reports that require more customization. This combination of a light and quick reporting tool where reports could be created in minutes and a heavier tool where “everything” is possible worked great for us. The only drawback is that the end-users would have to search for reports in both tools, but the advantages of having the flexibility and speed outweighed this.</p><p>A cool feature of Mode Analytics is that they support python notebooks directly in the reports with the most popular packages. We could create one or more SQL-queries to get the datasets, then instead of (or in addition to) adding graphs and report elements on top of them, we could also open the notebook tab and reference the data as pandas dataframes. Then when we had a visualization we wanted to show in the report, we could very simply add it to the report itself together with the regular elements directly on the SQL-queries. Whenever someone pressed “run” the SQL-queries would fetch the data, then the python code would run in the background and at last, the dashboard would appear with fresh data.</p><p>At this time we were 3 people on the analytics-team and through Mode Analytics notebooks we began doing some ad-hoc segmentation and analysis of the customers.</p><h3>Phase 3 — Advanced models and machine learning</h3><p>One year later we had another merger, this time with the largest mealkit-provider in Sweden, <a href="https://linasmatkasse.se/">Linas Matkasse</a>, making the combined group the leading mealkit-provider in the whole Nordics.</p><p>We were now about 200 employees split between the two countries. At first, we continued like before, just adding a “country” filter to all reports to be able to separate the numbers, however, we quickly realized that we had to do some changes to be able to support the new organization and its needs.</p><p>After some discussions internally in the Tech-department and with the management team of both countries we agreed on a data strategy going forward:</p><ul><li>move the data warehouse and the main pipeline tool to Azure</li><li>increase data knowledge and interest in all departments</li><li>make the data even more accessible to marketing and sales</li><li>transfer responsibility for the data catalog to the technical product owner</li><li>creating a forecasting model and getting some experience with machine learning in production</li></ul><p>I’ll explain briefly how we approached each of them.</p><h4>Moving to Azure</h4><p>Moving to Azure gave us a lot of advantages, mainly:</p><ul><li>same database type as the production databases, allowing us to use the same functions and syntax</li><li>same hosting provider as the production system, meaning that SLA, billing and support, both in the form of Microsofts technical architects and people internally with knowledge of the system was more available</li></ul><p>Since we went with a data lake approach where we loaded most of the data we could get our hands on into the data warehouse, we decided to go for a regular SQL Server database instead of Azure SQL Data Warehouse or Azure Data Lake. 99% of the data we are interested in using is structured, so the cost in terms of functionality and flexibility associated with changing to a data lake that supports unstructured data was not worth it for us. We don’t do too much ad-hoc analysis on top of large datasets so for most of our day to day use, a regular SQL Server database will handle it better than a data warehouse with fact tables and dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ifcg0Jo0JZWXmrZrXrSEYQ.png" /><figcaption>The current analytics architecture</figcaption></figure><h4>Become data-driven</h4><p>Perhaps the main objective of the new data strategy was to increase the data knowledge and interest in the other departments. People were using data and reports that were already built, but since the members of the analytics team were the only ones who could modify them or create new reports, many of the smaller questions were never asked.</p><p>To make it easier for the other departments to find answers to more of their questions without having to order a new report from Analytics, we had to find a tool that could do the following:</p><ul><li>both a way to write SQL for creating custom datasets and a click &amp; drag type of interface for asking questions on top of some pre-defined datasets</li><li>scheduled runs with email or slack notifications</li><li>a data catalog (so people could look up what the different datasets and columns were)</li></ul><p>After testing out a few different tools we decided on <a href="https://www.metabase.com/">Metabase</a>. It is open-source and supports all of our requirements.</p><p>With the tool set up, we started creating the most default datasets that would answer most of the questions people were asking as views in the data warehouse. We then added documentation and descriptions of the different fields and made them available in Metabase. The result is that employees from all departments now have pre-defined and curated datasets available that they can filter, aggregate and then save as a public or personal dashboard without any SQL or technical knowledge.</p><p>By this point, we had used Activecampaign for our marketing automation and Intercom for our chat and customer support tool for about 2 years and we were pretty confident we would continue with them in the foreseeable future. Up to this point, the sales and marketing teams had exported lists from Mode Analytics and then imported them with the fresh data into the systems, but manual CSV-imports always have a risk of incorrectly mapped fields. To mitigate this, we decided to build a customer sync module.</p><p>The customer sync module is built in Python and runs on top of our data warehouse. It is triggered by our company-wide scheduler service and compares the last synced data with current data to identify the customers we need to update. It then proceeds to add the customers a queue before starting the API-calls to update them. The result is that the marketing and customer support team now has all the fields they use for segmentation and personalization available and up-to-date directly in the tools they use so they can filter and create powerful automation.</p><h4>Transfer ownership of the data catalogs</h4><p>With the datasets easily available to the departments, we started noticing a gap between what the analyst responsible for the datasets and reports, and the technical product owner responsible for the whole module, workflows and production data model were working on. Examples of this could be new datasets on top of legacy tables that were not used, and fields and tables that were deprecated without the analyst being aware, resulting in bad datasets.</p><p>To handle this gap between the product owner and the analyst better we transferred the ownership of the data catalog for each module/department to the product owner. That way analytics-related things are discussed and prioritized together with the more traditional development tasks and the same person that decides changes in the module, now also controls the data products created on it.</p><h4>Creating a forecasting model</h4><p>We have an ongoing project to digitalize our processes through machine learning and statistical models. Currently, we are working on creating a forecasting model. Now that we are gradually reducing the time between order and the delivery, even more, we sometimes have to order from our suppliers before we know the final number of meal kits that were sold so getting a stable and digital forecast is key.</p><p>After testing out some different options we decided on <a href="https://facebook.github.io/prophet/">Facebook’s Prophet model</a>. Since our business is very season- and holiday-dependant, Prophet&#39;s ability to take the moveable holidays and actually move them to match the new year’s holiday plan was gold for us.</p><p>We also have a long-term goal of creating a near-real-time recommendation engine that uses the dishes you have chosen in the past and its data (ingredients, tags, difficulty, etc) to create a personalized mealbox alternative we can offer to our customers next to our tailored mealboxes. So the stack we built for machine learning and advanced models had to be prepared and able to support that in the future as well.</p><p>Now, some months later we have a completed stack with the model hosted and run on <a href="https://azure.microsoft.com/en-us/free/services/databricks">Azure Databricks</a>, while we have APIs to trigger and get the results, as well as a separate “analytics int-layer” database to make sure the data load from heavy queries and reports didn&#39;t impact the API speed. We’ll write another article covering this in more detail later on.</p><p>Meanwhile, you can read more about how we went about creating and testing the model in this article written by Anders, one of our data scientists: <a href="https://medium.com/godtlevert/experiment-driven-data-science-test-process-for-forecasting-a09ed3e57717">https://medium.com/godtlevert/experiment-driven-data-science-test-process-for-forecasting-a09ed3e57717</a></p><p>I hope you found this interesting and maybe even helpful if you are on a related path. If you are on a similar journey we would love to get in touch with you and share experiences. Reach out to <a href="https://www.linkedin.com/in/fredrik-gabrielsen-395a6279/">me</a>, <a href="https://www.linkedin.com/in/anders-westrheim-a20231151/">Anders</a> or our <a href="https://www.linkedin.com/in/alexander-aagreen-063a5745/">CTO</a> on LinkedIn if you are interested.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd4babc78dd8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/how-we-scaled-analytics-godtlevertgruppen-lmk-group-cd4babc78dd8">How we scaled analytics @ GodtlevertGruppen/LMK group</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sparket du trenger for å komme i gang med brukertesting]]></title>
            <link>https://medium.com/godtlevert/sparket-du-trenger-for-%C3%A5-komme-i-gang-med-brukertesting-2a05c531081?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/2a05c531081</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[user-testing]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[brukervennlighet]]></category>
            <category><![CDATA[brukertesting]]></category>
            <dc:creator><![CDATA[Ingrid Anderson]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 18:04:49 GMT</pubDate>
            <atom:updated>2020-01-20T12:46:07.364Z</atom:updated>
            <content:encoded><![CDATA[<p>De faglige rådene for brukertesting finnes allerede der ute. <br><a href="https://www.bouvet.no/bouvet-deler/5-tips-for-a-lykkes-med-brukertesting"><strong>HER</strong></a><strong> </strong>finner du tips underveis i testen og <a href="https://medium.com/netlife/tagged/brukertesting"><strong>HER</strong></a><strong> </strong>har Netlife samlet alt de har skrevet om brukertesting. For en gavepakke!</p><p>Jeg gir deg<strong> 7 tips som hjelper deg å komme i gang med brukertesting. </strong>Så kan du se tilbake på 2020 som året du ble rå på brukertesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDBnq9mHMTuZ0iRhcMA1sQ.jpeg" /><figcaption>Velkommen til test!</figcaption></figure><p><strong>1.Bestem en dato<br></strong> De fleste oppgir at de jobber best under press. Ikke bare setter du en tidsfrist for deg selv, men du muliggjør testingen for bedriften din, og viser at det er rom for testing.</p><p>Vi har også vært der du er nå. Vi ønsket å teste, men var litt for sent på planleggingen av brukertesten, så testingen måtte vike for å holde tidsfristen.<br>Nå har vi satt opp alle datoene for brukertester i Q1. Datoene er satt, tiden er satt av, og hypotesene dukker opp underveis. Det finnes alltid ting vi ønsker å teste, så gjør vi heller en prioritering når planleggingen starter.</p><p>Vi benytter <a href="https://www.productboard.com/"><strong>Productboard</strong></a><strong> </strong>for å få et godt oppsett så alle har oversikt over tester som er gjort, og tester som er planlagt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KU3GNeOjSJdngobUO8BkDQ.png" /><figcaption>Productboard organiserer for deg</figcaption></figure><p><strong>2. Legg tiden i forberedelsene</strong><br>Jo bedre forberedt brukertesten din er, jo større sjanse er det at du måler det du ønsker. Vær sikker på at hele gruppen er enige om hva som skal testes, og hva man ønsker å finne ut av. Sett av et møte og gå igjennom hypoteser, spørsmål og mulige utfall. Da ser man også hvilke tekniske forberedelser som må gjøres.</p><p><strong>3. Bruk hjelpen du kan få <br></strong>Ikke tenk at du skal vite alt i utgangspunktet eller lære deg alt med tutorials. Jeg har tatt et kurs i brukertesting, i regi av Netlife. Da fikk jeg både kunnskap, men også en stor motivasjon til å komme i gang. Det er noe med å bli kastet ut i det. Geriljatesting <strong>er</strong> kleint, men når du har vært igjennom det nok ganger får du desto mer selvtillit i brukertesten.</p><p>Rekruttering kan sies å være den største dørstokkmilen for å komme igjen. Tanken på å samle testbrukere som har kapasitet, som ikke skal være en samling av mitt inhabile nettverk. Jeg sparte meg selv for mye frustrasjon og ikke minst tid og kontaktet <a href="http://marte.oiene@norstat.no/"><strong>Marte</strong></a> i Norstat. En uke senere hadde vi første testgruppe klar.</p><p>Det koster rundt tusen kroner, men vi er sikret kandidater innenfor målgruppen til hver eneste test. I tillegg til at vi kan bruke tiden på testing og ikke på organiseringen av testpersoner som har gjort at vi kom raskt i gang.</p><p><strong>4. Få initativtakerne til å høre på testen<br></strong>Når <a href="https://www.linkedin.com/in/alexander-aagreen-063a5745/"><strong>CTO</strong></a> og <a href="https://www.linkedin.com/in/ole-alexander-eidsvold-144b528a/"><strong>produkteiere</strong></a> får innsikten om nettsiden rett i ørene(som observatører) blir de interessert i mer innsikt. Min opplevelse er at de er initiativtakere for videre tester, og bidrar mer i forberedelsene fremover. Få med deg resten av organisasjonen på laget ved å la de se det live.</p><p><strong>5.Enkelt utstyr funker bra! <br></strong>Vi har startet opp med <a href="https://whereby.com/user"><strong>Whereby</strong></a> for streaming, og Windows skjermklipp til opptak. Filmingen gjør vi med <a href="https://www.kjell.com/no/produkter/data-og-nettverk/gaming/streaming-tilbehor/plexgear-720-p-webkamera-p61271"><strong>dette</strong></a> webkameraet som gir oss mulighet til både opptak og live stream.</p><p>De fleste av våre brukere(og kunder) benytter iPhone, så vi har en iPhone 7 Plus de tester på. Da blir situasjonen så reell som mulig, samtidig som vi kan se tydelig hvor de trykker.</p><p><strong>6. Ikke gjør alt på samme dag <br></strong>Vi har lagt våre brukertester med 6 personer over to dager. Det kom frem etter noen brukertester at de kandidatene vi har sent på ettermiddagen har mindre å gi enn de vi har tidligere. Som moderator er man ikke like skarp på sin 6. brukertest, og testerne vil helst hjem til middag.</p><p>Splittet over to dager får vi tid til debrief mellom hver brukertest, vi kan legge til ting i notatene(så presentasjon av funn blir raskere og mer korrekt), og vi har en mulighet til å booke inn en ekstra person for å sikre at frafall ikke ødelegger testen.</p><p><strong>7. Presenter funn tidlig</strong>, i en kort og god rapport. <br>Du jobber ikke i et selskap som driver ene og alene med brukertesting(mest sannsynlig ettersom du leser denne artikkelen), så ikke bruk alt for lang tid på å lage en korrekt rapport. Hent ut det du trenger av innsikt. Legg bugfix og idéer rett i<strong> </strong><a href="https://www.productboard.com/"><strong>Productboard</strong></a><strong> </strong>og spar på viktige funn i et samlet dokument så utviklingen ikke går i sirkler.</p><p><strong>Lykke til med brukertestingen!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a05c531081" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/sparket-du-trenger-for-%C3%A5-komme-i-gang-med-brukertesting-2a05c531081">Sparket du trenger for å komme i gang med brukertesting</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experiment-driven data science test process for forecasting]]></title>
            <link>https://medium.com/godtlevert/experiment-driven-data-science-test-process-for-forecasting-a09ed3e57717?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/a09ed3e57717</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[reduce-food-waste]]></category>
            <category><![CDATA[foodtech]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Anders Westrheim]]></dc:creator>
            <pubDate>Tue, 12 Nov 2019 18:17:10 GMT</pubDate>
            <atom:updated>2019-11-12T21:42:18.459Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*bWMJMSLSGGMbvDmmSb0kbg.jpeg" /></figure><p>We order weekly large quantities of fresh produce for our marketing leading brands (Godtlevert, Linas Matkasse &amp; Adams Matkasse) from a selection of local food producers who land on dinner tables around all of Sweden and Norway. What is unique about our dinners is that we only order the raw materials we need so that we avoid having to throw food away at our warehouse (#reduceFoodWaste). This unique model means that we always provide our customers with the freshest ingredients without compromising!</p><p>Nevertheless, our local producers should make sure that they have grown and produced the right amount of food that we expect to put on the table at home with all our customers. Growing the best produce takes time, so our purchasing department starts 10 weeks before it should be at your doorstep to send as accurate estimates as possible to the food producers so they know what needs to be cultivated.</p><p>Within the Analytics team, we work actively with improving these estimates.</p><p>We have developed a forecasting routine that captures certain trends and movements on orders in the product catalog to give a more exact prediction for the number of orders.</p><p>This project followed a different structure than other model projects we have delivered. We have named this an experiment-driven testing process, where we conduct experiments and define the next point of interest as a result of the past experiment, iteratively. Since we are scaling our business in multiple markets, we are capturing more data faster, which makes us able to iterate at a higher pace!</p><p>Let’s first take you through the technical specs of the project.</p><h4><strong>Hypothesis</strong></h4><p>For the project, there had to be set some definitions as to what we considered a “good” fit. At the start of the project, there was a model existing for forecasting the number of orders per week. This was based on a number returned from looking at past years and combining this with an empirical observation of trend, looking at possible holidays, and if any campaigns were planned for the desired week. We decided that an eventual model should automate the process of returning a forecast, and should — if not better — give us the same Mean average percentage error (MAPE), being inside 3% in short-time (2–3 weeks before delivery). The different tests we performed to measure this will be mentioned later.</p><p>Our plan was to start with the Facebook Prophet model as a foundation, then progress into a model using estimations (expected orders), and finally, a campaign model to get to the sweet spot as we approached customer delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/0*NNGYw9As74pSzvaE" /><figcaption>Our expectations for this project</figcaption></figure><h4><strong>Facebook Prophet</strong></h4><p>As a first step in starting to forecast the number of orders, we used the <a href="https://github.com/facebook/prophet">Prophet</a> forecasting procedure developed by the Facebook Core Data Science team. The reason for deploying this (other than the simplicity) was that our historic order data had clear patterns that were caused by</p><ul><li>The occurrence of a holiday in a week (often a negative effect)</li><li>Seasonal effects (how the order pattern is similar on a yearly cycle)</li><li>Trend (both short-time and long-time changes)</li></ul><p>The model was able to fit the data well, with an average error of about 10% when looking at the upcoming 10 weeks. The model adopted the short-time trend (2–3 weeks until delivery) really well, but the error increased as we looked at deliveries in the latter part of the week interval (6–10 weeks).</p><p>This is still not where we wanted to be, and thus we wanted to look into how we could extend the result of the Prophet model, mixing in possible other factors.</p><p>The first thing we started with was to run and save snapshots of the <em>estimates</em> <em>data</em> (showing a live number of active customers with expected delivery for an upcoming week). This would give us a clue of where we would be in the number of deliveries <em>x</em> weeks ahead of any given week. By keeping a history of this, we wanted to see if there was a pattern in the movements leading up to a delivery week.</p><p>This leads us to a string of different experiments, and we noted that we would have a good stack to conduct these going forwards.</p><h4><strong>Building a foundation: our ML stack</strong></h4><p>Since this was our first project (of many) as a Data Science team, it was important for us to create a scalable setup to reduce the time spent on building the same components over and over again whenever we wanted to make a new model. So the first thing we did was to build and integrate a new ML product stack into our analytics stack:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUdBGilZR4EvzvSz0JCvTw.png" /></figure><p>We went for a self-contained data stack that would serve as a module in itself. That would allow us to restrict the purpose of the SQL Server analytics DB to be for reporting purposes, while the SQL Server ML DB would live in its own world with a web service on top of it serving endpoints for communicating (triggering model runs, reading model results) both internally (for the company/other core modules) and externally (for the customer).</p><p>Azure Databricks would be the model training entity, giving us both the possibility to serve once-a-night model scorings and the possibility of live scorings for future models (ex. building a collaborative filtering recommendation engine with Spark).</p><p>As the foundation of the stack was in place, we went on to define a structured process to handle the ML workflow.</p><h3>Experiment-driven testing process</h3><p>In order to arrive at a result, there is a technical ocean of possibilities. We decided that it was best to follow an <em>experiment-driven testing process</em> to approach this. To begin with, we started with brainstorming to define the first steps for the model, and through development and testing of these, there also appeared sidetracks we wanted to investigate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*59mIHid_kK4PjNPL" /></figure><p>To conduct the experiments one needs to define a test and a target. We measured <a href="https://en.wikipedia.org/wiki/Mean_absolute_percentage_error">MAPE</a>, Standard deviation (of the error percentages), and computed prediction intervals, with each experiment represented with its own row in a large test scheme matrix. The tests we ran the experiments through were:</p><ul><li><strong>Standard/regular test:</strong><br>Partition the historic dataset into train/test. Measure the errors on the test set.</li><li><strong>10 weeks test:</strong><br>When the model is ready to go into production, we want to train it with as much data as possible. So to be able to validate if it actually works to use all of the historic data and then guess the future (this may cause overfitting), we looked at the result from the viewpoint of a certain week and predicted the next 10 weeks. This was performed for weeks 1–41 in 2019 and compared to the actual order numbers.</li></ul><p>To find the weights to support the most optimal linear relationship <em>y ≈ w₁x₁+w₂x₂</em> between the prophet forecast (<em>x₁</em>) and the estimates (<em>x₂</em>), we iterated through the following five experiments:</p><h4><strong>EXPERIMENT 1: Linear regression</strong></h4><p>When you want to investigate the relationship between a set of variables — a general rule of thumb is to start with linear regression. We set out to find a model giving us a starting result to compare against. In this and the experiments that follow, we made the assumption that the function<em> y := y(t)</em> was dependent of the weeks until delivery, with<em> t</em> ∈ {1, 2, 3, 4, …}. Moreover, the experiment was performed with and without a categorical variable in the week number.</p><p>Takeaways:</p><ul><li>A standard linear regression will find <em>w₁, w₂</em> without having any concept in how the two variables <em>x₁, x₂</em> will behave (in our case they are two approximations of the same thing). This means that the coefficients might be negative and vary a lot, which does not correspond with our hypothesis being that the final result is a “weighted” average of the variables.</li><li>The final number of orders for a week seem to be much less influenced by the estimates the longer away from delivery we go. That is, the number of customers with a booked delivery 10 weeks before delivery can be similar for two separate weeks, while the final number of orders might be way different.</li></ul><h4><strong>EXPERIMENT 2: Least squares with a constraint on w₁, w₂</strong></h4><p>The motivation of this was the first takeaway of experiment 1. If we assume the relationship between the forecast and the estimate is a weighted relationship, it makes sense to introduce a constraint <em>x₁+ x₂ = </em>1, satisfying <em>x₁, x₂</em> ∈ [0,1].</p><p>A least-squares model with the above constraints produced a better result and a more clear practical translation in the sense that we could look at previous history and draw conclusions as to why the coefficients behaved the way they did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jZBSHpgRNFZ17rZYCyt_Q.png" /><figcaption>The modeled relationship <em>pred = w₁×(forecast) + w₂×(estimate)</em> for a certain week</figcaption></figure><p>In this experiment we tested (1) a model with freely chosen coefficients in [0,1] ∈ ℝ, and (2) a model where we assumed w₁ ∈ {0, 0.1, 0.2, … , 1}, <em>w₂ =</em>1 - <em>w₁</em>(where <em>w₁</em> with the lowest MAPE on the training data was chosen and rounded).</p><p>The takeaways from this experiment were that we still suffered a lot of variance on the estimate predictor. If we look at the graph above, a natural next target would be to try to normalize (or at least find an approximation) to the final value of the estimates, especially when we are far from delivery.</p><h4><strong>EXPERIMENT 3: Linear regression with an estimation curve</strong></h4><p>To solve the issue from the takeaway of the previous experiment we proposed the following method: Assume the estimates <em>x₂ </em>:=<em> x₂</em>(t) are time-dependent, may be extrapolated to a nth-degree polynomial curve and thus deduce a new variable <em>x̂₂ := x₂</em>(0)(the estimate at the point of delivery) which we will call <em>final_estimate </em>(and is a prediction of the final order number).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*B7SqHcwp4xLH3Vr-D3fz1w.png" /><figcaption>An estimations curve versus the observed data on the number of days until delivery</figcaption></figure><p>The curve was fitted for and then normalized it by dividing by the estimate in the specific week we were in. On top of this, we tested a standard linear regression <em>y</em> ≈ <em>w₁x₁+w₂x̂₂</em>, and the results improved the prediction errors significantly.</p><h4><strong>EXPERIMENT 4: Combining the least squares model with the estimates curve</strong></h4><p>The success of the past two experiments was a clear indicator for us that we should test the combination of the models. The problem we’re interested in solving now is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N76cv1EyHoE7Lvs0SvTHHg.png" /></figure><p>Where <em>x₂</em> represents the estimations curve deduced in experiment 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQh-WSDE1ub4k8AFKNU-Og.png" /><figcaption>Aprroaching delivery for a specific week in 2019; pred = w₁×(forecast) + w₂×(final_estimate)</figcaption></figure><p>From the resulting graph above we see that the final_estimate curve helps to approximate the actual number a lot and that the least squares model contributes as a weighted average (approximately).</p><p>By now we were pretty satisfied with the overall model. If we think about the graph in the hypothesis, we see that the below graph is starting to get pretty close to what we wanted. After all there was a pattern here, and we found it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*flSEzPJAGKKnVMrTZiqMvQ.png" /><figcaption>Comparing this experiment to the Prophet model alone, showing significant error improvement</figcaption></figure><h4><strong>EXPERIMENT 5: Validation of fit (dataset division)</strong></h4><p>As we got the results we wanted from the previous experiment, we wanted to conduct a fifth experiment to verify the validity of the model. This was merely a step to be comfortable with the estimations curve model and assure that it wouldn’t overfit. It was conducted in the following way:</p><ol><li>From the full dataset, we used 70% as training data, while for the remaining 30%, we made 80% of it validation data, and the rest test data.</li><li>Trained Prophet Model on training data, forecasted orders for the validation dataset.</li><li>Fit the estimations curves for the validation data.</li><li>Train Prophet model on training and validation data, forecast orders for the test set</li><li>Apply the estimations curves made in step (3) for the test set.</li><li>Measure the error in both the validation and test set for steps (3) and (4).</li></ol><p>This model will be run in parallel with the above model, giving us a validation that the model output is trustworthy.</p><h3><strong>Conclusion</strong></h3><p>We saw that this method of approaching the project — by looking at the process iteratively and determine the integration of the experiment to the model by measuring the errors — gave us acceptable results quicker than our other modeling projects. We are continuously tweaking the model parameters, but doing so in an iterative fashion: implementing, testing errors, integrating with production codebase.</p><p>It was important to have a tech stack that supported the experimentation process. With this, we are able to create new projects, even in parallel with ongoing processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a09ed3e57717" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/experiment-driven-data-science-test-process-for-forecasting-a09ed3e57717">Experiment-driven data science test process for forecasting</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Egenutviklet teknologi skaper morgendagens middagsopplevelser]]></title>
            <link>https://medium.com/godtlevert/egenutviklet-teknologi-skaper-morgendagens-middagsopplevelser-aa1f8765d8da?source=rss----e430e9c6fedf---4</link>
            <guid isPermaLink="false">https://medium.com/p/aa1f8765d8da</guid>
            <dc:creator><![CDATA[Alexander Aagreen]]></dc:creator>
            <pubDate>Sun, 03 Nov 2019 12:27:12 GMT</pubDate>
            <atom:updated>2019-11-03T12:27:12.444Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*BTf6ZCMNr_t8ScIB1SLARw.png" /></figure><p>Med stadig større forventninger og krav fra kunder i tidsklemmen, beveger vi oss raskere enn noen gang. Vi har brukt teknologi for å møte kundens behov i 2020.</p><p>Vi ønsker å levere de middagene kundene ønsker seg, allerede dagen etter. Det har vi realisert med tjenesten Flex som vi lanserte 1.november.</p><p><strong>I Flex kan kundene bestille kl.23.59, og får det levert dagen etter.</strong> Dette i tråd med deres ønsker om å planlegge mindre og kortere tid i forveien, for en mer smidig hverdag.</p><p>Heldigvis utvikler vi teknologien raskere enn stresset i familien sprer seg. For å ha muligheten til å levere dagen etter, er nemlig egen produksjonsteknologi og gode prognoser avgjørende!</p><p><strong><em>Prognoser<br></em></strong>Med god data og kunstig intelligens kan vi nå bedre estimere salget i forkant og ha prognoser som treffer innenfor 2% nøyaktighet. Prognosen tar hensyn til foregående ukers leveringstall, kampanjer og ikke minst sesongvariasjoner for å treffe så nærmere som mulig. Dette gjelder både antall kunder, men også hva kundene vil velge.</p><p>Med dette kan vi unngå store mengder svinn. For svinn handler ikke lenger bare om å ha en bærekraftig tjeneste økonomisk sett, men at vi vil og må tilby en tjeneste som er bærekraftig miljømessig også.</p><p><strong><em>Høyteknologisk pakkeri</em><br></strong>Med en mulighet for 2,1 millioner unike variasjoner i middagsretter hver eneste uke er det ikke lenger en standarisert matkasse. Pakkeriet er omstilt til å være høyteknologisk for å håndtere spesialpakkede leveranser til hver kunde.</p><p>Pakkeriet vårt benytter nå spesialtilpasset teknologi som optimaliserer scanningrekkefølgen av hver vare. Dette gjør at pakkeren går gjennom pakkelinjen kun en gang, og alle varene ligger opplagt etter hvordan de best hensiktsmessig kan pakkes i esken. Vi har med dette sikret en tidsøkonomisk pakkeprosess, i tillegg til at sjansen for feilpakking blir marginal.</p><p>Med god bruk av data og teknologi kan vi derfor tilby morgendagens tjeneste på en bærekraftig måte. Vår egen teknologi var det som åpnet muligheten for morgendagens middagsopplevelser.</p><p>Les mer om Godtlevert Flex <a href="https://godtlevert.no/flex"><strong>her</strong></a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa1f8765d8da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/godtlevert/egenutviklet-teknologi-skaper-morgendagens-middagsopplevelser-aa1f8765d8da">Egenutviklet teknologi skaper morgendagens middagsopplevelser</a> was originally published in <a href="https://medium.com/godtlevert">Cheffelo  — Tech &amp; Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>