Skip to content
Competition - website redesign
Which version of the website should you use?
📖 Background
You work for an early-stage startup in Germany. Your team has been working on a redesign of the landing page. The team believes a new design will increase the number of people who click through and join your site.
They have been testing the changes for a few weeks and now they want to measure the impact of the change and need you to determine if the increase can be due to random chance or if it is statistically significant.
💾 The data
The team assembled the following file:
Redesign test data
- "treatment" - "yes" if the user saw the new version of the landing page, no otherwise.
- "new_images" - "yes" if the page used a new set of images, no otherwise.
- "converted" - 1 if the user joined the site, 0 otherwise.
The control group is those users with "no" in both columns: the old version with the old set of images.
import pandas as pd
import numpy as np
df = pd.read_csv('./data/redesign.csv')
df
💪 Challenge
Complete the following tasks:
- Analyze the conversion rates for each of the four groups: the new/old design of the landing page and the new/old pictures.
- Can the increases observed be explained by randomness? (Hint: Think A/B test)
- Which version of the website should they use?
⌛️ Time is ticking. Good luck!
DATA PREPROCESSING
X = df.iloc[:, :-1].values
X
y = df.iloc[:,-1].values
y
df.isnull().value_counts()
df.shape
ENCODING CATEGORICAL DATA
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ct = ColumnTransformer(transformers =[
('enc', OneHotEncoder(sparse = False, drop ='first'), list(range(2))),
], remainder ='passthrough')
X = np.array(ct.fit_transform(X))
X #HERE CATEGORICAL DATA HAS BEEN CHANGED
SPLITING THE DATASET INTO TRAINING SET AND TEST SET
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)