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
- Create the data that includes users that have visited the site for the first time using the
'first_visit_after_test_start'
column. - Perform the statistical analysis with the
Mann-Whitney
criterion.
Lösung
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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?
Danke für Ihr Feedback!
Abschnitt 3. Kapitel 10
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen