<?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 Alessandro Volpe on Medium]]></title>
        <description><![CDATA[Stories by Alessandro Volpe on Medium]]></description>
        <link>https://medium.com/@alessandro.volpe?source=rss-95971a085087------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TY9gxqBd9YJUx0JblrJJaw.jpeg</url>
            <title>Stories by Alessandro Volpe on Medium</title>
            <link>https://medium.com/@alessandro.volpe?source=rss-95971a085087------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 16:46:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alessandro.volpe/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[Building trust in Machine Learning]]></title>
            <link>https://medium.com/bip-xtech/building-trust-in-machine-learning-ef677ce9ed62?source=rss-95971a085087------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef677ce9ed62</guid>
            <category><![CDATA[transparency]]></category>
            <category><![CDATA[trustworthy-ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Alessandro Volpe]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 18:25:17 GMT</pubDate>
            <atom:updated>2023-02-22T18:25:17.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building trust in ML — A Data Scientist’s POV</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HOP9_qtG0pABsrMd" /><figcaption>Image from Unsplash</figcaption></figure><p>There are several types of skepticism working with Machine Learning. How to deal with (most of) them? In this article I’m sharing my point of view based on the experience I gained while working on this job. I hope it’ll be useful for many.</p><h4><strong>“I don’t trust the output results, they are counterintuitive”</strong></h4><p>It happened to me recently, the business users didn’t agree with the outputs of a Marketing Mix model we were implementing. It wasn’t a lack of confidence — quite the opposite. It was the fact that the business experience did not match the outputs of the model. This allowed us to identify problems in the collection and processing phase of the raw input data, which we solved with simplicity. However, the fact drew my attention to the following points:</p><ul><li>Did we have enough meetings with the data owners to make sure that the data they sent us was correct, complete, and representative?</li><li>Do we need more frequent discussion meetings with the business?</li><li>Were we careful enough to explore the data, or could we have spent more time graphing and reviewing all the features? Implementation times are very tight, but if we had spent more time before…</li></ul><h4><strong>“I was also expecting a forecast on these other two targets”</strong></h4><p>This has happened to me several times. Sometimes they tried to get more from us. Other times, in fact, the objectives were not set clearly: did we spend enough time to engage and explain to all the people involved the objectives of our work? If not — as a result — we found ourselves spending yet another 15 minutes to point out the project objectives and justify why the deliverables will be misaligned with expectations. And to re-gain their trust when they expected more.</p><p>It is good to spend the time necessary to set the expectations of the work group and obtain the collective buy -in. It is also important to have the lead sponsor of the initiative take care of keeping everyone aligned.</p><h4><strong>“The model performance is too low, we can’t use it”</strong></h4><p>Evergreen. The data or the process do not always allow to reach high performances. See for example problems with very unbalanced datasets (e.g. predictive maintenance) or in which the phenomenon is unpredictable (e.g. forecasts of demand for new retail products). Giving false expectations to users or not making clear the limits of the approach can lead to disillusionment with the models. It is not a question of modelling; it is a question of being able to effectively set expectations within the limits of the possibilities granted by the phenomenon in question.</p><p>In this case, it is also essential to assess how much precision and recall affect the economics (ROI) of the project having knowledge of all the incremental costs and benefits compared to the reference baseline.</p><h4><strong>“I don’t understand how to use these outputs”</strong></h4><p>The interpretability of models is a topic that gained importance with the wider of ML models in processes where actionability is fundamental. Without a proper understanding of how to use or interpret model outputs, the work becomes vain. I could suggest a fair number of articles dealing with Explainable AI (XAI), here are a couple:</p><h4><strong>“Nice model, but who will manage it?”</strong></h4><p>We once worked on a time series model that required forecasting 10,000 distinct time series to forecast a company’s monthly P&amp;L closing. How to identify the drift of a specific cost item, among the 10,000 total? How to maintain the models’ ensemble over time? Who oversees operation and maintenance once the handover is done, since the process involves distinct business departments that speak different languages?</p><p>Automating the forecasting process for less relevant P&amp;L items with AutoML techniques and building more accurate Boosted / LSTM models for the most impactful items is a good workaround. However, it is necessary to be aware that a model without an appropriate maintenance strategy is a model that is unlikely to see the light.</p><h4><strong>“Last time you presented me with the outputs, the numbers were different. Why? “</strong></h4><p>Be careful in showing intermediate results to Business Users — proceed step by step. No decision maker likes to see 3 very different predictions in 3 meetings in a row; at the fourth (if not earlier) they might start asking what these differences are due to… and you’ll need to justify it. It is not always easy to explain to non-technical people that there is a natural model tuning process. Some may lose faith in the team or the approach, developing the belief that you are unable to build a stable product that meets the requirements.</p><p>Asking timely questions to get timely answers. If the business users focus too much on numbers (and rightly so), the feedback process can be risky.</p><p>These are some real-life examples from my experience, it is not meant to be an exhaustive list of all the problems encountered during the development and production of an ML model. I hope they can be useful in effectively supporting the work of others.</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/building-trust-ml-data-scientists-pov-alessandro-volpe/?trackingId=t8%2B%2Fub3oSj6dRatOgZmnbQ%3D%3D"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef677ce9ed62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bip-xtech/building-trust-in-machine-learning-ef677ce9ed62">Building trust in Machine Learning</a> was originally published in <a href="https://medium.com/bip-xtech">BIP xTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forecasting Revenue and C-LTV in Subscription Businesses]]></title>
            <link>https://medium.com/bip-xtech/forecasting-revenue-and-c-ltv-in-a-subscription-business-42c8bf757804?source=rss-95971a085087------2</link>
            <guid isPermaLink="false">https://medium.com/p/42c8bf757804</guid>
            <category><![CDATA[cltv]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[survival]]></category>
            <category><![CDATA[subscription]]></category>
            <dc:creator><![CDATA[Alessandro Volpe]]></dc:creator>
            <pubDate>Mon, 13 Feb 2023 14:38:18 GMT</pubDate>
            <atom:updated>2023-03-03T18:27:06.576Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ijcsn1FExCchgOgX" /><figcaption>Photo by <a href="https://unsplash.com/@acharki95?utm_source=medium&amp;utm_medium=referral">Aziz Acharki</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Similarly to what happens in the process of acquiring new customers, companies sustain a huge cost associated with retaining existing ones (by giving out discounts, targeted offers, etc.). In every business, some customers create more value than others, and identifying such groups of “high-value” individuals can help the business to — at least — sustain the growth in a competitive way. For these reasons, it is paramount to have the right tools to estimate of the value of each customer in the Customer Base over the short and long term, in order to reduce costs and ensure revenue streams. A correct estimation and the investigation of the revenue drivers can help companies to effectively program marketing campaigns, launch new products, remove poorly performant ones from the market, etc. The calculation of the Customer Lifetime Value (C-LTV) helps evaluating the total expected value generated over the lifetime of a customer.</p><p>In this article I will investigate how to use Survival Data Mining and other Machine Learning algorithms to estimate the C-LTV of a set of customers for a Subscription Business. I will also show a methodology to forecast the revenue streams of the company based on this information.</p><p>Let’s start from a definition. The C-LTV can in general be decomposed as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ml4hvs9B15jWHn6LceP_Xw.png" /><figcaption>Schema for the calculation of the C-LTV</figcaption></figure><p>The <strong>Average Transaction Value</strong> is influenced by several factors and is generally easier to compute for subscription businesses as it is deterministic for each product or service, until varied by direct or indirect marketing initiatives (e.g. upselling, downselling, …). For non-subscription businesses the inference on the average transaction value is harder, since there is no well-defined price structure and it can also be influenced by other internal and external factors (such as product distribution, seasonality, competitors’ pricing, …). The <strong>Number of Transactions</strong> in the period is deterministically defined for subscription businesses as the renewals of the subscription plan is defined in the customer’s contract. For non-subscription businesses, there is the necessity to perform an estimation. This can be done with simpler analytics (e.g. historical averages by customer segment, …) or with machine learning models. For subscription businesses, both churn prediction models and survival analysis are valid options to estimate the <strong>Expected Retention Time</strong> value and evaluate the expected lifetime end. In non-subscription businesses we also need to define a “churn” event prior to performing an estimation on the KPI’s value to evaluate the period over which a customer will likely stop purchasing.</p><p>To turn this definition in application, I will use the following framework and later apply it to a real-world scenario to estimate future revenue of the company:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sENAHfvzgt1-xX9FdT0yog.png" /><figcaption>Framework for the estimation of Survival probability, Revenue and C-LTV</figcaption></figure><p>The internal data that I will use comes from:</p><ul><li>The company’s CRM, to collect customers’ characteristics and descriptive features (e.g. contract data, ageing, …)</li><li>Transaction database, to collect transaction details (date, amounts, method of payment, …)</li><li>Campaign systems, to collect the marketing initiatives data (new products commercialization, execution of acquisition campaigns, …)</li><li>Product catalog, to collect products’ characteristics (description, periodicity of renewal, price, …)</li></ul><p>External data can be used as well:</p><ul><li>Competitors’ offers (if available) to estimate customers’ cannibalization</li><li>Seasonality and other events to consider time-related features that impact sales, churn, … (e.g. end of month, summer vacation periods, …)</li></ul><p>All these data will be processed for the classical data science preprocessing pipeline activities: cleaning, integration, enrichment, feature selection, … Customers will then be grouped in segments based on their characteristics and active subscriptions, so that it will be possible to estimate their value — which is the price they pay for their subscription at each renewal date — and their contractual life expectancy by using survival models. This information will finally be used for the forecasting of CB volumes, revenue streams and overall segment-based C-LTV.</p><p>Let’s get to it!</p><p>For this example, I will use anonymized data from a digital media company, whose business is subscription-based. Most of customers are typically acquired with a price discount promotion that allows them to access a content at a reduced price for a limited amount of time. Some customers instead are acquired without price discounts, but they are the minority.</p><p>In the following text I will talk equivalently of customers, users, contracts, and subscriptions even if they are different concepts. For the sake of this article, I will assume that customers / users may subscribe just one contract / subscription at a time; so, we will consider individual subscriptions as single entities for the analyses. In the context of our client, upselling activities or cross-selling actions performed by a client are considered as additional entities, entering as new subscriptions. Subscriptions are collected from several databases containing active contracts and archived inactive ones. After the usual data collection and cleaning steps, which include:</p><ul><li>the dropping of features not useful for the model;</li><li>inconsistencies in the dates (e.g. activation after the cancel date, due to errors in the data storage procedure) — these data points were disregarded as they only accounted for less than 2% of the subscription base and their correct history couldn’t be reconstructed with the information available to us;</li><li>inconsistencies due to failed payments (e.g. if the credit card expired or reached the limit) — these problems occurred for a non-negligible number of clients and were thus treated with dedicated models, designed to predict the probability of a failed payment and the average delay in payment time; for the sake of this article, I will not describe the procedure that we followed.</li><li>elimination of old contracts that were managed with different marketing policies</li><li>missing values management</li></ul><p>the result of the aggregation step looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*1JzsiY0XwgRMYKq2crQNmQ.png" /><figcaption>An anonymized sample from the subscription dataset. Numbers are illustrative.</figcaption></figure><p>The relevant information resides in the following columns:</p><ul><li><strong>activation_date</strong>: subscription activation date</li><li><strong>cancel_date</strong>: date of the request for subscription cancellation</li><li><strong>expire_date</strong>: date of the subscription end, which is scheduled at the end of each subscription period</li><li><strong>platform</strong>: platform of fruition — website (desktop/tablet), apple or android</li><li><strong>payment_id</strong>: method of payment (APPLE: apple pay, BB: bank transfer, CC: credit card, PP: PayPal)</li><li><strong>product_id</strong>: the name of the subscription, including the periodicity (in number of weeks, months, years, …)</li><li><strong>promo_id</strong>: the name of the promotion that led the acquisition with the duration (in weeks or months) — in this case, the product defines the renewal periodicity and the cash discount is driven by the promo code, for the whole duration of the promotional period</li><li><strong>amount_EUR</strong>: the price paid by the customer at the moment of the observation (in this case, if the promotion is active, the amount_EUR value will represent the discounted amount)</li><li><strong>cancelled</strong>: a boolean that indicates if the contract is active at the moment of the extraction (in this case, in 2021)</li></ul><p>Let’s look at some basic info on the dataset:</p><pre>print(&quot;First activation date:&quot;, min(contract_data[&#39;activation_date&#39;]).date())<br>print(f&quot;Number of historical contracts: {contract_data.shape[0]:,}&quot;)<br>print(f&quot;Number of active contracts: {contract_data[contract_data[&#39;cancelled&#39;]==0].shape[0]:,}&quot;)</pre><pre>First activation date: 2015-01-01<br>Number of historical contracts: 602,113<br>Number of active contracts: 192,860</pre><p>Contractual data ranges from January 2015 to late 2020 with a little over 600k contracts activated since, of which 190k are still active at the time of observation (September 2020). Let’s now see how many products and promotions have been used up to the observation time:</p><pre>print(f&quot;Number of distinct products: {contract_data[&#39;product_id&#39;].nunique():,}&quot;)<br>print(f&quot;Number of distinct promotions: {contract_data[&#39;promo_id&#39;].nunique():,}&quot;)</pre><pre>Number of distinct products: 611<br>Number of distinct promotions: 696</pre><pre>print(f&quot;Number of customers acquired with a promo: {contract_data[&#39;promo_id&#39;].notna().sum():,}&quot;)</pre><pre>Number of customers acquired with a promo: 401,452</pre><p>A little over 600 products and almost 700 distinct promotions have been issued from 2015 onward for the activation of over 400k contracts (2 out of 3) each with different content, periodicity, and amounts. These will be useful to segment the Contract Base and build the forecasting models to predict the evolution of the CB and the revenue streams.</p><p>To do so, let’s build a model to predict the evolution in time of the active contracts based on their characteristics and history. We are tackling a problem in the field of Survival Analysis. The prediction of customer survival past any time-point is a complicated task due to the presence of “<strong>censored observations</strong>”, which are data points that represent an event that has not yet occurred at the time that the data was collected; in this case, they represent customers whose subscription is still active at the time of the analysis. This figure represents censored data in a graphical format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*h6jVQlVoZTn6XeLOhNUAmg.png" /><figcaption>A visual representation of right-censored data, which are observation that haven’t reached the event of interest (cancellation) at the time of observation. On the left, the x-axis represents time, the red lines represent the lifetime of subscriptions that were cancelled before the observation time, while the green lines represent subscriptions that are still active. On the right, subscriptions are “aligned” at the moment of their initial subscription and therefore x-axis represents the contract tenure; this is the format in which data needs to be represented to run survival analyses.</figcaption></figure><p>Censored observations are important in survival analysis because they provide information about the duration of time that an event has not yet occurred, which can help to improve the accuracy of the analysis. We can infer the expected behavior of active customers from others with a similar profile (e.g. same product, same acquisition promotion, same payment method, …) but different ageing (i.e. the amount of time passed since the subscription activation), whether they cancelled their subscription or not. It is therefore essential to carry out a full Survival Analysis which incorporates all the information contained in these censored observations. To achieve this goal, we implemented a set of Survival Models to forecast a time-dependent estimation on the churn probability by making an inference on the cancellation date and projecting the expected life period up to the expiry date.</p><p>In the following step, we enriched the dataset with a very basic information that allows the models to learn better. We created the <strong>contract ageing feature</strong>, defined as the number of days between the activation and the cancel date — if the contract is terminated — or the observation date in case the contract is still active. With this new information available, let’s investigate how some customer clusters behave.</p><p>We are going to use a statistical model often used in the Survival Analysis field: the Kaplan-Meier estimator. In biostatistics, the model is often used to measure the fraction of patients living for a certain amount of time after treatment but in other fields it may also be used to measure the time-to-failure of machine parts, or the survival probability of contracts before a request for cancellation. The estimator of the survival function <em>S(t)</em> (the probability that life is longer than a time <em>t</em>) is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*RvlYWFsJB6wFg87bLUi_BA.png" /></figure><p>with <em>tᵢ</em> a time (day) when at least one event happened, <em>dᵢ</em> the number of events (i.e. cancellations) that happened at time, and <em>nᵢ</em> the individuals known to have maintained the contract active (have not yet had request the cancellation) up to time <em>tᵢ </em><a href="#_ftn1">[1]</a>.</p><p>Let’s see how the survival profile of the whole Customer Base looks like.</p><pre>kmf = KaplanMeierFitter(alpha=0.05)<br>kmf.fit(<br>    contract_data[&#39;ageing_days&#39;],<br>    contract_data[&#39;cancelled&#39;],<br>    label=&#39;Contracts&#39;<br>)<br><br>plt.figure(figsize=(12,8))<br>ax = plt.subplot(111)<br>plt.title(&#39;All Contracts&#39;, fontsize=&#39;xx-large&#39;)<br><br># y-axis<br>plt.ylabel(&#39;Survival rate&#39;, fontsize=&#39;x-large&#39;)<br>plt.ylim((0.0, 1.0))<br>plt.yticks(np.arange(0.0, 1.01, 0.1))<br>plt.axhline(0.5, color=&#39;red&#39;, alpha=0.75, linestyle=&#39;:&#39;) # median line in red<br><br># x-axis<br>plt.xlabel(&#39;Timeline (days)&#39;, fontsize=&#39;x-large&#39;)<br>plt.xlim((0, 365*3+1))<br>plt.xticks([0, 30, 60, 90, 180, 365, 365*2, 365*3])<br>plt.axvline(30, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;)  # 1-month gray dashed line<br>plt.axvline(60, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;)  # 2-months gray dashed line<br>plt.axvline(90, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;)  # 3-months gray dashed line<br>plt.axvline(180, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;)  # 6-months gray dashed line<br>plt.axvline(365, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;)  # 1-year gray dashed line<br>plt.axvline(365*2, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;) # 2-years gray dashed line<br>plt.axvline(365*3, color=&#39;gray&#39;, alpha=0.5, linestyle=&#39;:&#39;) # 3-years gray dashed line<br><br>plt.plot([kmf.median_survival_time_]*2, [0, 0.5], color=&#39;red&#39;, alpha=0.5, linestyle=&#39;:&#39;) # median survival time<br><br>kmf.plot()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*-fEbb8rm7iepQR-4BZ_Ngw.png" /><figcaption>Survival function of the whole contract base, calculated with the Kaplan-Meier estimator</figcaption></figure><p>Here we observe the historical survival distribution of contracts “aligned” to the same activation date. We observe the survival function decreasing over time, with the most evident drops in correspondence to multiples of 30 days. This is due to the fact that activation promotions typically expire after 1, 2 or 3 months (some less, some more than that, e.g. 6 months or 1 year) and thus the price rise leads to several cancellations requests close to the promo expiry date. By analyzing the median survival time, we also see that 50% of all the contracts cancel the subscription after 153 days (i.e. as a rough consideration, one user out of two cancels their subscription within 5 months from the activation). We also observe that the survival function starts around 95% at day 0; this means that a set of customers cancels the renewal the very same day they activate the subscription. On the other hand, the curve not reaching 0 after 1095 days gives evidence of the most loyal customers (about 15% of the total).</p><p>To validate the previous analyses, let’s also verify how the survivals are if we drill-down on promotions with 1 month and 3 months duration, for products (for example) with a weekly subscription. We would expect to observe a large drop in the survival profile around the day of promo expiry and some other “step” drops close to the subscription renewal date, as customers majorly tend to de-activate the renewal close to the end of the period cycle.</p><pre>plt.figure(figsize=(12,8))<br>ax = plt.subplot(111)<br>plt.title(&#39;PROD1_1W contracts by promo_id&#39;, fontsize=&#39;xx-large&#39;)<br><br>contract_sample = contract_data.loc[contract_data[&#39;promo_id&#39;].isin([&#39;PROMO1_1M&#39;,&#39;PROMO1_3M&#39;]), :]<br><br>for name, grouped_dataset in contract_sample.groupby(&#39;promo_id&#39;):<br>    kmf = KaplanMeierFitter(alpha=0.05)<br>    kmf.fit(<br>      grouped_dataset[&#39;ageing_days&#39;],<br>      grouped_dataset[&#39;cancelled&#39;],<br>      label=name<br>      )<br>    kmf.plot(ax=ax)<br><br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*aNgn1IelZH1PqBhYqd87ZQ.png" /><figcaption>Survival function of all contracts activated with 2 promotions, calculated with the Kaplan-Meier estimator</figcaption></figure><p>In fact, we observe that the survival for the contracts activated with two promotions behave very differently until the promo expiry, then they behave similarly converging to about 30% survival rate after 1 year. The monthly promotion is more aggressive in price and limited in time, thus we may infer that the evident churn rate of about 10 percentage points is driven by the price rise; the contracts with the 3 months promo decay less during the first two months but show a larger drop of an additional 5–6 percentage points at the final promo expiry.</p><p>This tells us that, certainly, the promo and product features are very important to model the user behavior. By conducting further explorative analyses, we proceeded with the feature enrichment step by creating the following additional features:</p><ul><li>the <strong>days to next billing</strong>, defined as the number of days between the next billing date and the cancellation date or the observation date if the contract is still active</li><li>the <strong>number of period renewals</strong></li><li>a boolean indicating if the <strong>promo is active</strong> at the observation or cancellation date, and the number of days of promotion used so far out of the total promotional period</li><li><strong>bill shock events</strong>, defined as the difference between the product price and the promo price (i.e. the cash discount)</li><li><strong>other aggregated features</strong>, to group together product and promos with similar characteristics</li><li><strong>other features</strong> whose explanation is beyond the purpose of this article, but have revealed to be useful for the modelling phase</li></ul><p>After some feature selection steps, performed in the classical way with correlation and variance filters and by a confrontation with business stakeholders, we are now ready to proceed with the modelling.</p><p>We tested several different models to perform the forecasting, and the best and most versatile one turned out to be a Random Survival Forest (RSF) — in particular, the one implemented in the <a href="https://scikit-survival.readthedocs.io/en/stable/api/generated/sksurv.ensemble.RandomSurvivalForest.html">scikit-survival python library</a>. Random Survival Forests are a Random Forests (RF) method for the analysis of right-censored survival data; their implementation follows the same general principles as RF: a) Survival trees are grown using bootstrapped data; b) Random feature selection is used when splitting tree nodes; c) Trees are generally grown deeply, and d) The survival forest ensemble is calculated by averaging terminal node statistics <a href="#_ftn1">[2]</a>. Random Survival Forests, like other Survival models, use the <strong>concordance index (CI)</strong> as scoring metric to validate the performance of the prediction. The CI is a measure of rank correlation between predicted risk scores <em>r</em> and observed time points <em>t</em>; it is defined as <strong>the ratio of correctly ordered (concordant) pairs to comparable pairs</strong>. Two samples <em>i</em> and <em>j</em> are <strong>comparable</strong> if the sample with <em>lower observed time</em> experienced an event, i.e. if <em>tᵢ &lt; tⱼ</em> and <em>i </em>experienced an event; two samples are <strong>concordant</strong> if the estimated risk <em>r </em>by a survival model is higher for subjects with lower survival time, i.e. if <em>rᵢ &gt; rⱼ</em> and <em>tᵢ &lt; tⱼ, </em>otherwise the pair is <strong>discordant</strong>. Since we evaluate the predictive accuracy of a survival model in terms of the concordance index, it is natural to formulate the learning problem to directly maximize the concordance index. Like for the AUC, <em>CI = 1 </em>indicates perfect prediction accuracy and <em>CI = 0.5 </em>is as good as a random predictor; values over <em>0.7</em> indicate a good model while values over <em>0.8</em> indicate a strong model <a href="#_ftn1">[3]</a>.</p><p>The advantage of using the implementation above is that it is possible to use scikit-learn features for Machine Learning (e.g. One Hot Encoding, Training/Validation/Testing, Hyperparameters tuning, …) and apply them to Survival Analysis. Other implementations of Random Survival Forest were available at the time, but the one we chose had the best trade-off between versatility, memory usage, methods, and speed.</p><p>We conducted some tests and decided to train 2 models, the first for customers acquired with a promotion and the second for the remaining part of the CB. This is because both the logic of customer management and the behavior of the subscribers are very different in the two scenarios, and a separation of the two clusters was necessary to achieve satisfactory results. Besides, many features built for subscribers with a promo (e.g. the bill shock events after the promo expiry, or the residual days to the promo expiry, …) do not make sense if the customers were acquired without a promotion.</p><p>I’ll now show the procedure followed for customers with a promo. For the rest of the CB, the logic is equivalent.</p><pre>import pandas as pd<br>from sksurv.ensemble import RandomSurvivalForest<br>from sklearn.model_selection import train_test_split<br><br># Separation of target features from explainatory ones<br>X = encoded_contracts_promo.loc[:, encoded_contracts_promo.columns.difference([&#39;cancelled&#39;, &#39;duration_days&#39;])]<br>y = encoded_contracts_promo[[&#39;cancelled&#39;, &#39;duration_days&#39;]].to_records(index=False, column_dtypes={&#39;cancelled&#39;: &#39;bool&#39;, &#39;duration_days&#39;: &#39;int32&#39;})<br><br># Train/test split with stratified sampling on product periodicity (weekly, monthly, yearly, ...)<br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, stratify=X[[&#39;product_period&#39;]], random_state=42)<br><br># Hyperparameter grid search<br><br># Number of trees in the forest<br>n_estimators = [int(x) for x in np.linspace(start = 25, stop = 150, num = 6)]<br># Number of features to consider at every split<br>max_features = [&#39;auto&#39;]<br># Maximum number of levels in tree<br>max_depth = [3, 4, 5, 6]<br># Minimum number of samples required to split a node<br>min_samples_split = [5, 10, 20]<br># Minimum number of samples required at each leaf node<br>min_samples_leaf = [5, 10, 20, 50]<br># Method of selecting samples for training each tree<br>bootstrap = [True]<br><br>random_grid = {&#39;n_estimators&#39;: n_estimators,<br>               &#39;max_features&#39;: max_features,<br>               &#39;max_depth&#39;: max_depth,<br>               &#39;min_samples_split&#39;: min_samples_split,<br>               &#39;min_samples_leaf&#39;: min_samples_leaf,<br>               &#39;bootstrap&#39;: bootstrap}<br><br>rsf_promo = RandomSurvivalForest(verbose=2, n_jobs = -1)<br><br># Launching a Randomized Search Cross Validation with 10 iterations to reduce computational time<br>rsf_promo_random = RandomizedSearchCV(estimator=rsf, param_distributions=random_grid, n_iter=10, cv=5, random_state=73)<br>rsf_promo_random.fit(X_train, y_train)<br>rsf_promo_random.set_params(verbose=0)</pre><pre># Print the mean of the CI scores for each of the 10 CV folds<br>rsf_promo_random.cv_results_[&#39;mean_test_score&#39;]</pre><pre>array([0.79753196, 0.81215722, 0.80974208, 0.80341974, 0.80666907, 0.80166812, 0.80703236, 0.80099773, 0.80841127, 0.80981209])</pre><pre># Print the standard deviation of the CI scores for each of the 10 CV folds<br>rsf_promo_random.cv_results_[&#39;std_test_score&#39;]</pre><pre>array([0.00878789, 0.00366517, 0.00459539, 0.00822191, 0.00598376, 0.01559296, 0.00530683, 0.00590578, 0.00384139, 0.00363971])</pre><pre># Print the ranking of the CI scores for each of the 10 CV folds to find the best hyperparameter configuration<br>rsf_promo_random.cv_results_[&#39;rank_test_score&#39;]</pre><pre>array([10, 1, 3, 7, 6, 8, 5, 9, 4, 2])</pre><p>Our model scores around 0.8 on almost all CV folds, so it seems we are in a good spot. The second hyperparameters’ configuration is the best one, let’s take a quick peek at them and let’s test the model:</p><pre># Best RSF hyperparameters after CV<br>rsf_promo_random.best_params_</pre><pre>{&#39;n_estimators&#39;: 125,<br> &#39;min_samples_split&#39;: 20,<br> &#39;min_samples_leaf&#39;: 50,<br> &#39;max_features&#39;: &#39;auto&#39;,<br> &#39;max_depth&#39;: 5,<br> &#39;bootstrap&#39;: True}</pre><pre># Testing - To avoid memory issues we do this in batches<br>perf_array_promo = []<br>chunk_size = 20000<br>chunks = (X_test.shape[0] - 1) // chunk_size + 1<br>for i in tqdm(range(chunks)):<br>    batch_X_test = X_test[i*chunk_size:(i+1)*chunk_size]<br>    batch_y_test = y_test[i*chunk_size:(i+1)*chunk_size]<br>    perf_array_promo.append(rsf_promo_random.score(batch_X_test, batch_y_test))<br>    print(&#39;Chunk {:d} score: {:.3f}&#39;.format(i, perf_array_promo[-1]))</pre><pre>Chunk 0 score: 0.814<br>Chunk 1 score: 0.812<br>Chunk 2 score: 0.814<br>Chunk 3 score: 0.814<br>Chunk 4 score: 0.814<br>Chunk 5 score: 0.810</pre><pre># Print mean e standard deviation of CI score for the test set<br>print(&#39;Average concordance score on test set: {:.3f} \u00B1 {:.3f}&#39;.format(np.mean(perf_array_promo), np.std(perf_array_promo)))</pre><pre>Average concordance score on test set: 0.813 ± 0.002</pre><p>The performances on the test set are in line with the training, so we can call it a success! Let’s retrain the model over the full dataset with the optimal hyperparameters and let’s get ready to use it.</p><pre># Training RSF with best hyperparameter configuration<br>rsf_promo_opt = RandomSurvivalForest(**rsf_promo_random.best_params_, verbose=1, n_jobs=-1)<br>rsf_promo_opt.fit(X, y)<br><br># Let&#39;s see how the model predicts the survival function of a random subscription<br>rsf_promo_opt.predict_survival_function(X.iloc[:5], return_array=True)</pre><pre>array([[0.99454942, 0.99135762, 0.98957604, ..., 0.06977822, 0.0697145 , 0.06969038],<br>       [0.98465747, 0.97755237, 0.9735171 , ..., 0.04102673, 0.04098886, 0.04096474],<br>       [0.99454942, 0.99135762, 0.98957604, ..., 0.06977822, 0.0697145 , 0.06969038],<br>       [0.99806923, 0.99704412, 0.99651473, ..., 0.1527992 , 0.15264278, 0.15257306],<br>       [0.97411874, 0.96413707, 0.95849331, ..., 0.02035176, 0.020311 , 0.020311 ]])</pre><p>We can now use this model on the whole CB acquired with a promotion to forecast the volumes over time. Then, to obtain a survival overview on the whole CB it’ll be sufficient to concatenate the survival function obtained by the prediction of model above with the forecast obtained for all other users — which is obtained with a second model, trained on the remaining set of users similarly to the first one.</p><pre>fcast_lim = datetime(2021, 12, 31) # Forecast limit<br>reference_date = datetime(2020, 11, 25, 23, 59, 59) # Observation date<br>fcast_days = (fcast_lim - reference_date).days<br><br># Select the customers who entered the CB with a promo through the feature &quot;had_promo&quot;<br>active_promo_customers = active_customers.loc[active_customers[&#39;hadpromo&#39;]==1, features_promo]<br><br># Forecast the survival function for each promo customer in the CB and actualize on the period of interest<br># with a linear interpolation method for handling missing data points in the survival function<br>pred_promo = pd.DataFrame(rsf_promo_opt.predict_survival_function(active_promo_customers, return_array=True),\<br>                          columns=rsf_promo_opt.event_times_.astype(int),\<br>                          index=active_promo_customers.index)\<br>               .T\<br>               .reindex(range(int(rsf_promo_opt.event_times_[-1]) + fcast_days), fill_value=np.nan)\<br>               .interpolate(&#39;linear&#39;, axis=0)</pre><p>Let’s see the prediction function for subscription_id = ‘7’ for the first 10 days; day 0 here represents the activation day:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhMvN-bQoRbSh92pUJfDfw.png" /><figcaption>Survival probabilities for subscription_id ‘7’ for the first 10 days after the activation</figcaption></figure><p>Now, a fundamental concept: the prediction of the survival function is an output that ranges in [0, 1] and accounts for the survival probability for each customer from the day of the activation, onward. The result of the forecast above isn’t actualized on the ageing of the subscription, so we need to normalize each survival curve to account for the fact that customers already matured a tenure at the moment of the observation. To do this, we divide each survival curve for the survival probability corresponding to the subscription ageing at the time of the observation and then we lag each curve to have this value as the first observation of the series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*j-8XipmWnwOQq-XLyoyPIA.png" /><figcaption>A visual representation of the normalization procedure to actualize survival probabilities to the tenure of each contract. On the left, the survival function represents the survival profile of a pool of users, one of which currently has a tenure of 90 days. On the right, the survival function is then actualized for the individual user, who will now start with survival probability equal to 1.0 and reaches the asymptote at 0.5 (which is 0.15/0.30).</figcaption></figure><p>Let’s adapt the dataset to normalize survival probabilities:</p><pre># Extract the value of the probability of survival at time t=contract_ageing, for each subscription<br>contract_state_surv = np.diag(pred_df.loc[active_customers[&#39;duration_days&#39;].astype(int), active_customers.index])<br><br># Divide the column by the survival value at time t=contract_ageing, for each subscription<br>survival_df = pred_df.divide(contract_state_surv, axis=1)<br><br># Lagging to have the first observation = 1 relating to the time t=contract_ageing<br>lags = active_customers[&#39;duration_days&#39;]<br>for sub in survival_df.columns:<br>    survival_df[sub] = survival_df[sub].shift(-lags.loc[sub].astype(int))<br><br># Trim the forecasting period to keep as many rows (forecasting days) as we need<br>survival_df = survival_df.iloc[:(fcast_days+1), :]<br>survival_df.index = pd.date_range(reference_date.date(), periods=survival_df.shape[0]).tolist()</pre><p>Let’s see the new survival function for subscription_id = ‘7’ for the first 10 days, where day 0 represents the observation day:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0i5xCUNsGd-8nhlsppBpAQ.png" /><figcaption>Survival probabilities for subscription_id ‘7’ for the first 10 days after the observation day.</figcaption></figure><p>As we expected, the survival curve for each customer is now normalized and it accounts for the survival probability in the actualized customer lifecycle. We now have all the elements to compute the forecast of the CB volumes from September 2020 onward.</p><pre># Compute CB per month closure<br>fcast_cb_month = survival_df.copy()<br>fcast_cb_month.index = pd.to_datetime(fcast_cb_month.index)<br>fcast_cb_month = fcast_cb_month.resample(&#39;M&#39;).last().T<br>fcast_cb_month.sum().apply(lambda x: x).apply(&#39;{:,.0f}&#39;.format)</pre><pre>2020-09-30     192,860<br>2020-10-31     178,935<br>2020-11-30     168,707<br>2020-12-31     160,655<br>2021-01-31     153,927<br>2021-02-28     147,365<br>2021-03-31     139,266<br>2021-04-30     133,598<br>2021-05-31     129,512<br>2021-06-30     124,373<br>2021-07-31     119,341<br>2021-08-31     114,573<br>2021-09-30     110,129<br>2021-10-31     107,216<br>2021-11-30     105,620<br>2021-12-31     102,130<br>Freq: M, dtype: object</pre><p>Without considering new activations, we can observe that the company would lose almost half their initial 192k active subscriptions after 12 months.</p><p>To obtain a forecast for the total revenue, we can now weight each customer’s survival probability for their generated value. We consider each subscription’s billing amount and renewal period (considering both the residual promotional period, if any, and the landing price of the service), and multiply it by the expected survival probability at each payment’s deadline. I will not report the code for this part as it’s quite verbose; this is the final result:</p><pre># Compute revenue (in EUR) per month closure<br>fcast_rev_month = income_df.copy()<br>fcast_rev_month.index = pd.to_datetime(fcast_rev_month.index)<br>fcast_rev_month = fcast_rev_month.resample(&#39;M&#39;).sum().T</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrTsDe-eDcroitv0wcOiXw.png" /><figcaption>Revenue forecast for 5 users at random for the first 16 months from the observation day. Numbers are illustrative.</figcaption></figure><p>Let’s now forecast the total revenue for the company:</p><pre>fcast_rev_month.sum().apply(lambda x: x).apply(&#39;{:,.0f} €&#39;.format)</pre><pre>2020-09-30     2,612 k€<br>2020-10-31     2,363 k€<br>2020-11-30     2,142 k€<br>2020-12-31     2,087 k€<br>2021-01-31     1,956 k€<br>2021-02-28     1,712 k€<br>2021-03-31     1,790 k€<br>2021-04-30     1,742 k€<br>2021-05-31     1,727 k€<br>2021-06-30     1,629 k€<br>2021-07-31     1,585 k€<br>2021-08-31     1,548 k€<br>2021-09-30     1,390 k€<br>2021-10-31     1,411 k€<br>2021-11-30     1,356 k€<br>2021-12-31     1,380 k€<br>Freq: M, dtype: object</pre><p>The results obtained for the forecasts are:</p><ul><li>1.9% MAPE on the 30 days prediction of the CB volume</li><li>4.8% MAPE on the 30 days prediction of the total revenue</li><li>3.9% ± 2% average MAPE on the monthly prediction of the CB volume over a 12 months-time span</li></ul><p>By aggregating users based on any dimension (e.g. promo type, product type, platform, payment method, …), we can finally derive the C-LTV of any customer segment. This is an example of how the LTV for each tuple (promo, product) looks like. To obtain it we aggregated all weighted revenue forecast for each product/promo tuple and then averaged over each group. The forecast horizon considered for this calculation is 5 years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*DiEvtCRBDvHHavfARhFV_Q.png" /><figcaption>LTV and number of active subscriptions for 3 customer segments. Numbers are illustrative.</figcaption></figure><p>We notice how customers owning products with yearly renewal generate more value over the long term with respect to others.</p><p>As a conclusion for this work, we implemented and engineered all the data processing and modelling workflows on Google Cloud Platform and deployed a series of directional BI dashboards on Google Looker to present all relevant views and KPIs to operational and managerial users. This information is used to monitor the main company results and to design the promotions plan during budgeting and reforecasting periods; promotions are used by the company to stabilize the CB and to sustain revenue streams over the short and medium term.</p><p>In the next article, I’ll show how we complemented this work by implementing an additional module to allow the Sales &amp; Planning Team to run scenarios and simulate the impact over new customer acquisitions based on different promotional plans.</p><h4>References</h4><p><a href="#_ftnref1">[1]</a> <a href="https://en.wikipedia.org/wiki/Kaplan%E2%80%93Meier_estimator">https://en.wikipedia.org/wiki/Kaplan%E2%80%93Meier_estimator</a></p><p><a href="#_ftnref1">[2]</a> <a href="https://www.randomforestsrc.org/articles/survival.html">https://www.randomforestsrc.org/articles/survival.html</a></p><p><a href="#_ftnref1">[3]</a> <a href="https://scikit-survival.readthedocs.io/en/stable/user_guide/evaluating-survival-models.html">https://scikit-survival.readthedocs.io/en/stable/user_guide/evaluating-survival-models.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42c8bf757804" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bip-xtech/forecasting-revenue-and-c-ltv-in-a-subscription-business-42c8bf757804">Forecasting Revenue and C-LTV in Subscription Businesses</a> was originally published in <a href="https://medium.com/bip-xtech">BIP xTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Sustainability of AI]]></title>
            <link>https://medium.com/bip-xtech/the-sustainability-of-ai-a8484ad0ef92?source=rss-95971a085087------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8484ad0ef92</guid>
            <category><![CDATA[social]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[sustainability]]></category>
            <dc:creator><![CDATA[Alessandro Volpe]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 09:05:09 GMT</pubDate>
            <atom:updated>2022-09-30T09:05:09.245Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPa5q6AziR261FGWjYcI1A.jpeg" /><figcaption>Photo by Lukas from Pexels</figcaption></figure><p><strong><em>It’s the year of Sustainability.</em></strong></p><p>In a great number of industries, from manufacturing to medicine, from agriculture to human capital, never “ESG” and “Sustainability” have been presented more often worldwide as central topics in conferences, workshops, companies’ investment boards, etc.</p><p><strong>Artificial Intelligence (AI)</strong>, among other technological enablers, is (and will be) playing a central role for empowering societies and organizations in being more environmentally responsible, more inclusive, more sustainable. The application of AI for Sustainability is discussed extensively over the internet and in many conferences due to all the initiatives that are being launched around <strong>ESG and Sustainable Development</strong>. Some examples may be the use of AI to reduce carbon emissions by optimizing engines workloads, the reduction of energy consumption in buildings based on people presence, the minimization of production waste by reducing defects along the production chain, and many more.</p><p>Many startups have also been born employing AI as a central asset of their offering on Sustainability (some examples: <a href="https://clarity.ai/">Clarity AI</a>, <a href="https://bluerivertechnology.com/">Blue River</a> — not exhaustive).</p><p>While “ <strong>AI for Sustainability</strong>” is a well known and discussed argument, the “ <strong>Sustainability of AI</strong>” is treated less. I thought it would be good idea to present some concepts that I worked on in the last few months to present a point of view on how organizations can act to <strong>improve the success of their AI initiatives</strong>. In its essence, “sustainability” simply refers to the ability of something to continue over time. With “Sustainability of AI” I refer to the most relevant aspects that enterprises and Data Scientist need to implement (or simply keep in mind) to sustain the development of AI systems inside the organization or, broadly speaking, inside our society.</p><p>I’m using the following framework to describe the dimensions of AI Sustainability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*TAC2kVB6yMF023gkxLTONw.jpeg" /><figcaption>Image from author — The 3 dimensions that influence the Sustainability of AI</figcaption></figure><p>The model develops on 3 dimensions: <strong>Governance, Social and Environmental</strong>. In order for an AI initiative to be successful, it needs to be <strong>governed properly</strong>, meaning that it needs to be devised and executed in a sustainable way, from the initial strategy to its operation and monitoring. Besides the governance aspect, <strong>Data Science teams</strong> implementing the AI initiatives need to be organized with a model that allows a sustainable collaboration and management system. Finally, a look to the <strong>environmental impact of AI</strong>: training and serving models does not come for free in terms of energy consumption; besides the immediate impact on the environment, the moment when energy consumption of AI models and their emissions will be regulated is not that far away. For these reasons, it’s a good idea to also start thinking about: “how environmentally sustainable are our AI systems?”.</p><p>Let’s dig into it!</p><h3>Governance — Sustainable AI lifecycle</h3><p><em>Sustainable AI strategy</em></p><p>The starting point with respect to the adoption of AI in the company is to have a <strong>sustainable AI-driven transformation strategy</strong>, with a clear and shared plan on which there is commitment at all company levels (from the governance to operational levels). The AI roadmap is typically based on use cases and must consider constraints and accelerating factors to adoption — for these reasons, it is important also to take into consideration other ongoing digital transformation plans, in order to <strong>synchronize activities and objectives, and delivery capabilities</strong>.</p><p><em>Model development / operation governance</em></p><p>The ability to implement an AI strategy (therefore the realization of the AI roadmap) is more effective if the <strong>development and operation processes</strong> of the models are structured and solid. Otherwise, the risk is to remain stuck at the POC stage rather than effectively deliver models to production. The selection of the most correct model, the scalability of each step of the model lifecycle (to face ever increasing complexity in data management), the tracing of the experiments, the versioning of data and the models are all elements of challenge which, if not managed properly, typically lead to failure or a significant slowdown of the initiatives.</p><p><em>Models’ performance monitoring and ROI</em></p><p>Estimating the ROI of the models is a necessary step both <strong>in the planning phase and in the final assessment of the output results</strong>. As far as possible, all the models must have associated the relative return on investment KPIs that allow the management to prioritize their adoption, accelerate / interrupt their development efforts and identify any need for maintenance interventions in the event of performance degradation (model drift).</p><p><em>Ethics of AI usage</em></p><p>Having an ethical framework for the usage of AI in enterprises is relevant, since it establishes <strong>guidelines for the responsible use of AI</strong>, ensures transparency, fosters a positive impact on consumers. Enterprises today face several ethical challenges in the usage of AI, among others: <strong>Explainability </strong>(being able to motivate model outcomes and trace the root-causes to the source data, in particular in the event of BIAS towards groups of customers), <strong>Responsibility </strong>(conceiving, developing, and deploying AI systems for the “good” and “fairness treatment” of customers / society), and <strong>Privacy </strong>(ensuring security and traceability of data usage in AI systems). Being able to address ethical issues for AI systems ensures the protection of individual rights like freedom and privacy, equality and fairness as well as helps anticipating solutions that eventually will become legal requirements to comply with (e.g. upcoming <a href="https://artificialintelligenceact.eu/">EU AI Act</a>).</p><h3>Social — Sustainable organization</h3><p>On the path to becoming a data driven company, the adoption of AI requires organizations to also change their organizational structure to <strong>align roles’ responsibilities with the requirements</strong> generated when creating, managing, operating and serving AI. In many organizations, this organizational shift is translated to a “Data &amp; Analytics Team”, or “Data Team”.</p><p>Depending on the complexity of the organization itself, the Data Team is one of the main actors in the development of ML assets together with IT stakeholders (who typically manage the infrastructure/analytics environment), the Business Lines (who are served with the outputs of the models) and other Digital Hubs / IT Business Partners (who deploy applications, maintain applications, develop custom software, … — e.g. the Data Engineering team can be seen as a “Digital Hub” under this framework). The sustainability of AI is related to how much the Data Team can sustain heavy workloads and how fast; the Team’s capability to achieve its mission is influenced by the organizational model it needs to comply to.</p><p>There are 3 main models that are typically adopted by companies (others might be variations).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ifjr4EoWSFTHKo2VXT_mcQ.png" /><figcaption>Image from author — 3 organizational models for Data Science teams in organizations</figcaption></figure><ul><li>In the <strong>Distributed model</strong>, analysts are distributed across BUs or functions; they are allocated only to projects within their silos and each unit performs its own tasks with no corporate consolidating structure. This is good when the needs have to be closely aligned to business units objectives and Data Scientists require vertical know-how. However, with this model it may be difficult to realize a common vision, cross-collaboration mechanisms become harder to implement and there might be redundancies in the activities as well as absence of standardization.</li><li>In the <strong>Centralized model</strong>, Data Scientists reside in a Central Unit, acting as a service provider to the entire organization on different projects. Processes and development methodologies are more standardized and best practices and ideas are easily shared organization-wide. On the other hand, it might happen that the Data Team perceives resistance from the rest of the organization if they are unresponsive to the needs of the business due to heavy workloads and time constraints.</li><li>The last model is the <strong>CoE (Centre of Excellence)</strong>. In this one, Data Scientists are based primarily in BUs and functions while activities are coordinated by a central governance unit (the CoE); Data Scientists are allocated to the BUs according to project needs. The model allows to serve both enterprise activities — e.g. reporting and visualization — and function-specific analytics such as Machine Learning. On the other hand, the CoE may not have enough control over decentralized staff to be able to truly oversee and coordinate their work and ensure effectiveness.</li></ul><p>The choice of the <strong>most efficient model</strong> to ensure the sustainability of the AI program clearly depends on the strategic vision of the company, on the types of use cases to work on, and on the skills and numbers of the Data Team.</p><h3>Environmental — Sustainable impact</h3><p><strong><em>CO2 emissions and energy consumption</em></strong></p><p>Not everyone thinks about it, but the training and serving of (large) AI models has a <strong>non-negligible impact on the environment</strong>. In particular, deep learning models such as language models, image / audio processing models, etc. require a huge consumption of resources (end energy) for both the training and the inference phases.</p><p>Since the advent of Deep Learning in the early 2010s, the scaling of training compute has accelerated, doubling approximately every 6 months; in the modern era, we reached the point where the doubling of computing power requirements for Deep Learning models training happens every 3–4 months. In late 2015, a new trend emerged as firms developed large-scale ML models with 10 to 100-fold larger requirements in training compute.</p><p>As for the core processes of companies, for AI systems as well is spreading an increasing consensus on the need to <strong>make their usage responsible from a climatic and environmental point of view</strong>, limiting as much as possible the CO2 emissions associated with the use of AI in companies.</p><p>Here are some recommendations that can help reduce the environmental impact from the use of AI:</p><ul><li><strong>Choose wisely the class of ML algorithms</strong> to be used: try to not over-complicate the development phases as complicate models are typically more resource-greedy</li><li><strong>Don’t train a model from scratch</strong> if it is not necessary: training a heavy model from scratch can burn up a lot of CPU/GPU power; hence, using a pre-trained model can reduce the carbon footprint significantly as less electricity is necessary</li><li>When necessary, <strong>use Automated ML (Auto-ML)</strong>; determining which model is the most efficient and quickly eliminating the less efficient models not only saves time and money on the computational side but also minimizes the carbon footprint</li><li>The use of <strong>public cloud computing platforms</strong> helps reducing the impact on the environment: companies like Google <a href="https://www.google.com/about/datacenters/efficiency/">have shifted to a high percentage of renewables as primary power sources</a>, reducing carbon footprint significantly. Also, an opportune choice of the <strong>datacenter region </strong>can impact, if the specific region relies on renewables more than others.</li></ul><p><strong><em>Solutions and packages to evaluate environmental impact of AI</em></strong></p><p>How much do your AI models consume? Both open-source packages and vendor-based solutions are available that help estimate and monitor the CO2 consumption produced by ML models.</p><p>Check this out: <a href="https://codecarbon.io/">https://codecarbon.io/</a> — <strong>CodeCarbon </strong>is a Python package for tracking the carbon emissions produced by various kinds of computer programs, from straightforward algorithms to deep neural networks.</p><p>I hope that this digression is a good reflection point for organizations at any stage of maturity in the AI development lifecycle for being more sustainable in the development and maintenance of their (new) AI systems.</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/sustainability-ai-alessandro-volpe/?trackingId=MFZdAi7pRM%2B3ZH7O3YFDYQ%3D%3D"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8484ad0ef92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bip-xtech/the-sustainability-of-ai-a8484ad0ef92">The Sustainability of AI</a> was originally published in <a href="https://medium.com/bip-xtech">BIP xTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>