Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Upd Metric | Performing One More AB Test
A/B Testing in Python

book
Upd Metric

Do you recall we talked about the fact that we have to be careful while choosing metrics for the A/B test? Let's try to add one metric to check if the result differs. For example, we may try to find if the result changes if we use only users that have been to the site earlier.

Aufgabe

Swipe to start coding

  1. Create the data that includes users that have visited the site for the first time using the 'first_visit_after_test_start' column.
  2. Perform the statistical analysis with the Mann-Whitney criterion.

Lösung

# Importing the pandas
import pandas as pd
# Importing the statsmodels.api
import statsmodels.api as sm
# Importing the scipy
import scipy

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/1e089012-bfcf-4d61-9ac9-bb649ece39f2/abtest_with_changes.csv')
# Create the data that includes users that have visited the site for the first time
df = df.query('first_visit_after_test_start == 1')
# Control group
df_control = df.query('group == "control" ')
# Test group
df_test = df.query('group == "test" ')

# Perform statistical analysis with the statistical criterion
print(scipy.stats.mannwhitneyu(df_control.contact_views_number, df_test.contact_views_number, alternative = 'greater'))

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 10
# Importing the pandas
import pandas as pd
# Importing the statsmodels.api
import statsmodels.api as sm
# Importing the scipy
import scipy

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/1e089012-bfcf-4d61-9ac9-bb649ece39f2/abtest_with_changes.csv')
# Create the data that includes users that have visited the site for the first time
df = df.query('___ == 1')
# Control group
df_control = df.query('group == "control" ')
# Test group
df_test = df.query('group == "test" ')

# Perform statistical analysis with the statistical criterion
print(scipy.stats.___(df_control.___, ___.___, alternative = 'greater'))

Fragen Sie AI

expand
ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt