Page Optimization Using Thompson Sampling
The client, an online pharmacy, had five distinct landing page designs but no data on which variation would convert the best. The objective was to maximize total purchases over a limited window of 1,000 visitors. Instead of using a traditional, static A/B test—which wastes traffic on losing variations the client needed a dynamic system capable of learning the best design in real-time while maximizing immediate revenue.

Client
Challenge
The core challenge was navigating the Exploration-Exploitation tradeoff under strict uncertainty: Exploration: Testing different designs to gather data on their conversion rates. Exploitation: Sending the majority of traffic to the winning design to maximize sales. The Flaw of A/B Testing: A standard A/B test would split the 1,000 visitors equally (200 per design). This means 800 visitors would be sent to sub-optimal designs, resulting in high "regret" (missed conversions and lost revenue).
Goal
I engineered a Predictive Pricing Engine using Python and Scikit-Learn. I implemented a Linear Regression model that establishes a mathematical relationship between property size (independent variable) and price (dependent variable). Tools & Technologies Python: Core programming language. Scikit-Learn: Machine learning algorithms and model evaluation. Pandas: Data manipulation and analysis. NumPy: Numerical computing and array processing. Matplotlib: Data visualization and plotting.
Result
The implementation delivered immediate, quantifiable insights into the client's pricing strategy: High Accuracy: The model achieved an $R^2$ score of 0.9441, indicating that over 94% of the variance in house prices is explained by the model. Clear Pricing Formula: derived a precise coefficient ($99.17 per sq. ft.), giving the client a solid baseline for negotiations. Visual Validation: Regression Plot: The regression line perfectly tracks the trend of both training and testing data, validating the linear assumption. Residual Analysis: The residual distribution is largely centered around zero, confirming the model is unbiased and robust for the given range.
Available