<?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 Rasmus Velling on Medium]]></title>
        <description><![CDATA[Stories by Rasmus Velling on Medium]]></description>
        <link>https://medium.com/@velling?source=rss-893f31e3f7f0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fXwYY1akxSdNhJ1U.jpg</url>
            <title>Stories by Rasmus Velling on Medium</title>
            <link>https://medium.com/@velling?source=rss-893f31e3f7f0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 01:14:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@velling/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[Using AI to Optimize Marketing across Multiple Platforms]]></title>
            <link>https://medium.com/kayak-tech/using-ai-to-optimize-marketing-across-multiple-platforms-6602e3765b2f?source=rss-893f31e3f7f0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6602e3765b2f</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[marketing-strategies]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Rasmus Velling]]></dc:creator>
            <pubDate>Tue, 17 Jul 2018 15:36:01 GMT</pubDate>
            <atom:updated>2018-07-17T15:36:01.024Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By Emil S. Jørgensen, Imran Kocabiyik and Rasmus N. Velling</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVobIm8wVc3uIgU96Ns6Yw.jpeg" /></figure><p>A key aspect behind the success of KAYAK lies in the way we do marketing. Today, our company portfolio consists of 6 brands operating in 60+ countries around the world, and successful marketing strategies are vital to ensure further global expansion. To aid our strategic decisions, we apply a range of advanced analytics tools to measure and compare the performance of different marketing activities. One challenging problem in particular is to ensure that we provide a fair comparison between offline (TV) and online marketing (Facebook, YouTube, etc.) for use in high level budget allocation. To resolve this problem, we developed a customized machine learning framework that measures the individual contribution of each of our activities and uses the evaluation to recommend an <strong>optimal media mix</strong>.</p><p>In this post, we provide a glimpse under the hood of our modeling framework — indeed, whereas the effect of some channels seems to be linear by nature, others display strong nonlinear dependency between marketing pressure and revenue impact. Specifically, we illustrate how the <a href="http://www.r-project.org/">R</a> add-on package <a href="https://cran.r-project.org/package=mboost">mboost</a> can be used to identify nonlinear effects of inputs within the class of <strong>generalized additive (regression) models</strong>.</p><h3>Reasons why Marketing Effects are <em>S</em>-shaped</h3><p>Marketing at KAYAK happens via multiple platforms with complicated interaction effects. As a consequence, isolating the individual contribution of each marketing channel has become an increasingly difficult task. We expect the effect of each channel to have a natural <strong>saturation point </strong>after which the incremental value of posting more money into that particular channel becomes negligible. Moreover, some channels likely require a certain amount of pressure before their effect kicks in, i.e. the pressure has to exceed a certain <strong>threshold</strong> before yielding an effect. Combined, these observations lead to <em>S</em>-shaped dynamics, which we visualize below.</p><h4>Saturation</h4><p>Intuitively, we expect that after a certain level of marketing pressure, additional exposure will have less or no further impact on our financial performance. For instance, a user may already have been exposed to one of our ads 20 times within the past week and one would think that, at least on average, any extra exposure would fail to have a real impact. Hence, the saturation concept corresponds to a diminishing effect, going to zero, which we exemplify below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kRkvRpb2DtprFA4G8fPzIA.png" /></figure><h4>Thresholds</h4><p>Threshold effects, in turn, appear if a certain amount of marketing pressure is needed for a channel to start generating value. By taking competition and noise into account, it makes sense that a <strong>critical mass</strong> is necessary to yield effect — especially on larger platforms. An appropriate analogy would be having to shout louder than the vendor next to you at a street market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWjKsMj8szJ_VwAN4eHyAg.png" /></figure><h3>Taking Care of Business</h3><p>The business problem posed by our Chief Marketing Officer was simple; “Based purely on data, what is the best way to spend our marketing budget for any country in which we operate?”. To answer this question, we set out to identify a function <em>f(x)</em> that, for a given input <em>x</em>, is able to predict our revenue <em>y</em>. Eventually, this lead us to consider so-called generalized additive models (GAMs) — a highly flexible class of regression models that takes as input all factors, we believe have a causal effect on our performance. This includes our own marketing activities, but also external factors such as market dynamics (competitor spendings, seasonal dynamics, macroeconomic growth) and many other categories.</p><p>A GAM model has the general form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/1*XsvbwwIAX6IdBePIjKWQCg.png" /></figure><p>where <em>t</em> denotes time measured in days, <em>i</em> the index of a given input variable (e.g. the amount of TV pressure on that particular day), and <em>f_i</em> the marginal effect due to input <em>x:i</em>. A key challenge for analyzing performance across platforms is to simultaneously estimate the functions <em>f_i</em>, keeping the possibility of <em>S</em>-shaped dynamics in mind.</p><h3>A Machine Learning Approach to Estimation</h3><p>As a team of data engineers and data scientists, one of our main concerns is never to impose too strict assumptions on the data we’re trying to model, and rather let the data “speak for itself”. Although S-shaped effects are intuitively intriguing, reality may be entirely different. Hard coding certain types of behavior should always lead to less belief in the outcome of a model. Luckily modern statistics has our back here!</p><p>While GAM models have been around for 30 years, recent research into computational aspects of their application has been a major topic of research only recently. There’s a highly suitable framework for estimating nonlinear effects using a machine learning technique known as <strong>boosting</strong>, which<strong> </strong>is provided by the R add-on package mboost. In particular, this framework:</p><ol><li>allows us to specify weak assumptions on the behavior of each individual inputs,</li><li>is applicable with high-dimensional inputs and filters inputs with no measurable effect,</li><li>is computationally fast!</li></ol><h4>An Example using Simulated Data</h4><p>[DRUMROLL] This is what you have all been waiting for: how it actually works. In this, very simple and naïve, example, we’ll compare the good-old linear regression with an MBOOST-model (with only very few tweeks) on some simulated data. We’ll simulate the data, so that we know it has nonlinear effects between (some) <em>x</em>’s and our outcome <em>y</em>.</p><p>Imagine we explain sales <em>y</em> by the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*DuDfUk1xHbjwL7MIKBq3Wg.png" /></figure><p>Which means that <em>x1</em> is linear, <em>x2</em> is a logistic growth function and <em>x3</em> is concave. ϵ is random, normal distributed noise. We’ll limit each input to the range 0 to 300.</p><p><strong>The code (R)</strong></p><pre><strong>library</strong>(tidyverse)</pre><pre>df &lt;- data.frame(<br>  x1 = runif(1000, 0, 300),<br>  x2 = runif(1000, 0, 300),<br>  x3 = runif(1000, 0, 300),<br>  e  = rnorm(1000, mean = 0, sd = 2)<br>)</pre><pre>df$y &lt;- .1*df$x1 +<br>  20/(1+ exp(-.1*(df$x2 - 100))) +<br>  sqrt(df$x3) +<br>  df$e</pre><pre>test     &lt;- sample(1:nrow(df), 200)<br>df_train &lt;- df[-test, ] %&gt;% select(-e)<br>df_test  &lt;- df[test, ] %&gt;% select(-e)</pre><h4>Models fitted</h4><p>We will do a simple test with two fits: a linear regression and an (almost) out-of-the-box GAM-booster from mboost.</p><ol><li>Linear regression</li><li>GAM BOOST w. simple, increasing splines</li></ol><p>Knots determine how many “slices” in the data within which we fit splines. Degree determine the degree of the regression spline. More knots and more degrees will, eventually, lead to overfitting. So these should be tweeked according to the problem at hand.</p><p><strong>The Code</strong></p><pre>fit_lm &lt;- lm(y ~ x1 + x2 + x3, data = df_train)</pre><pre>fit_gam &lt;- mboost::gamboost(<br>  formula = as.formula(paste0(<br>    &quot;y ~ bbs(x1, knots=4, degree=3) + &quot;,<br>    &quot;bbs(x2, knots=4, degree=3) + &quot;, <br>    &quot;bbs(x3, knots=4, degree=3)&quot;)),<br>  data = df_train,<br>  control = boost_control(mstop = 2500)<br>)</pre><h4>Test — predictions vs true value</h4><p>We have the data split in two: a training and a test set. We want to see how the models fitted on the training set explain the test data.</p><p>Our first graph is a plot of the predicted values from the two fits against the “true” values. It generally shows us, that our mboost-model (green dots) seems to come closer to the true values (the blue dots), than the linear regression (red dots) does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn2RYEFnkL7lLwJrVyfV3w.png" /></figure><p>We could also illustrate this with the distribution of the two models’ error terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9SZWyBuIpHv6oJGgoBkfw.png" /></figure><p>The overall conclusion seems to be that mboost comes closer. But it is also worth noting, that it seems to capture the nonlinearity better. Looking at the distribution of the error terms, we see that GAM generally produces lower errors, and perhaps also more “normal” errors.</p><h4>Stylized fits</h4><p>Of further interest is also how well mboost captures the individual channels’ potential nonlinearities against the linear model, which does nothing in this direction:</p><p><strong>Stylized fit: <em>x1</em></strong></p><p>The “true” <em>x1</em> was linear, and both models seem to capture this. It is important to keep in mind that our restrictions in the mboost <strong>allowed </strong>for a nonlinear estimate of <em>x1</em>, but the estimate yielded is almost linear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UFcr0NgpddeosA93WLJB2A.png" /></figure><p><strong>Stylized fit: <em>x2</em></strong></p><p>Before looking at <em>x2</em> and <em>x3</em> we just, once more, want to emphasize, that the assumptions made for all inputs in the mboost model where the same, but the model was still able to differentiate between the linear and the nonlinear inputs.</p><p>The true <em>x2</em> had both a threshold point and a saturation point. The out-of-the-box mboost fit gets pretty close to capturing this. The linear model does… not (surprised?).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tL5nNOy4p2yba2aoaTtYxQ.png" /></figure><p><strong>Stylized fit: <em>x3</em></strong></p><p>The true <em>x3</em> was a concave function. We see, once more, that mboost gets pretty close to capturing this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yyYImSP6CGNFAYM3NrdFtQ.png" /></figure><h3>Wrappin’ Up</h3><p>Generally, the boosting algorithm implemented for GAM models in mboost provides a powerful estimation framework for high-dimensional regression models with nonlinear effects. Moreover, although the example in this post is too simple to reflect modern applications in data science, the framework can easily be applied to higher dimensional models. To dive deeper into the realm of statistical boosting, an excellent place to start is the official documentation supplied by the authors at <a href="https://cran.r-project.org/package=mboost">CRAN</a>. Happy modelling!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6602e3765b2f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kayak-tech/using-ai-to-optimize-marketing-across-multiple-platforms-6602e3765b2f">Using AI to Optimize Marketing across Multiple Platforms</a> was originally published in <a href="https://medium.com/kayak-tech">Life at KAYAK</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>