<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeremy Bradley on Medium]]></title>
        <description><![CDATA[Stories by Jeremy Bradley on Medium]]></description>
        <link>https://medium.com/@jeremytbradley?source=rss-98a6cf82e7f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*f9ikHknHGyc6mI6W.jpg</url>
            <title>Stories by Jeremy Bradley on Medium</title>
            <link>https://medium.com/@jeremytbradley?source=rss-98a6cf82e7f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:32:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeremytbradley/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How data science and data transparency can help save the planet]]></title>
            <link>https://medium.com/datasparq-technology/can-data-science-and-data-transparency-help-save-the-planet-d537349bc25e?source=rss-98a6cf82e7f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d537349bc25e</guid>
            <category><![CDATA[carbon-emissions]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[carbon-accounting]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[climate-change]]></category>
            <dc:creator><![CDATA[Jeremy Bradley]]></dc:creator>
            <pubDate>Wed, 15 Feb 2023 12:26:26 GMT</pubDate>
            <atom:updated>2023-02-15T14:00:54.170Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>With current carbon offsetting processes being dubiously effective, we suggest a data-driven approach that companies can use to become reliably sustainable and protect themselves from punitive investor and government action.</em></strong></p><figure><img alt="Approximately 120 stacked fans of roughly diameter 2m, situated in a desert used in the direct air capture of CO2" src="https://cdn-images-1.medium.com/max/1024/1*yU8u93yHTHBTatArduUj9w.png" /><figcaption>An array of fans blow air through a carbon dioxide-absorbing material in this mock-up of a direct air capture plant. © Carbon Engineering</figcaption></figure><p>The Paris climate agreement was important — vitally important — not because it meant that it solved the problem of climate change — it did not. Nor did it mean that the world’s governments were able to agree on a mechanism for greenhouse gas reduction, that is clearly a path much longer in the making. It was important because it represented a global, multi-nation-state backed, statement of intent to try to limit average global warming to 1.5C.</p><p>Now that has happened it is up to us: citizens, employees, colleagues, companies, organisations… to take a lead. Even if successive COPs seem woefully inadequate in ambition and outcome, it actually doesn’t matter — we now have a global call-to-arms and a goal that needs to be met. And increasingly as many cities and states across the world are finding out, it matters less and less whether national governments are able to reach a consensus or not.</p><p>As data scientists and engineers, we have our challenge — and in the (nearly) immortal words of Matt Damon as Martian astronaut, Mark Watney:</p><blockquote><strong>“You solve one problem… and you solve the next one… and then the next.</strong> <strong>And If you solve enough problems, you get to save the planet!” — Mark Watney</strong></blockquote><p>That sounds like something we can get behind.</p><h4><strong>So how can this happen and why isn’t it happening yet?</strong></h4><p>The challenge for companies that quite genuinely want to reduce their impact through their operations or services is that they have no easy way of understanding the real costs and downside risk of continuing as they are. Most companies have everyday pressures to maintain or improve their financial bottom line and those are easily understood and accountancy practices are put in place to monitor and support that goal. There are very few companies who monitor and report openly on their carbon bottom line and it is not clear how one could even convert between carbon and cash, especially in jurisdictions where there is no hard requirement to do so.</p><blockquote><strong>There is no easy or consistent way of computing the financial downside of pumping millions of tonnes of CO<em>₂</em> into the atmosphere.</strong></blockquote><p>Even for companies who are engaging in offset activities such as carbon credits, there are many pitfalls and no guarantees that carbon is actually being sequestrated and removed from the atmosphere [5].</p><p>It is very clear that where there is not now specific environmental legislation governing the release of greenhouse gases in a country, it is a safe assumption that there will be such legislation in many countries in the next 10 years. (Nevertheless without legislation, the pressure today from institutional investors to reach net zero is significant, as evidenced by one of the largest global funds, Norway’s Sovereign Wealth fund [1,6]).</p><p>What form any legislation takes will of course vary: carbon credits, carbon trading, carbon taxes, carbon limits, possibly consumer carbon rationing if things get really bad. Each of these options carries a financial impact on companies as well as being variously effective in reducing greenhouse gases.</p><p>Although legislation is rarely retrospective it is also a significant possibility that some key polluting industries, e.g. the oil and gas sector, energy generation sectors, may well be asked to be, not just carbon neutral but significantly carbon negative in the future; this will allow those industries to unwind some of their historic carbon debt if done correctly.</p><h4><strong>And the data science in this?</strong></h4><p>Readers of this series will know how much we use and value reinforcement learning (RL) and RL thinking in our approach to data science.</p><p>The reinforcement learning paradigm applies to business operation as much as it does to data science execution. A business is every bit an RL machine — it has levers it can pull, decisions it can take, projects it can try. From those decisions a well-run business will try to quantify their success and from that learnt success or failure, future decisions and projects are initiated.</p><p>If that success quantification process (in RL terms, the reward function) excludes a major element of the operation of the company — the cost of removing huge amounts of CO₂ from the atmosphere — then a company will never learn the correct behaviours and decisions to operate in a sustainable way. Never!</p><blockquote><strong>What is needed is an accurate quantification of the cost of removing CO₂ from the atmosphere (so-called CDR) that can be established as a baseline measure for carbon removal.</strong></blockquote><h4><strong>Hard to quantify costs around CDR</strong></h4><p>There is a good reason for not currently being able to quantify the carbon cost easily— because carbon mitigation is complex and a fast changing picture: do you plant trees which require land and long periods of time, do you invest in sustainability projects, do you pay someone for a carbon certificate? What do these mean and do they even achieve the goal of removing carbon from the environment?</p><p>An organisation that generates greenhouse gases now and wants to reduce that impact, has broadly two options:</p><ul><li>change the operation so that they reduce or don’t emit carbon in the first place</li><li>acknowledge that some carbon is part of their current operational cycle and attempt to mitigate it through various removal approaches</li></ul><p>Each of these possibilities carries implementation challenges. But for a business to know whether its worth changing its operation it needs to accurately understand the actual cost of carbon mitigation.</p><h4><strong>Direct Air Capture of CO₂</strong></h4><p>So now we have established the need for a standard cost metric for atmospheric carbon removal or CDR, we need a standard process that can be costed. Enter Direct Air Capture or DAC.</p><p>The process behind Direct Air Capture is relatively simple and starts with a similar chemical reaction to the one used on the Apollo moon missions to remove CO₂ from the various manned space capsules.</p><p>As shown below, ingested atmospheric air (with usually only 450 parts per million of CO₂ as of 2023!) is passed through a potassium hydroxide solution. This effectively scrubs the air of CO₂ but leaves a solution of potassium carbonate. Fortunately potassium hydroxide can be recovered from the carbonate salt by means of a pellet reactor and a calcium hydroxide solution. While the potassium hydroxide can be reused directly, the resulting calcium carbonate needs to be further treated in order to extract the CO₂ (for compression and storage) and turned back into calcium hydroxide via a final slaking process.</p><figure><img alt="A process diagram representing the chemical process behind direct air capture of CO2. It shows air being ingested on the left and CO2 being produced on the right." src="https://cdn-images-1.medium.com/max/1024/1*9nvyU7gE5a2cG8VNNduDtw.png" /><figcaption>The chemical extraction process behind Direct Air Capture of CO₂ (from Keith <em>et al</em>. [3])</figcaption></figure><p>This all looks very neat — the circularity of the two central processes obviates the need for large amounts imported chemicals. Just as well considering we will ideally need to extract in excess of 37 billion tonnes of CO₂ per year [4] by one means or another (including vegetation growth and oceanic absorption) just to keep at the position we are today.</p><h4>But where’s the catch?</h4><blockquote><strong>However this seemingly saviour process comes with a big catch — it is enormously energy intensive.</strong></blockquote><p>According to [3], it takes 67MWh of energy to capture 170 tonnes of atmospheric carbon dioxide using this process. This may seem like a huge negative and it is indeed a practical challenge of implementation.</p><p>For our purposes however, it is exactly what we need to know. Electricity is sold on the wholesale market by the MWh. Currently, as I write, the price of electricity on the UK’s National Grid is retailing £207 per MWh. This gives us a means of pricing CDR both in the short term, and over the longer term. At that price it would cost an eye watering £81 per tonne of CO₂ removed. For context, this figure has regularly dropped to £30-£40 per tonne and the average cost per tonne of CO₂ removal has been £61.85 in the last week in the UK.</p><p>Actually it’s worse than that because the UK Grid is also currently operating at a carbon intensity of 134gCO₂/kWh, but this can be taken into account (as it clearly ought to be). Removing the carbon from the electricity generation as well, gives an adjusted price of £86.13/tonne.</p><h4>In general</h4><p>For a generic CDR technology (<em>t</em>) that takes <em>Eₜ</em> MWh to extract <em>Mₜ</em> kg of CO₂ with an energy cost of <em>Cₛ</em> $/MWh where the energy source (<em>s</em>) has a carbon intensity of <em>Iₛ </em>gCO₂/kWh, the $ cost per kg of CO₂ removal is:</p><figure><img alt="\frac{E_t C_s}{M_t — I_s E_t} where I_s E_t is much less than M_t" src="https://cdn-images-1.medium.com/max/332/1*ZU9vkRboFEOtZ9mXv3mg0Q.png" /><figcaption>Formula for cost per kg of extracting carbon dioxide from the environment</figcaption></figure><h4>Constructing the Carbon metric</h4><p>You would of course not want to sample the spot market price for electricity to give you your carbon metric, you would for instance:</p><ul><li>take a rolling average over a period of time</li><li>find a market where electricity was cheap and itself low-carbon</li><li>perhaps only pay for DAC at times when the wholesale price of electricity has dropped below a certain point</li></ul><p>All these are achievable and can be reflected in a suite of metrics to conform to a gold-standard actual cost of carbon removal for an organisation that has no other way of reducing its operational carbon output but wants to do the right thing!</p><h4>Conclusion</h4><p>There we have it. As my colleague James Tawton more succinctly put it:</p><blockquote><strong>It’s complicated, but we can now expose the costs and savings implications of CDR via direct air capture as part of this data-driven model. With this, organisations and companies can ensure the financial, legal and ethical integrity of their sustainability strategy.</strong></blockquote><p>For now an idea, but one we are looking to implement. We work with companies who generate carbon dioxide in various parts of the world through heavy fleet movements, flights, supply chains, etc. We will now be able to introduce realistic cost metrics into our optimisation algorithms that can take into account carbon capture and removal (after first minimising the carbon generated).</p><p>I am sure it will generate some interesting discussions but as companies realise that they are going to be liable for this carbon removal cost at some point, it’s probably a good idea to set that money aside now. Even better, start investing in carbon removal technology and plants now and ensure that it is in a form they can be 100% sure actually does the job.</p><h4>Postscript: Saving the planet?</h4><p>To be clear I am not advocating using DAC as the core technology for carbon reduction in the future — it is more by way of a upper bound on what we may have to do [7]. If other approaches involving increasing global vegetation cover, rewilding, restoring peat bogs, and just burning less stuff can be used and <strong>importantly verified </strong>[5] then they will likely be easier and much cheaper. DAC of some variety is part of the mix of approaches that we will need to rescue our planetary ecosystem [2].</p><p>But let’s play the thought experiment. If we were to put aside a sum of money and an energy budget to reverse carbon dioxide concentrations in the atmosphere — what would that look like?</p><p>Using the UK’s grid statistics for the last year, 2022, (which was a high cost year for lots of reasons): £194.79 per MWh at an intensity of 178gCO₂/kWh gives a cost metric of £94.61 per tonne of CO₂ extracted.</p><p>If we plan to remove all annual CO₂ emissions and start to reverse atmospheric concentration levels we probably want to plan to remove around 40 billion tonnes annually. That would be £3.78tn or $4.58tn per year of OPEX cost (roughly 4.1% of annual global GDP). To be clear though this would need us to divert around 55% of current globally generated electricity (based on 2021 generation [8]) into carbon sequestration, so more efficient and cheaper techniques are definitely needed as well.</p><p><strong>And finally…</strong></p><p>If you are interested in joining us at <a href="http://www.datasparq.ai/">Datasparq</a> for exciting projects like this or just finding out how your company can benefit from our sustainable and ethical approaches to Data Science and Engineering, <a href="/service/mailto: info@datasparq.ai">please get in touch</a>. We’ll be delighted to hear from you.</p><p><strong>References</strong></p><p>[1] S. Feingold <a href="https://www.weforum.org/agenda/2022/09/norways-massive-sovereign-wealth-fund-sets-net-zero-goal/">Norway’s massive sovereign-wealth fund sets net-zero goals</a>. World Economic Forum, September 2022</p><p>[2] A. Owen, J. Burke, E. Serin. <a href="https://www.lse.ac.uk/granthaminstitute/publication/who-pays-for-greenhouse-gas-removal-in-the-uk-designing-equitable-policy-to-fund-beccs-and-daccs/">Who pays for greenhouse gas removal in the UK? Designing equitable policy to fund BECCS and DACCS?</a> Grantham Research Institute, LSE, August 2022</p><p>[3] D.W. Keith, G. Holmes, D. St-Angelo, K. Heidel. <a href="https://doi.org/10.1016/j.joule.2018.05.006">A Process for Capturing CO₂ from the Atmosphere</a>. Joule. Volume 2(8), pp. 1573–1594, 15 August, 2018</p><p>[4] I. Tiseo, <a href="https://www.statista.com/statistics/276629/global-co2-emissions/">Annual carbon dioxide (CO₂) emissions worldwide from 1940 to 2021</a>. statista.com. 3 January, 2023</p><p>[5] P. Greenfield. <a href="https://www.theguardian.com/environment/2023/jan/18/revealed-forest-carbon-offsets-biggest-provider-worthless-verra-aoe">Revealed: more than 90% of rainforest carbon offsets by biggest certifier are worthless, analysis shows</a>. The Guardian, 18 January 2023</p><p>[6] R. Neate. <a href="https://www.theguardian.com/business/2023/feb/03/worlds-biggest-investment-fund-warns-directors-to-tackle-climate-crisis-or-face-sack">World’s biggest investment fund warns directors to tackle climate crisis or face sack</a>. The Guardian, 3 February 2023</p><p>[7] S.M. Smith, <em>et al</em>. <a href="https://www.stateofcdr.org/">The State of Carbon Dioxide Removal: A global, independent scientific assessment of Carbon Dioxide Removal</a>. 1st Edition. University of Oxford. January 2023.</p><p>[8] <a href="https://www.statista.com/statistics/270281/electricity-generation-worldwide/">Electricity generation worldwide from 1990 to 2021</a>. statista.com. 16 Jan 2023.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d537349bc25e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datasparq-technology/can-data-science-and-data-transparency-help-save-the-planet-d537349bc25e">How data science and data transparency can help save the planet</a> was originally published in <a href="https://medium.com/datasparq-technology">Datasparq Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[War stories from using Reinforcement Learning for Dynamic Pricing]]></title>
            <link>https://medium.com/datasparq-technology/war-stories-from-using-reinforcement-learning-for-dynamic-pricing-5f7fa3054446?source=rss-98a6cf82e7f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f7fa3054446</guid>
            <category><![CDATA[ai-for-business]]></category>
            <category><![CDATA[primer]]></category>
            <category><![CDATA[practical-tips]]></category>
            <category><![CDATA[dynamic-pricing]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Jeremy Bradley]]></dc:creator>
            <pubDate>Tue, 21 Dec 2021 12:25:20 GMT</pubDate>
            <atom:updated>2021-12-21T12:27:11.361Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Search for something that works and then remember it. Search and memory is the essence of Reinforcement Learning —<strong> Andrew Barto</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O45BsOLAKxpp8kfi.jpg" /><figcaption>Found it! Inflatable decoy tanks were deployed on the south coast of England during WWII to fool the enemy into believing that the real D-Day landings were taking place around Calais</figcaption></figure><p>As a Data Science team, we were lucky enough to get into Reinforcement Learning [1] or RL a couple of years ago when we started looking at optimal pricing for car parking spaces at an international airport [2].</p><p><strong>Airports and Dynamic Pricing</strong></p><p>It’s an interesting problem, you have a fixed resource, the car park spaces themselves, and you have customer demand which varies over time — largely with demand for airline travel. You also give people the ability to book spaces well ahead of time. What price do you set?</p><figure><img alt="An airport car park with aeroplane flying overhead" src="https://cdn-images-1.medium.com/max/1024/0*gxFrGul2iXAqrieH.jpg" /><figcaption>Airport car parks presents a challenge for optimal pricing</figcaption></figure><p>Imagine you run such a car park and have the power to set prices. If you wait a couple of days, you might get a higher price from another customer for the same date. If you lower your price for that date because you haven’t sold the spaces and the date is approaching, your customers might quickly learn that waiting is the best policy and not book when they first check the car park website.</p><p>Furthermore, customers that book for a weekend might well be families or tourists looking for a quick break who are perhaps booking with a low cost airline. If they’ve paid £67 for a return trip to Majorca, they’re likely to think that £75 for a weekend parking spot is a little on the high side. Whereas your business traveller might think that is entirely reasonable or just not an expense they’ll be picking up at the end of the day.</p><p>The ability to learn what price works for a given demand, for a given day of the year, with a given booking lead time is a good example of dynamic pricing.</p><p>Dynamic pricing is a growing area of data science and a long-standing problem in operations research and one that is enjoying much more attention as marketplaces themselves become more dynamic.</p><p>What makes these problems amenable to reinforcement learning is vast event data sets around customer interactions. This gives an RL tool the ability to deduce the demand level (as well as, potentially, need and urgency) for a particular cohort of customers and thus find a customer specific price that will lead to a well used resource.</p><p><strong>Why dynamic pricing?</strong></p><p>Before we get into the reinforcement learning and how it can power dynamic pricing, we need to understand a few use-cases for why prices might need to change in more general settings.</p><ul><li><strong>Increased demand/reduced supply. </strong>As in any economic model, if supply does not match demand for a product then the market may be able to sustain a higher price.</li><li><strong>Expiring products.</strong> Anything that has a limited sale window is likely to attract varying a price, whether it’s a hotel room for tonight, a loaf of bread that’s about to reach its expiry date, or a plane ticket on a flight. None of these can be sold after the window has passed.</li><li><strong>Seasonality</strong>. Some products are much more desired at certain times of day or times of year. Some may not be available at all at the wrong time. Christmas decorations typically get discounted heavily after Christmas as retailers don’t want to stock them for the whole subsequent year waiting for them to sell.</li><li><strong>Cost of production/supply.</strong> Some products cost more to produce on demand than on the normal production run. For example Brompton, the folding bike manufacturer based in London, typically has a 5 week lead time for a normal folding bike but that can be reduced to 5 days with tracked delivery if you are prepared to pay a premium for a model. The implication is that there is a reason to charge a varying price more closely linked to the cost of production (and possibly the customer’s willingness to pay for a quick delivery — see below).</li><li><strong>Price by customer.</strong> Possibly the most contentious reason to charge a dynamic price — certainly in mass retail — is the act of setting a different price for the same product to different customers. Sometimes this is veneered over by selling in different markets, e.g. electric cars in the US versus the EU market. But within a market, it may be desirable to identify customers who are time-limited and are not looking at competitor products, and may be willing to pay more for a standard product.</li></ul><p>Varying a price to reflect super-high demand or capture a high need customer is not always the right thing to do. For instance, airlines charging thousands of pounds for seats on the last flight that makes it home before an enforced quarantine period starts or a taxi company surging prices in the face of a civil emergency — can lead to considerable long-lasting reputational damage. Important to consider— is it the ethical thing to do?</p><p><strong>Reinforcement Learning and what to watch out for!</strong></p><p>We’ve been working on a dynamic pricing project for the last few months. It’s a market-place environment where customers are exposed to a set of agents offering a service and we have to work out what price to set. The marketplace takes a cut of the fee paid and the service providers get the rest.</p><p>Basic features:</p><ol><li>Customer demand is seasonal and varies dramatically across the day — it is also price sensitive.</li><li>The service providers are a limiting resource — if they’re working for a customer they can’t be doing other jobs for other customers.</li><li>The higher the price, the more the service providers want to offer the service and the quicker a match is made.</li><li>The lower the price, the better for the customer — of course — but also the longer they may be kept waiting for a match with a possible service provider and indeed they may get no match at all.</li></ol><p>How do you set prices in such a setting so that you offer a fair price to the service providers and yet don’t fleece the customers. Well you can use reinforcement learning. We don’t know the price that is appropriate but we can set one and see what impact it has on the market — then we can learn and in the next epoch adjust accordingly.</p><blockquote>Reinforcement learning at its root, is just memoized context-sensitive search. You do some operation and then you remember the result and then the next time you have to do that, you look it up — <strong>Rich Sutton</strong></blockquote><p>If you read any reinforcement learning text book, you’ll find a diagram very much like this describing the basic principles. In this instance, the agent is the marketplace, the action is the ability to set a price and offer it to the customer, the state is the state of the marketplace (I know that’s self referential but we’ll revisit that) and the reward is a measure of success from having made a successful match between customer and service provider. Again we’ll come back to this because it’s not straightforward and it will drive the whole optimisation of the system. There can be a choice between many possible actions reflecting the possible prices that may be offered in the marketplace. Each action may lead to a distinct change of state and a different reward associated with that change.</p><figure><img alt="A feedback loop depicting an agent taking an action, and reacting to the reward and change of state from the environment that consumed the action." src="https://cdn-images-1.medium.com/max/984/1*nQBVz20wyXh1eezFG6cVMQ.png" /><figcaption>The reinforcement learning loop. CC by-SA 4.0 Jeremy Bradley</figcaption></figure><p>So what does the Agent do — well the marketplace learns from successful matches and unsuccessful matches and adjusts the price (or not) accordingly as each new opportunity to make a match comes round. There are maybe 20,000 transactions a day and prices are set in near real time.</p><p>I think the three most important aspects to doing this kind of activity with reinforcement learning can be summarised with:</p><p><strong>What’s in a state?</strong></p><p><strong>Quick primer</strong>: Reinforcement learning comes out of a branch of mathematics called dynamic programming which solves an underlying Markov Decision Process for a value function. Deriving a value function gives you a policy which in turn tells you which actions you should take in a given state.</p><p>That was lots of jargon so let’s break that down— a <strong>value function</strong> computes the value of each state of your system under a given action policy; knowing which states are high value is important when discovering a better policy. A<strong> policy</strong> is a pre-defined strategy for choosing which action to take from a given state, ideally to maximise your accumulated lifetime reward. A <strong>Markov Decision Process</strong> or <strong>MDP</strong> is a state transition system which defines the states, actions, rewards and next states for any system.</p><figure><img alt="A Markov Decision Process probabilistic transition system depicting states in green and actions in brown. Two of the actions result in distinct rewards of -1 and +5." src="https://cdn-images-1.medium.com/max/1024/0*umbiYLQFjQxM0tQ6.png" /><figcaption>A simple 3-state MDP with actions in brown and rewards +5 and -1 marked. CC by-SA 4.0 Waldo Alvarez</figcaption></figure><p>What’s this got to do with states? If the underlying mathematical model (MDP) has too many states, then the dynamic programming algorithm will take forever to converge (or a very long time anyway). i.e. you’ll never get a solution and you won’t know what action to take — or price to set in this case — to improve your overall lifetime reward.</p><p>It is very easy to inadvertently give yourself an enormous state space. We have a marketplace that spans 850 locations across the world and we want to set prices every 15 minutes, we have 20 levels of customer demand and 20 levels of service provider supply, and 20 possible price bands. That’s a little over 4.5 billion states right there!</p><p>Surprisingly this is not necessarily a disaster as you can represent your state space approximately using a deep learning neural network of some other ML model but it definitely adds to the complexity as we’ll see when we try to learn with it.</p><p><strong>What does success look like?</strong></p><p>Success is defined by your reward. You might think that success is easy to specify. Why not choose revenue or profit and watch the dollars roll in. Well yes and no. Let’s imagine we used revenue in our marketplace.</p><p>If I have some very rich customers, then I can set my prices very high and I may initially even make a lot of revenue. However, I have inadvertently made my market very brittle and subject to the whims of a few well-off customers who are now dominating the market. Every other customer is priced out and will probably never come back.</p><p>So let’s lower the prices so that I open myself up to more of my customer base. The prices are still high. The revenue is improved because the customer base is larger, but there are service providers who are now turning down small jobs that are too low in value in the hope that a higher value job will come along shortly. Many customers with smaller jobs are left waiting for an unacceptable period of time before they get a price match. But that is ignored by the reward metric as it only cares about revenue in this case.</p><p>Again this is a short term win. Those customers left hanging around probably never return to your marketplace even when they have larger jobs to offer. In the end, low customer satisfaction kills your business.</p><p>What we found is that a hybrid reward metric which captures both financial success and customer satisfaction will allow you to find a sweet-spot in your problem — keep the service providers happy with a decent revenue while keeping the customers happy with a good performance metric.</p><p><strong>Can it learn?</strong></p><p>Reinforcement learning works best when it learns as you might expect. Successful learning comes from convergence of the algorithm and gives you a consistent result for the value of being in a particular state.</p><p>If you’re using an explicit state space model (sometimes called tabular learning, so not a neural network) you need enough training data or learning episodes to visit each state many thousands of times to get converged learning. (Converged learning refers to the model having a consistent picture of what value the most important states and actions have).</p><p>Now we know why keeping track of the state space is so crucial. If you’re using tabular learning which is simple and has many benefits you have to have a pre-training set that is 100x or 1000x the number of states in the state space or at least the number of states you are likely to visit. Alternatively, if your model is learning from scratch, your learning feedback loop needs to visit all of those states 100s or 1000s of times to get converged learning.</p><p>If you’re using an approximate state deep learning model for very large state spaces, you won’t be surprised to learn that many gigabytes of training data are needed to train that model effectively.</p><p>Certainly, if your training data only visits each state once or twice, your learning is going to be very poor and your recommended prices or actions are not going to be great!</p><p><strong>Wrapping up</strong></p><p>I’ve really only touched upon reinforcement learning as a mechanism for learning optimal prices. There’s lots of benefit to getting it right — an algorithm that can learn autonomously and present the right price for even new unseen scenarios; an algorithm than can even look after customer satisfaction if the correct reward structures are put in place to guide learning.</p><p>There are many ways you can get yourself in a tangle. But keeping the state space at a reasonable size that can match the available training data you have (or are likely to encounter during learning) is a great start and defining an appropriate reward metric will help you drive your learning in the right direction while not making embarrassing decisions along the way.</p><p>This introduction is still only the tip of the iceberg but it reflects some of the key decisions we had to take when taking reinforcement learning from the text book [1] (which is quite excellent by the way!) to a real-life project. Other significant considerations include:</p><ul><li><em>exploration versus exploitation</em> — at some point you’ll need to take a suboptimal decision to see whether it leads to a better policy that was previously unknown. This can trigger some interesting conversations with stakeholders!</li><li><em>discount factors </em>— how much do you value reward that can’t be realised for weeks or months versus reward you can access today?</li><li><em>learning rates</em> — how quickly should your learning system adapt to new evidence or is your data quite noisy, thus meaning you don’t want it to adapt to a blip by mistake.</li><li><em>algorithm </em>— where to start; tabular or approximate representation, Expected-SARSA or Q-learning. There are many techniques and pros and cons to each of these approaches but in general, start simple and build up complexity as you need it is good advice.</li><li><em>off-policy versus on-policy learning</em> — is your system able to learn as it discovers new states or is it going to have to be pre-trained off-line? Is your system able to implement the decisions it takes or is it only recommending the decisions to an operator who can decide to adopt or decline them? All these factors influence whether you need to use an on- or off-policy approach.</li><li><em>time-varying rewards and demand —</em> probably the hardest issue of all in reinforcement learning is time-heterogeneity. Your environment may change over time and the reward you see one day may differ the next day for the same action. If this means a change in the statistical properties of your system (rather than just noise or differences in samples from the same distribution), then your RL system needs to know to adapt to that. Censored memory and rapid learning rates are the order of the day here.</li></ul><p>All of these features need addressing at one point or other in practice. <a href="/service/mailto:jeremy.bradley@datasparq.ai">Leave me a comment</a> if you’d like to see a Part II on some of these more technical aspects of practical implementation of reinforcement learning.</p><p><strong>And finally…</strong></p><p>If you are interested in joining us at <a href="http://www.datasparq.ai/">Datasparq</a> for exciting projects like this or just finding out how your company can benefit from our Reinforcement Learning, Data Science and Engineering expertise, <a href="/service/mailto: info@datasparq.ai">please get in touch</a>. We’ll be delighted to hear from you.</p><p><strong>References</strong></p><p>[1] Richard S. Sutton and Andrew G. Barto. <a href="https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf">Reinforcement Learning, An Introduction</a>. 2nd ed. MIT Press, 2018.</p><p>[2] Andreas Papayiannis, Paul V. Johnson, Dmitry Yumashev, Peter Duck. <a href="https://doi.org/10.1093/imaman/dpy015">Revenue management of airport car parks in continuous time</a>. IMA Journal of Management Mathematics. Jan 2019.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f7fa3054446" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datasparq-technology/war-stories-from-using-reinforcement-learning-for-dynamic-pricing-5f7fa3054446">War stories from using Reinforcement Learning for Dynamic Pricing</a> was originally published in <a href="https://medium.com/datasparq-technology">Datasparq Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Job matching: a new challenge in search]]></title>
            <link>https://medium.com/datasparq-technology/job-matching-a-new-challenge-in-search-ad6f7f0fc358?source=rss-98a6cf82e7f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad6f7f0fc358</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[matching]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[jobs]]></category>
            <dc:creator><![CDATA[Jeremy Bradley]]></dc:creator>
            <pubDate>Tue, 04 May 2021 12:28:46 GMT</pubDate>
            <atom:updated>2021-07-01T16:12:10.867Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A small bit of web history</strong></p><p>Some years ago in the 90s when I was doing my MSc in Computer Science and the web was the next big tech frontier, we had a problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbQmx9uT6PuwrmE3Vv36BA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@dlerman6?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Daniel Lerman</a> on <a href="https://unsplash.com/s/photos/search?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>That problem was search — it was broken, not just a little bit either but totally broken. The search engines of the day regarded search much as a word processor does now. They gave you a search dialogue and expected to return some or even all of the pages in their catalogue which contained your search term. If there was a tie between matching pages, then the engine might look to see if your search term appeared in a title or heading or appeared multiple times within the body of the page.</p><p>The inevitable happened — spam pages emerged with huge numbers of hidden words and likely search terms embedded in them. Overnight web search as a tool became completely useless. You couldn’t find anything.</p><p>That was of course until <a href="http://ilpubs.stanford.edu:8090/422/1/1999-66.pdf">Sergei Brin and Larry Page wrote a paper</a> as part of their PhD detailing a neat piece of what would later become known as Data Science that could recover relevance and importance in web search. That piece of applied mathematics was PageRank and it became a $1tn company — you will know it as Google.</p><p><strong>Job search</strong></p><p>Well searching for a job is a bit like that now. Job postings appear containing all sorts of relevant or not so relevant information. They’re posted with wildly diverging titles even if they represent essentially the same job. So <em>Primary Teacher</em> role might get posted with the title: “<em>Part-time Teacher (Primary) years 5–6 Ipswich-starts September</em>” or equally “<em>Primary Teacher (Fixed term maternity cover) £24k — Brent</em>”.</p><p>All because jobs forums and recruiting companies think they can elevate their posting in a simple search box. Meanwhile applicants are reduced to searching for terms they think might match the sort of job they are interested in — often the job title. The result is a deeply unsatisfying user experience —lists of over specific jobs that do not represent the breadth of possibility for the applicant’s capability.</p><p>Job search is as broken now as searching for a web page in 1996.</p><p><strong>The Job Finder Machine</strong></p><p>We started work on the <a href="https://labs.datasparq.ai/job-finder-machine/">Job Finder Machine</a> to address this problem in December 2020. As my colleague <a href="https://medium.com/@oliverbartlett/1a7ffe6aa7ff">Oli Bartlett has written in his post</a>, this was part of a data-science-for-good project with the <a href="https://emergentalliance.org/products-and-services/job-finder-machine/">Emergent Alliance</a> to answer the challenge of getting people with skills into well-matched jobs after the pandemic.</p><p><strong>Our Data Science Hypothesis</strong></p><p>Our data set consisted of a set of job titles representing current or recent job openings and associated with each title was a list of skills that were required by that job.</p><p>As with all good Data Science projects, we started with a working hypothesis which we tried to disprove.</p><blockquote><strong>Hypothesis: </strong>We can generate high quality job matches based on user-entered natural language descriptions of skills alone</blockquote><p>There were the usual problems of skills being duplicated, spelt wrong, capitalised, not linked with the skill with exactly the same name. Also we were expecting user input of skills from the applicant with exactly the same issues. Some useful techniques from NLP came to hand to help address some of these issues — but not all.</p><p><strong>How did we do it?</strong></p><p>First we developed a conceptual model of the jobs-skills landscape: a bipartite graph connecting a set U of jobs with a set V of jobs.</p><figure><img alt="A bipartite graph representing the relationship between job postings and skills" src="https://cdn-images-1.medium.com/max/1024/0*nPps9WEKeqlJ95Rd" /><figcaption>A graph of U, the set of job postings, to V, the set of skills needed by a job.</figcaption></figure><p>Why bipartite? Because at this stage, we only had a relationship between jobs and skills or skills and jobs and there were no direct relationships between jobs (this would come later).</p><p>What did this represent? It showed simply that some jobs need a set of skills and those skills might also be required by some other jobs. Not earth shattering but still useful.</p><p>Imagine that an applicant highlights some skills in set V that are relevant to them, could we use that information together with the graphical model to return a list of jobs that were a good match for the user’s skills. Potentially.</p><p>Those sets, by the way, U might have as many as 180,000 current jobs in at any one time, and V might have 3 million skills listed.</p><p>Just returning all the jobs that happened to mention one of the skills the candidate mentioned was a non-starter — we would have many 1000s of matching jobs potentially.</p><p>Equally, we realised quite quickly that returning all the jobs that matched all the skills a user mentioned quickly reduced the the number of matches to zero and even if not, very clearly missed lots of jobs that were clearly very similar in nature but had happen not to mention one of the skills that other jobs with the same name had mentioned.</p><p><strong>Step 1: Constructing a common skills description for a job</strong></p><figure><img alt="Job descriptions and their associated and likely different skills descriptions." src="https://cdn-images-1.medium.com/max/1024/0*DF9kAkcbepxq7d21" /></figure><p>Many jobs with the same job title had slightly differing skills.</p><p>We were trying to give a good match to a set of likely jobs and not necessarily a precise match to a specific posting. Also it might be that a hiring manager had left off some skills or had assumed them to be implicit in the role.</p><p>Whereas other companies were more precise over how they described the skills that a job needed.</p><p>We could learn from the aggregate data to come to a common skills description of a job with a given title. It would fill in some of the gaps left by the individual postings. It would also allow us to capture phrases and synonyms for skills that different companies had used.</p><p>We could also start to pick out the most frequent skills for a job and use that to give an indication of the importance of a skill for each job title.</p><p><strong>Step 2: Establishing a jobs network</strong></p><p>With a common view of skills for each job title we could now look at how similar jobs are in terms of skills.</p><figure><img alt="The overlap in skills between a Software Engineer and a Data Scientist — represented as a Venn diagram." src="https://cdn-images-1.medium.com/max/970/0*HHlhpdVtFjMHivCt" /><figcaption>A Venn diagram showing the similarity between two related job titles</figcaption></figure><p>We constructed a similarity metric between job titles, by comparing their skill sets.</p><p>We can do this by computing the <a href="https://en.wikipedia.org/wiki/Jaccard_index">Jaccard Index</a> between each pair of job titles.</p><p>This is then used to assign a weight to the edge between a network of job titles. This can be visualised in the following example of Job Titles Network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1dP9ZcVG_xjuZapz" /><figcaption>A network of job titles with associated skills similarity measures</figcaption></figure><p><strong>Step 3: Clustering a network of Job Titles</strong></p><p>Having obtained a job titles network we are in the exciting position to solve the problem of having lots of very differently described jobs with very similar skills. These naturally cluster together and for a certain granularity we can create a higher or lower abstraction on the jobs graph.</p><figure><img alt="Clustering a graph" src="https://cdn-images-1.medium.com/max/440/0*HPvRN4XnJFfBX0w4" /><figcaption>A clustered graph of job titles</figcaption></figure><p>With this clustered representation we can have a single representation of a set of job titles with a set of similar skills.</p><p><strong>Step 4: Ranking job clusters</strong></p><p>Finally, we modified the Page and Brin algorithm from 1999 and created our own ranking algorithm across the skills-jobs network using a discrete-time Markov Chain. Now we can take into account how important skills are for a given job (how frequently they are mentioned) — and extend that to clusters of similar jobs.</p><p>Now when an applicant lights up some of the skills in the original data set, we are able to produce a probabilistic rank of jobs clusters and produce meaningful importance ranked output based on continuously-updated historical data.</p><p><strong>What about algorithm bias?</strong></p><p>We need to address the issue of potential bias in the algorithm. This is a massive topic for any recruitment or applicant matching algorithm. While this approach is not immune, the good news is that because the training data is not based on individual applicants we side-step the biggest single source of bias in job-matching — that of prior applicant selection bias.</p><p>So where can bias occur? Well two main areas:</p><ol><li>The job descriptions themselves might contain biased perspective on skills, but unless this is a sector-wide problem, individual posting will get amalgamated with other jobs from the same sector and the effect of the bias will be significantly diluted if not removed altogether.</li><li>The candidate applying may be self-selective about how they describe their own abilities. However the algorithm looks for jobs that match partially and “fills in the blanks” for missing skills. This then gets displayed in the percentage match metric.</li></ol><p><strong>Summary</strong></p><p>We have presented a brief overview of our approach to tackling the job search problem. We had a lot of fun doing it and were able to deploy on a GCP-BigQuery-Dataflow architecture two months after starting the project.</p><p>If you are interested in joining us for exciting projects like this or just finding out how your company can benefit from our Data Science and Engineering expertise, <a href="/service/mailto: info@datasparq.ai">please get in touch</a>. We’ll be delighted to hear from you.</p><p>Huge credit goes to the team from Code First Girls who brilliantly innovated on the data science behind the Job Finder Machine with us at <a href="https://datasparq.ai/">DataSparQ</a>: <a href="https://www.linkedin.com/in/erika-nicole-gravina-42a72b176/">Erika Gravina</a>, <a href="https://www.linkedin.com/in/dehaja-senanayake/">Dehaja Senanajaka</a> and <a href="https://www.linkedin.com/in/rajwinderbhatoe/">Rajwinder Bhatoe</a>.</p><p><strong>References</strong></p><p>[1] The Job Finder Machine: <a href="https://labs.datasparq.ai/job-finder-machine/">https://labs.datasparq.ai/job-finder-machine/</a></p><p>[2] Page, L., Brin, S., Motwani, R., and Winograd, T. <a href="http://ilpubs.stanford.edu:8090/422/1/1999-66.pdf">The PageRank Citation Ranking: Bringing Order to the Web</a>. Technical Report. Stanford InfoLab. 1999.</p><p>[3] Oliver Bartlett. <a href="https://medium.com/@oliverbartlett/1a7ffe6aa7ff">Using Data Science to help people get back into work</a>. Medium, 2021.</p><p>[4] <a href="https://en.wikipedia.org/wiki/Hierarchical_clustering_of_networks">Hierarchical clustering of networks</a>. Wikipedia, April 2021.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad6f7f0fc358" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datasparq-technology/job-matching-a-new-challenge-in-search-ad6f7f0fc358">Job matching: a new challenge in search</a> was originally published in <a href="https://medium.com/datasparq-technology">Datasparq Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The next revolution: Data Science and the Circular Economy]]></title>
            <link>https://medium.com/datasparq-technology/the-next-revolution-data-science-and-the-circular-economy-9653a29d0c55?source=rss-98a6cf82e7f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9653a29d0c55</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[circulareconomy]]></category>
            <dc:creator><![CDATA[Jeremy Bradley]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 15:11:09 GMT</pubDate>
            <atom:updated>2021-03-26T19:42:41.404Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>An economy that puts back what it takes out, that is sustainable by design. — <strong>Matthew Bishop</strong></blockquote><p>The circular economy is a foundational principal of sustainable commercial and industrial activity.</p><p>Circular economy requires that we account for the natural resources we take and use in everyday processes and, as far as possible, return them to their original state — everything from air and water to habitats. Further, every product — every single product — we consume needs to have a reuse or recycling pathway either directly or in an adjacent process or industry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ek_90EPKNxiLOdcj.png" /><figcaption>The circular economy in action (Geissdoerfer <em>et al. 2020)</em></figcaption></figure><p>Be in no doubt, the transformation required by the circular economy will make the industrial revolution and the data revolution look like a walk in the park by comparison!</p><p><strong>What does circularity entail</strong></p><blockquote>In its industrial processes, a truly circular economy creates no net pollution or waste. — <strong>Matthew Bishop</strong></blockquote><p>Given this stringent definition, the goal of achieving circular industrial processes across a national and by extension, for it to make sense, a trans-national economy, is a huge challenge. A social challenge certainly, a commercial and investment challenge definitely, but also I argue, a data challenge and and a massive scientific challenge as well.</p><p>Circularity subsumes the carbon cycle neutrality that many nations are working towards and extends it towards other natural resource cycles such as water, air, minerals, and biodiversity. By definition though, circularity includes the products that are created in a thriving economy and all the materials that go into making them.</p><p>If circularity is to happen — and for ongoing sustainability it surely has to — this requires the a dramatic and disruptive change to the global economy.</p><p><strong>Changing production/logistic networks</strong></p><p>Currently many products and processes revolve around a linear production model. This does not work well as a model for reclaiming materials for recycling and reuse as many products end up in landfill.</p><figure><img alt="A linear production model which see products go from manufacture to waste disposal at end-of-life" src="https://cdn-images-1.medium.com/max/414/1*yZRh5PJDxCnEApshDe1IWQ.png" /><figcaption>A linear production model that sees products go from manufacture to disposal (jb, 2021)</figcaption></figure><p><strong><em>A linear production model </em></strong>involves a supply chain of raw materials that see a product created at a production facility and then pushed into a supply chain distribution network. The use-life will sometimes have maintenance cycles embedded in it if the product is of sufficiently high value. When end-of-life is reached the product is disposed to landfill or incineration with some portion of the product being recycled depending on legislation, consumer habit and process availability.</p><p>For new products designed for circularity, we will see many different and potentially disruptive production and use models spring up.</p><figure><img alt="A cyclic production-use-recycling process" src="https://cdn-images-1.medium.com/max/385/1*skKHxkUjhVqXfjUAtvGP2A.png" /><figcaption>A cyclic production model where the production is located with or nearby the point-of-sale (jb, 2021)</figcaption></figure><p><strong><em>Future circular logistic</em></strong><em> </em><strong><em>chains</em></strong><em> </em>may see production — perhaps micro-production — move closer to the point-of-sale. Imagine bottling plants or food packing facilities embedded in supermarkets.</p><p>Similarly some outlets will become points-of-return for their products at end-of-life. Except that, what was previously end-of-life will become start-of-second-life after a suitable recycling process.</p><p>The distribution network will become a means for front-hauling raw components to the manufacturing facility and taking packaging and old products for refurbishment — so-called, back-haul.</p><p>All this requires unprecedented cooperation between logistics providers, manufacturers retailers and consumers. Undoubtedly incentive programs like bottle deposit schemes will be needed and the economics of even those industry schemes are not straightforward. For more expensive products, lease-and-return will likely be the better model replacing own-and-discard.</p><p><strong>The scientific and engineering challenge</strong></p><p>Let us for a moment look at the industries that will be swept up in this revolution:</p><ul><li>Building and construction</li><li>Clothing and textiles</li><li>Metals (bulk metals like, iron and aluminium) as well as tech metals such as rare earth metals, copper and lithium</li><li>Farming and food production</li><li>Energy generation</li><li>Water processing</li></ul><p>This is a scientific challenge at a materials level, and an engineering level at a process design level. Assuming we have a circular supply chain in place (see above) to collect the raw material: Can we physically or chemically reconstitute the materials once they have been used? Does an industrial scale process exist to support such a reclamation? Is it economically viable to carry out the recycling activity?</p><figure><img alt="Recycling box full of glass bottles." src="https://cdn-images-1.medium.com/max/1024/0*ilTGUJZZE3WMQLNY.jpg" /></figure><p>As an instance, thermal recycling of glass (melting recycled glass down and reforming it) cannot be done currently with 100% used feedstock or cullet (the name given in the industry to the broken glass obtained from bottle banks). It has to be mixed with new silica/soda-lime in order to produce a suitably high quality product (green glass can be formed from 90% feedstock, clear glass only 25%). Different but equally hard challenges exist in recycling PET plastics and other raw materials.</p><p>These are massive challenges by themselves and the good news that many research funders and universities are making inroads into these challenges.</p><p><strong>Why a data challenge?</strong></p><p>If this wasn’t exciting enough, the cross industry aspect is where the circular economy becomes a really interesting puzzle.</p><blockquote>There is no such thing as ‘away’. When we throw anything away it must go somewhere. — <strong>Annie Leonard</strong></blockquote><p>The challenge lies in joining up industries that have previously had no interrelationship.</p><p>For the sake of argument, say it were possible (I’ve no idea whether it is) to reuse the magnets in the motors of discarded washing machines and tumble dryers to help create generators for wind turbines and new motors for electric cars. This would be an example of how the white goods industry might find itself in the supply chain for fast growing green technologies.</p><p>If we now forbid those growing industries to use virgin raw materials from usually mined ores — we run into two problems straight away:</p><ol><li>Are there enough discarded washing machines and tumble dryers to supply all the magnets need by the wind turbine and electric car industries</li><li>Are the recycled materials available in sufficient quantity at the right time to allow manufacturers to rely on them in their supply chains</li></ol><p>Even if the answer to (1) is yes, the answer to (2) is almost certainly going to be no — at least to start with. These industries have never had cause to synchronise before — they are not aware of each others production flows, but they will need to be if there is to be synergy between them. This is where data science and smart supply chain processes can drive real innovation.</p><p><strong>Data flows for circular economy</strong></p><p>In supply chains, products, components and raw materials flow between mines, factories, warehouses and points of sale. In efficient supply chains, goods do not spend long at any one point in the supply chain, instead they are ordered as needed and in anticipation of a downstream demand.</p><p>What drives this efficient flow is data pipelining and accurate forecasting of demand. Without that, materials end up being stock piled in warehouses to mitigate the risk of material exhaustion. Storage of materials, just as with components, is inefficient and costly.</p><p>In a circular economy with many cross-industry dependencies, we will need data visibility on:</p><ul><li>demand forecasts in consuming industries; and</li><li>flows of products reaching end-of-first-life in feeder industries</li><li>volumes of recycled material that is about to be available for reuse</li></ul><p>Industries which have never talked to each other will need standardised APIs for interrogating each other or pushing notifications to each other to achieve this seamless integration.</p><p><strong>Algorithms for the circular economy</strong></p><p>If this sounds like it will be ripe for application of <strong><em>predictive data science</em></strong>, it absolutely will be. The better the forecast or anticipation of arrival of a feedstock, down to the day, hour or even minute, the more efficient the manufacture of the new product can be. Materials arriving early can at least be stored (if space allows) — materials arriving late though will potentially hold up a whole manufacturing pipeline.</p><p>Another key technology will be in the area of <strong><em>meta-heuristics</em></strong>, e.g. Silva <em>et al. </em>2003. If you’ve never heard of these before in the context of data science problems, they are approximate but fast solution approaches to massive multi-scale optimisation problems. And if we are to minimise the wait time, maximise the throughput and minimise the waste in dynamic cross-industry supply chains, we will need the very latest state-of-the-art optimisation algorithms to enable this.</p><p><strong><em>Models of flow</em></strong> of goods than can capture recycling streams at a cross industry level will be extremely important, for example, Bhaskar <em>et al.</em> 2010. These models will need to represent delay, storage and uncertainty but they will also need to learn distributional patterns that represent volume. Being able to identify key bottlenecks well ahead of them actually occurring will be necessary so that alternative sources or feedstocks can be planned for.</p><p><strong>Conclusion</strong></p><p>So what can we do now to address these challenges? For those of us who look for data-driven projects in a variety of industries — there is low-hanging fruit and much of the benefit can start within a company.</p><ul><li>understanding and mapping the data flows and data services within a company is a health check that many companies could do and leave for another day</li><li>creating a sustainability call-to-action within a company which looks at the flows of natural resources as well as raw products and would allow for an audit of natural capital expenditure will likely expose circularity shortfalls</li><li>engaging with the data science to create high quality forecasts for many parts of the company to use and understanding the key impacts and risks of that forecast being right or wrong</li><li>engaging with universities and <a href="https://www.ukri.org/news/hub-to-provide-national-circular-economy-leadership/">circular economy hubs</a> at this early stage so that a company is aware of upcoming technical and business opportunities</li><li>creating an open data culture so that people who want to work with you can see your consumption and your production and forecasts of the same so they can understand what the time and volume challenge will be if they start to be your supplier/consumer for a critical material</li></ul><p>If sustainability is to be sustainable then it has to drive value itself and the good news is that the actions that any company can take in preparation for the circular revolution will also drive efficiency, savings, internal reliability and external opportunities.</p><p><strong>References</strong></p><p>Geissdoerfer, M., Pieroni, M.P., Pigosso, D.C. and Soufani, K. “Circular business models: A review.” Journal of Cleaner Production, 2020.</p><p>Silva, C.A., Runkler, T.A., Sousa, J.M., Sá da Costa, J.M. “Optimization of Logistic Processes in Supply-Chains Using Meta-heuristics.” EPIA 2003: Progress in Artificial Intelligence. LNCS vol. 2902, pp 9–23. Dec. 2003.</p><p>Bhaskar, V., Lallement, P. “Modeling a supply chain using a network of queues.” Applied Mathematical Modelling 34(8):2074–2088, Aug. 2010.<br>DOI: 10.1016/j.apm.2009.10.019</p><p><strong>About the author</strong></p><p>Dr. Jeremy Bradley is Chief Data Scientist to DataSparQ, a member of the Strategic Advisory Network for the UKRI/EPSRC Circular Economy Theme, a member of the Strategic Advisory Team for EPSRC Mathematical Sciences and Fellow of the Institute of Mathematics and its Applications. He lectured and researched Computer Science at Imperial College London for 14 years. He has industrial data science experience as part of the data science teams at Tesco, Royal Mail and now DataSparQ. Jeremy also co-hosts the <a href="http://datacafe.uk/">DataCafé data science podcast</a> with his friend Dr. Jason Byrne.</p><p>If you would like to know more about how sustainable data science can help your business then do <a href="/service/mailto:info@datasparq.ai">get in touch</a>. We would be happy to share our learnings and see if we can help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9653a29d0c55" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datasparq-technology/the-next-revolution-data-science-and-the-circular-economy-9653a29d0c55">The next revolution: Data Science and the Circular Economy</a> was originally published in <a href="https://medium.com/datasparq-technology">Datasparq Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reacting quickly in a pandemic — Why retail businesses need Data Science in their toolkit]]></title>
            <link>https://medium.com/datasparq-technology/reacting-quickly-in-a-pandemic-why-retail-businesses-need-data-science-in-their-toolkit-b3f39479d4f0?source=rss-98a6cf82e7f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3f39479d4f0</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[forecasting]]></category>
            <category><![CDATA[changepoint]]></category>
            <category><![CDATA[demand-forecasting]]></category>
            <category><![CDATA[retail]]></category>
            <dc:creator><![CDATA[Jeremy Bradley]]></dc:creator>
            <pubDate>Mon, 16 Nov 2020 15:21:16 GMT</pubDate>
            <atom:updated>2022-03-31T19:46:57.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pandemic Data Science —Why Data Scientists need Changepoint Detection</h3><blockquote>“Some things are so unexpected that no one is prepared for them. “<br><strong> — Leo Rosten in <em>Rome Wasn’t Burned in a Day</em></strong></blockquote><p>There are many challenges to running a large retail business at any time, but in these largely uncharted times of pandemic, there are a special set of challenges which should dominate the thinking of a data science team working in or with the retail industry.</p><figure><img alt="Picture of largely empty supermarket shelving with a few empty product boxes lying untidily in the shelves." src="https://cdn-images-1.medium.com/max/400/0*rmgTxwu1MZyml3pT.jpg" /><figcaption>Empty supermarket shelves that can result from unforeseen spikes in demand</figcaption></figure><p><strong>Demand spikes</strong></p><p>One of the key drivers of uncertainty with any significant societal upheaval — and obviously I include a global pandemic in that category — is the surge or collapse in demand for certain items and services. This sudden change in customer or user behaviour can have extreme consequences for any business that is used to operating at a “normal” level of activity. This is especially true if there is a large operational element to a company’s model as in the worlds of retail or logistics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/0*DTF5MuBGW519iYBi.jpg" /><figcaption>Empty trains and public transport were a feature of periods of lockdown in the UK</figcaption></figure><p>Retail companies, whether online or in physical stores, have a background operation that has to be resourced with people, stocked with goods and supplied with supporting equipment.</p><p>Any significant and unpredicted change to retail demand causes one of two problems:</p><ol><li><strong>Spike demand.</strong> Empty shelves, empty warehouses, and long lead times for resupply from an overstretched supply-chain. Employees that are often asked to work large periods of overtime and resources (especially vans and delivery slots) that are fully utilised and not capable of coping with continuing demand.</li><li><strong>Demand drop-off.</strong> Over-full warehouses with an increased cost of storage for goods that are not being sold at retail outlets. In food retail, this will also lead to food wastage of expiring products. Employees working in replenishment, restocking and delivery may become under-utilised and then asked to work smaller shifts.</li></ol><p>In the UK, during the first lockdown in 2020, supermarkets offering online delivery found that they did not have enough vans and therefore delivery slots to satisfy demand. This caused delivery slots to disappear for many customers for weeks and then months. Some supermarkets were savvy enough to prioritise vulnerable customers. While other supermarkets saw a loss of customers to rival stores that they may never recover.</p><p><strong>What can we learn from this</strong></p><p>In the event of further lockdowns and disruption, and where there is a perceived shortage of some goods, it is likely that we will see more surges in demand for may product lines (SKUs), e.g. for dry goods like pasta, tinned ingredients, baking ingredients. This variable demand disrupts resourcing of logistics, supply chain and retail operations, which in turn makes configuration of vehicles and people very difficult. It may also challenge downstream manufacturers of goods to provide sufficient capacity even if the goods can be brought to retail locations.</p><p>We clearly need techniques that can react to sudden changes quickly. We need to reach into our statistics and data science toolkit to deliver better <strong>forecasting models</strong>.</p><p><strong>Changepoint detection in forecasts</strong></p><p>Time series is an often-used method of representing and then analysing forecasting problems. A time series is a time-indexed plot of any data and is used to represent service demand or sales of a given product over time. A forecast of demand represents an informed guess as to how the demand curve will continue past the present day; as in the plot below of monthly air passengers between 1948 and 1962. (Box et al., 1976)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*DF3VrOx2TJOOSXME.gif" /><figcaption>A time series of monthly demand by air-passengers (thousands) between 1948 and 1962.</figcaption></figure><p>Most commercial forecasting is based on a combination of historical data— often seasonally adjusted — and data about anticipated or planned events. Thus the demand for barbecues might be modelled on historical sales to pick up that there are high sales in the summer, along with meteorological data to try and anticipate sunny barbecue-friendly weather, and a list of national holidays.</p><p>A changepoint describes a point in time when a change occurred to a statistical feature of the time series — that might be a change in the mean, invariance (noise) or in trend. For example, if the electricity usage from a small factory drops from 152kW to 96kW in the space of a few seconds at 3.10 pm, we might call that a changepoint in the electricity demand at that time.</p><p>The series below displays a significant mean jump at time 30.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*M3JWcyAP-uW7aVKFX6C02w.png" /><figcaption>A time series exhibiting a significant jump in mean</figcaption></figure><p>The beauty of changepoints is that there does not have to be any knowledge of the underlying reason for the change — it is literally the identification that a change has happened for whatever reason. That does not mean to say that we cannot more closely focus on particular time ranges to identify possible changepoints, it just means that we do not have to be aware of all the operational complexity in a company in order to be able to identify one.</p><p>Forecasting algorithms will often rely heavily on time series data as input, to be able to produce their forecast. If a forecasting algorithm is not expecting large jumps in its historical input data, and some algorithms cope with this very poorly, then it can drive large error in the forecast. This error can last for many days or weeks before the changepoint is eventually smoothed out and accounted for by the algorithm.</p><p><strong>Opportunity</strong></p><p>Forecasting techniques which can spot changepoints as they occur in their historical input data are able to react more swiftly to those changes and produce dramatically better results, i.e. a forecast with a lower forecast error compared to a moving average forecast which relies on a sliding window of historical values.</p><p>There are many changepoint detection techniques out there — and I will list some for you — that have differing ability to accurately recognise when demand disruptions are occurring and allow servicing of that demand.</p><ul><li><strong>Binary Segmentation</strong> (Edwards and Cavalli-Sforza), works with a process of successive division and exploration of the time series until no further changepoints that pass the statistic test emerge. It is an approximate algorithm — it does not explore all of the possible changepoints. However, it is quick with complexity <em>O</em>(<em>n</em> log<em> n</em>) for a time series of length <em>n.</em></li><li><strong>Segment neighbourhood</strong> (Auger and Lawrence), uses dynamic programming iteratively to identify successive changepoints. It is an exact algorithm in that all changepoints are explored but there is a computational penalty — it having complexity <em>O</em>(2^<em>n</em>) or O(<em>C n</em>^2) if the number of changepoints searched for is constrained.</li><li><strong>PELT</strong> (Killick <em>et al</em>., 2012), is an online algorithm — meaning it can be used on streamed time series data. It also uses dynamic programming but has linear complexity, <em>O</em>(<em>n</em>), so long as the number of changepoints in a time series increases only linearly with the size of the time series data.</li></ul><p>The online nature of PELT is an important distinction from the traditional approaches. The ability to run as part of a <strong>streamed data architecture is very useful when trying to make decisions in near real-time</strong>. The Binary Segmentation and Segmentation Neighbourhood approaches are suited to a batch processing model after a window of time has elapsed, which is very appropriate for retrospective analysis.</p><p><strong>Benefits</strong></p><p>The exact benefit case for using modern approaches in forecasting — often in combination with neural networks, decision trees or moving average approaches — will depend on the industrial use case and the nature of the operation being run.</p><p>Broadly, though, the difference between a slow-reacting moving-average style forecast and one that has an integrated changepoint detection technique might mean as much as 40–50% in terms of sales revenue for a retail operation or 10–20% in terms of quality failure (items that exceed time-taken-to-deliver threshold) for delivery of goods, for a given forecasting window. It can be that dramatic.</p><p>In both cases rolling disruption cannot be ruled out and that can be the cause of severe disruption even when the demand curve has settled down</p><p><strong>Summary</strong></p><p>The forecast is not the whole story of course. A good forecast needs to be plumbed into a responsive operational decision process in order to make good use of the benefits of increased forecast accuracy.</p><p>Many businesses realise they have risk exposure in their business forecast models. Typically, they respond to uncertainty and previously-observed forecast error with excess capacity — either in storage space for extra goods or in expensive assets for processing those demand spikes. In many cases, this can be achieved more efficiently by making use of a more accurate forecast that adjusts to the new normality of a post-changepoint world quickly.</p><p><strong>About the author</strong></p><p><strong>Dr. Jeremy Bradley</strong>, previously Associate Professor of Computer Science at Imperial College London and is currently Chief Data Scientist at DataSparQ. He also co-hosts the <a href="http://datacafe.uk/">DataCafé data science podcast</a> with his friend Dr. Jason Byrne. If you would like to know more about how this or further cutting-edge research can impact your operation directly then do <a href="/service/mailto:info@datasparq.ai">get in touch</a>. We would be happy to share our learnings and see if we can help.</p><p><strong>References</strong></p><ul><li><strong>Podcast:</strong> Bradley, J.T. and Byrne, J. “<a href="http://datacafe.buzzsprout.com/1073626/4535741">Changepoint Detection: Secret Weapon of the Data Scientist</a>.” DataCafé 2020.</li><li><strong>Changepoints Overview Paper</strong>: <a href="https://www.researchgate.net/publication/264485551_Changepoint_An_R_Package_for_Changepoint_Analysis">Killick, R. and Eckley, I.E. “changepoint: An R package for changepoint analysis</a>” (pdf via ResearchGate)</li><li><strong>Paper:</strong> Box, G.E.P., Jenkins, G.M., and Reinsel, G.C. (1976) “Time Series Analysis, Forecasting and Control.” Third Edition. Holden-Day. Series G</li><li><strong>Paper:</strong> Auger, I.E., Lawrence, C.E. (1989). “Algorithms for the Optimal Identification of Segment Neighborhoods.” Bulletin of Mathematical Biology, 51(1), 39–54.</li><li><strong>Paper:</strong> Edwards, A.W.F., Cavalli-Sforza, L.L. (1965). “A Method for Cluster Analysis.” Biometrics, 21(2), 362–375.</li><li><strong>Paper:</strong> Killick, R., Fearnhead, P., Eckley, I.A. (2012). “Optimal Detection of Changepoints with a Linear Computational Cost.” Journal of the American Statistical Association, 107(500), 1590–1598.</li><li><strong>R Package</strong>: <a href="https://cran.r-project.org/web/packages/changepoint/index.html">changepoint: Methods for Changepoint Detection</a> (R package via CRAN library)</li><li><strong>PELT algorithm paper:</strong> Killick, R., Fearnhead, P. and Eckley, I.A. “<a href="https://arxiv.org/pdf/1101.1438.pdf">Optimal detection of changepoints with a linear computational cost</a>”, October, 2012. (pdf via arXiv)</li><li><strong>Paper:</strong> Beaulieu, C., Killick, R. “<a href="https://doi.org/10.1175/JCLI-D-17-0863.1">Distinguishing Trends and Shifts from Memory in Climate Data</a>” J. Climate (2018) <strong>31</strong> (23): 9519–9543 (paper via American Meteorological Society)</li><li><strong>R Package:</strong> <a href="https://cran.r-project.org/web/packages/EnvCpt/index.html">EnvCpt: Detection of Structural Changes in Climate and Environment Time Series</a><strong> </strong>(R package via CRAN library)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3f39479d4f0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datasparq-technology/reacting-quickly-in-a-pandemic-why-retail-businesses-need-data-science-in-their-toolkit-b3f39479d4f0">Reacting quickly in a pandemic — Why retail businesses need Data Science in their toolkit</a> was originally published in <a href="https://medium.com/datasparq-technology">Datasparq Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>