<?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 Sonalikumari on Medium]]></title>
        <description><![CDATA[Stories by Sonalikumari on Medium]]></description>
        <link>https://medium.com/@sonalikumari80?source=rss-6503f6ed70e8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4YiAWMIztuXr8Ebh.jpg</url>
            <title>Stories by Sonalikumari on Medium</title>
            <link>https://medium.com/@sonalikumari80?source=rss-6503f6ed70e8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:09:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sonalikumari80/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[Smart Bid Shading Strategies in First-Price Auctions: Theory, Simulation, and Optimization]]></title>
            <link>https://medium.com/@sonalikumari80/smart-bid-shading-strategies-in-first-price-auctions-theory-simulation-and-optimization-468c7d0044a1?source=rss-6503f6ed70e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/468c7d0044a1</guid>
            <category><![CDATA[adtech]]></category>
            <dc:creator><![CDATA[Sonalikumari]]></dc:creator>
            <pubDate>Sun, 15 Jun 2025 08:35:57 GMT</pubDate>
            <atom:updated>2025-06-15T08:35:57.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In the evolving world of programmatic advertising, a significant shift has occurred: many major ad exchanges and platforms have moved from second-price auctions to <strong>first-price auctions</strong>. While second-price auctions incentivize truth-telling (bidding your true value), first-price auctions require <strong>strategic bid shading</strong> to avoid overpaying.</p><p><strong>Bid shading</strong> refers to the practice of bidding slightly less than your true valuation to optimize performance, especially in competitive environments. In this article, we explore the theory behind bid shading, simulate auction environments, and optimize the shading factor with Python code.</p><h3>Auction Primer: First-Price vs. Second-Price</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*bhZiZmADXd5A5k1NMz26jw.png" /></figure><h3>What is Bid Shading?</h3><p>In first-price auctions, the highest bidder wins and pays the price they bid. Without any adjustment, this can lead to <strong>overbidding</strong> and <strong>margin loss</strong>. Bid shading mitigates this by reducing your bid below your true valuation:</p><ul><li><strong>True valuation</strong>: The expected value of the impression (e.g., CTR × conversion value)</li><li><strong>Shaded bid</strong>: bid = value × shading_factor, where shading_factor ∈ [0.5, 1.0]</li></ul><p>The challenge is <strong>choosing the right shading factor</strong> that balances:</p><ul><li>Win rate (more wins = more volume)</li><li>ROI/margin (not overpaying = higher efficiency)</li></ul><h3>Theoretical Framework</h3><p>Let:</p><ul><li>v be the true valuation of the impression</li><li>b = v × s be the bid after shading (where 0 &lt; s ≤ 1)</li><li>P_win(b) be the probability of winning the auction with bid b</li><li>E[profit] = P_win(b) × (v - b) is expected profit</li></ul><h3>Objective:</h3><p>Maximize expected profit over s:</p><pre>s* = argmax_s P_win(v × s) × (v - v × s)</pre><p>This shows that <strong>expected profit is a trade-off between win probability and cost efficiency</strong>.</p><h3>Python Simulation Code</h3><p>We now simulate this setup in Python. Assume you’re competing in a 1st-price auction against N other bidders whose bids are drawn from a known distribution.</p><h3>Step 1: Define the simulation</h3><pre>import numpy as np<br>import matplotlib.pyplot as plt<br><br>def simulate_auction(true_value, shading_factor, competitors=5, n_sim=1000):<br>    wins = 0<br>    total_cost = 0<br>    total_value = 0<br><br>    for _ in range(n_sim):<br>        others = np.random.uniform(0.8 * true_value, 1.2 * true_value, competitors)<br>        my_bid = true_value * shading_factor<br><br>        if my_bid &gt; max(others):<br>            wins += 1<br>            total_cost += my_bid<br>            total_value += true_value<br><br>    if total_cost == 0:<br>        roi = 0<br>    else:<br>        roi = (total_value - total_cost) / total_cost<br><br>    win_rate = wins / n_sim<br>    return shading_factor, roi, win_rate</pre><h3>Step 2: Optimize Shading Factor</h3><pre>true_value = 3.0  # e.g., expected impression value in $<br>shading_factors = np.linspace(0.5, 1.0, 20)<br><br>results = [simulate_auction(true_value, s) for s in shading_factors]<br><br>shades, rois, win_rates = zip(*results)</pre><h3>Step 3: Plot ROI and Win Rate vs. Shading</h3><pre>fig, ax1 = plt.subplots()<br><br>ax1.plot(shades, rois, label=&#39;ROI&#39;, color=&#39;blue&#39;, marker=&#39;o&#39;)<br>ax1.set_xlabel(&#39;Shading Factor&#39;)<br>ax1.set_ylabel(&#39;ROI&#39;, color=&#39;blue&#39;)<br>ax1.tick_params(axis=&#39;y&#39;, labelcolor=&#39;blue&#39;)<br><br>ax2 = ax1.twinx()<br>ax2.plot(shades, win_rates, label=&#39;Win Rate&#39;, color=&#39;green&#39;, marker=&#39;x&#39;)<br>ax2.set_ylabel(&#39;Win Rate&#39;, color=&#39;green&#39;)<br>ax2.tick_params(axis=&#39;y&#39;, labelcolor=&#39;green&#39;)<br><br>plt.title(&#39;ROI and Win Rate vs. Shading Factor&#39;)<br>plt.grid(True)<br>plt.show()</pre><h3>Output Interpretation</h3><ul><li><strong>Low shading (0.5–0.6)</strong>: Low bids, low win rate, high ROI when won.</li><li><strong>Medium shading (0.7–0.85)</strong>: Good trade-off — decent win rate, acceptable cost.</li><li><strong>High shading (0.9–1.0)</strong>: High win rate, but costs rise, ROI may drop.</li></ul><p>Optimal shading typically lies around 0.7–0.85, but depends on market dynamics.</p><h3>Real-World Applications &amp; Extensions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*ztEwEtKP93BRgseI7men-Q.png" /></figure><h3>Business Impact</h3><ul><li>Improve ROI on campaigns in competitive auction environments</li><li>Reduce margin loss from aggressive bidding</li><li>Build transparent, explainable bidding logic</li><li>Enable dynamic control over campaign aggressiveness</li></ul><h3>Conclusion</h3><p>Bid shading is a must-have tactic in modern first-price auction systems. With a few lines of code and basic statistical modeling, you can build a system that balances cost efficiency and win probability.</p><p>This article demonstrated:</p><ul><li>The theory behind shading</li><li>Simulation of a competitive auction</li><li>How to optimize shading to improve ROI</li></ul><p>You can extend this simulation with real auction logs, real-time feedback loops, and even reinforcement learning for dynamic bid shading agents.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=468c7d0044a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smarter Ad Campaigns with Dynamic Multi-Objective Optimization and Reinforcement Learning]]></title>
            <link>https://medium.com/@sonalikumari80/smarter-ad-campaigns-with-dynamic-multi-objective-optimization-and-reinforcement-learning-ab7ee816dc29?source=rss-6503f6ed70e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab7ee816dc29</guid>
            <dc:creator><![CDATA[Sonalikumari]]></dc:creator>
            <pubDate>Wed, 28 May 2025 14:48:49 GMT</pubDate>
            <atom:updated>2025-05-28T14:48:49.440Z</atom:updated>
            <content:encoded><![CDATA[<p>In digital advertising, success hinges on the ability to optimize multiple objectives simultaneously. Maximizing Click-Through Rate (CTR) while minimizing Cost Per Acquisition (CPA) are two goals that often conflict. Moreover, user behavior and market dynamics evolve over time, demanding a solution that can learn and adapt dynamically.</p><p><strong>This article combines Dynamic Multi-Objective Optimization (DMOO)</strong> with a <strong>Reinforcement Learning-inspired feedback loop</strong>. Using Python’s DEAP library, we simulate an adaptive system that continuously refines campaign bidding strategies in a fluctuating ad environment.</p><h3>Problem Formulation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*ttcLfVXRm5tc7OPQ7F-uoA.png" /></figure><p>This is a <strong>multi-objective optimization problem</strong>, where the aim is to maximize CTR and minimize CPA simultaneously.</p><h3>Code Implementation</h3><h3>Simulating the Ad Environment</h3><pre>import numpy as np<br>import pandas as pd<br><br>np.random.seed(42)<br>data_size = 500<br>ads = pd.DataFrame({<br>    &#39;Ad_ID&#39;: range(data_size),<br>    &#39;Base_CTR&#39;: np.random.uniform(0.01, 0.15, data_size),<br>    &#39;Base_CVR&#39;: np.random.uniform(0.01, 0.10, data_size),<br>})<br>ads[&#39;Base_CPA&#39;] = 1 / (ads[&#39;Base_CTR&#39;] * ads[&#39;Base_CVR&#39;])</pre><h3>Initializing the DEAP Optimizer</h3><pre>from deap import base, creator, tools, algorithms<br>import random<br><br>creator.create(&quot;FitnessMulti&quot;, base.Fitness, weights=(1.0, -1.0))<br>creator.create(&quot;Individual&quot;, list, fitness=creator.FitnessMulti)<br>toolbox = base.Toolbox()<br>toolbox.register(&quot;attr_float&quot;, random.uniform, 0.8, 1.2)<br>toolbox.register(&quot;individual&quot;, tools.initRepeat, creator.Individual, toolbox.attr_float, n=data_size)<br>toolbox.register(&quot;population&quot;, tools.initRepeat, list, toolbox.individual)</pre><h3>Fitness Function and RL-Inspired Feedback</h3><pre>def evaluate(individual, ctr, cvr):<br>    bid = np.array(individual)<br>    updated_ctr = ctr * (1 + 0.2 * (bid - 1))<br>    updated_cvr = cvr * (1 + 0.1 * (bid - 1))<br>    cpa = 1 / (updated_ctr * updated_cvr)<br>    return np.mean(updated_ctr), np.mean(cpa)<br><br>toolbox.register(&quot;mate&quot;, tools.cxBlend, alpha=0.3)<br>toolbox.register(&quot;mutate&quot;, tools.mutGaussian, mu=0, sigma=0.05, indpb=0.2)<br>toolbox.register(&quot;select&quot;, tools.selNSGA2)</pre><h3>Multi-Iteration Feedback Loop with Visualization</h3><pre>import matplotlib.pyplot as plt<br>results_per_gen = []<br>feedback_ctr = ads[&#39;Base_CTR&#39;].values.copy()<br>feedback_cvr = ads[&#39;Base_CVR&#39;].values.copy()<br><br>for generation in range(3):<br>    print(f&quot;Generation {generation+1}&quot;)<br>    toolbox.register(&quot;evaluate&quot;, lambda ind: evaluate(ind, feedback_ctr, feedback_cvr))<br>    pop = toolbox.population(n=50)<br>    hof = tools.HallOfFame(1)<br>    stats = tools.Statistics(lambda ind: ind.fitness.values)<br>    stats.register(&quot;avg&quot;, np.mean, axis=0)<br><br>    pop, _ = algorithms.eaMuPlusLambda(pop, toolbox, mu=50, lambda_=100, cxpb=0.6, mutpb=0.3,<br>                                        ngen=10, stats=stats, halloffame=hof, verbose=False)<br><br>    fitness_vals = np.array([ind.fitness.values for ind in pop])<br>    results_per_gen.append(fitness_vals)<br><br>    feedback_ctr += np.random.normal(0, 0.002, data_size)<br>    feedback_cvr += np.random.normal(0, 0.001, data_size)<br>import matplotlib.pyplot as plt<br>front = np.array([ind.fitness.values for ind in pop])<br>plt.scatter(front[:, 0], front[:, 1], alpha=0.7)<br>plt.xlabel(&quot;Average CTR&quot;)<br>plt.ylabel(&quot;Average CPA&quot;)<br>plt.title(&quot;Pareto Front After Feedback Optimization&quot;)<br>plt.grid(True)<br>plt.show()</pre><h3>Plotting the Pareto Fronts per Generation</h3><pre>fig, axes = plt.subplots(1, 3, figsize=(18, 5))<br>for i, front in enumerate(results_per_gen):<br>    axes[i].scatter(front[:, 0], front[:, 1], alpha=0.7)<br>    axes[i].set_title(f&quot;Generation {i+1}&quot;)<br>    axes[i].set_xlabel(&quot;Average CTR&quot;)<br>    axes[i].set_ylabel(&quot;Average CPA&quot;)<br>    axes[i].grid(True)<br>plt.tight_layout()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrhz5zkhczJUOXPV8KueCg.png" /></figure><h3>Visualizing Trade-offs</h3><p>The Pareto fronts across generations highlight how the optimization evolves:</p><ul><li><strong>Generation 1</strong>: Baseline improvements based on initial conditions</li><li><strong>Generation 2</strong>: Feedback-driven adjustments improve adaptability</li><li><strong>Generation 3</strong>: Strategies become more refined and stable, balancing CTR and CPA under dynamic environments</li></ul><h3>Results Interpretation</h3><ul><li><strong>Iteration 1</strong>: Initial bid strategies modestly enhance CTR and reduce CPA</li><li><strong>Iteration 2</strong>: As feedback simulates shifts in user behavior, the optimizer adapts and expands the Pareto frontier</li><li><strong>Iteration 3</strong>: Final strategies strike a balance between performance and resilience, maintaining a diverse range of optimal solutions</li></ul><p>These iterative improvements demonstrate how the system benefits from feedback-based learning, effectively emulating reinforcement learning behavior without explicit policy modeling.</p><h3>Conclusion</h3><p>This approach is highly effective for ad tech use cases that demand:</p><ul><li>Continuous adaptation</li><li>Simultaneous optimization of multiple goals</li><li>Responsive and intelligent decision-making in real time</li></ul><p>It can be extended further to incorporate budget constraints, policy-driven reinforcement scoring, and performance tracking via A/B testing frameworks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab7ee816dc29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Click-Through Rate (CTR) Using Dynamic Multi-Objective Programming]]></title>
            <link>https://medium.com/@sonalikumari80/optimizing-click-through-rate-ctr-using-dynamic-multi-objective-programming-8e1608b9dbe5?source=rss-6503f6ed70e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e1608b9dbe5</guid>
            <dc:creator><![CDATA[Sonalikumari]]></dc:creator>
            <pubDate>Sun, 25 May 2025 10:59:30 GMT</pubDate>
            <atom:updated>2025-05-25T10:59:30.858Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Optimizing Click-Through Rate (CTR) Using Dynamic Multi-Objective Programming</strong></p><p>In the evolving landscape of digital advertising, maximizing the Click-Through Rate (CTR) while minimizing ad spend is crucial. Traditional approaches often treat this as a static optimization problem, ignoring temporal variations and market dynamics. In this article, we delve into a <strong>dynamic multi-objective optimization</strong> technique using <strong>NSGA-II</strong>, a popular evolutionary algorithm, to model and solve the bid optimization problem in online ads.</p><h3>Objective: Maximize CTR and Minimize Cost</h3><p>Given a set of ads, we aim to optimize their <strong>bid amounts</strong> such that we:</p><ul><li>Maximize the <strong>CTR</strong></li><li>Minimize the <strong>total bidding cost</strong></li></ul><p>This is naturally a multi-objective problem, where we seek a set of <strong>Pareto-optimal solutions</strong> rather than a single solution.</p><h3>Simulated Dataset</h3><p>We simulate a dataset of 1000 ads with:</p><ul><li><strong>Base_CTR</strong>: Initial CTR potential of an ad</li><li><strong>Bid_Amount</strong>: Cost per ad</li><li><strong>Competitor_Intensity</strong>: Affects how difficult it is to get impressions</li></ul><pre>import random<br>import numpy as np<br>import pandas as pd<br>np.random.seed(42)<br>data_size = 1000<br>data = pd.DataFrame({<br>    &#39;Ad_ID&#39;: range(1, data_size + 1),<br>    &#39;Base_CTR&#39;: np.random.uniform(0.01, 0.15, data_size),<br>    &#39;Bid_Amount&#39;: np.random.uniform(0.5, 5.0, data_size),<br>    &#39;Competitor_Intensity&#39;: np.random.uniform(0.5, 2.0, data_size),<br>})</pre><h3>Optimization Strategy</h3><p>We use the <strong>DEAP</strong> library with <strong>NSGA-II</strong> to perform multi-objective optimization. Two fitness objectives:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*Bwb40lEJjuOmbnHUuwN24A.png" /></figure><p>The adjusted CTR is time-sensitive, given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*OR-AWDF4jayNxlaVyvfuCA.png" /></figure><p>This simulates changing market conditions over 50 time steps.</p><pre>def evaluate_ctr(individual, t):<br>    ctr = 0<br>    total_cost = 0<br>    for i, bid in enumerate(individual):<br>        base_ctr = data.iloc[i][&#39;Base_CTR&#39;]<br>        competitor_intensity = data.iloc[i][&#39;Competitor_Intensity&#39;]<br>        <br>        # Dynamic CTR calculation with time-based fluctuation<br>        adjusted_ctr = base_ctr * (1 + 0.3 * np.sin(2 * np.pi * t / 20)) / competitor_intensity<br>        ctr += adjusted_ctr * bid<br>        total_cost += bid<br><br>    avg_ctr = ctr / len(individual)<br>    return avg_ctr, total_cost</pre><h3>Dynamic Evolutionary Optimization</h3><p>We evolve the population over 50 generations. At each time step t, the CTRs are dynamically adjusted based on t.</p><pre>from deap import base, creator, tools, algorithms<br>toolbox.register(&quot;evaluate&quot;, evaluate_ctr)<br>toolbox.register(&quot;mate&quot;, tools.cxBlend, alpha=0.5)<br>toolbox.register(&quot;mutate&quot;, tools.mutGaussian, mu=0, sigma=0.5, indpb=0.2)<br>toolbox.register(&quot;select&quot;, tools.selNSGA2)<br><br>def run_dynamic_optimization():<br>    population = toolbox.population(n=50)<br>    generations = 50<br>    for t in range(generations):<br>        for ind in population:<br>            ind.fitness.values = toolbox.evaluate(ind, t)<br>        <br>        offspring = algorithms.varAnd(population, toolbox, cxpb=0.5, mutpb=0.2)<br>        for ind in offspring:<br>            ind.fitness.values = toolbox.evaluate(ind, t)<br>        <br>        population[:] = toolbox.select(offspring, len(population))<br>    <br>    return population<br>final_population = run_dynamic_optimization()</pre><h3>Visualizing Results: Pareto Front</h3><p>We plot the Pareto front showing the trade-off between <strong>CTR</strong> and <strong>Cost</strong>.</p><pre>import matplotlib.pyplot as plt<br>ctr_values = [ind.fitness.values[0] for ind in final_population]<br>cost_values = [ind.fitness.values[1] for ind in final_population]<br><br>plt.scatter(cost_values, ctr_values, c=&#39;blue&#39;)<br>plt.xlabel(&#39;Total Cost (USD)&#39;)<br>plt.ylabel(&#39;Average CTR&#39;)<br>plt.title(&#39;Pareto Front: CTR vs Cost (Dynamic Optimization)&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*kAARqF3NqwDxUt5ARKgvjQ.png" /></figure><p><strong>Interpretation:</strong></p><ul><li>Each point is a solution with a unique bid strategy.</li><li>Top-left solutions are preferable: High CTR, low cost.</li><li>Advertisers can choose the trade-off that best aligns with their campaign budget and goals.</li></ul><h3>Why Dynamic Optimization?</h3><h4>Static vs Dynamic Optimization</h4><p><strong>Static Multi-Objective Optimization</strong> solves a fixed problem using a constant dataset. It assumes market conditions, user behavior, and external variables are unchanged. Once the model is optimized, it is not revisited unless manually retrained.</p><p><strong>Dynamic Multi-Objective Optimization (DMO)</strong> continuously updates the optimization criteria over time. In our case, bid strategies are evaluated at each time step under varying CTR patterns due to seasonal trends, market shifts, or competition.</p><h4>Why Dynamic is Better:</h4><ul><li><strong>Realism</strong>: Captures fluctuations in online ad performance.</li><li><strong>Adaptability</strong>: Continuously refines decisions based on current environment.</li><li><strong>Robustness</strong>: Solutions are less brittle and more tolerant to uncertainty.</li><li><strong>Strategic Advantage</strong>: More likely to succeed in real-time bidding platforms where conditions change rapidly.</li></ul><p>In summary, while static optimization gives you a snapshot solution, dynamic optimization gives you a movie — the full story across time.</p><h3>Further Reading</h3><ul><li><a href="https://deap.readthedocs.io/en/master/">DEAP Documentation</a></li><li><a href="https://ieeexplore.ieee.org/document/996017">NSGA-II Paper</a></li><li><a href="https://en.wikipedia.org/wiki/Multi-objective_optimization">Multi-Objective Optimization</a></li><li><a href="https://www.wordstream.com/click-through-rate">CTR in Advertising</a></li><li><a href="https://link.springer.com/chapter/10.1007/978-3-642-10701-6_14">Dynamic Multi-Objective Optimization Overview</a></li></ul><h3>Final Thoughts</h3><p>This dynamic multi-objective approach empowers advertisers to adapt to complex, real-world dynamics. While the model here is simplified, it opens the door for future enhancements like:</p><ul><li>Real CTR logs and user behavior</li><li>Budget caps and ROI tracking</li><li>Reinforcement learning with delayed feedback</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e1608b9dbe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>