/beta46_e10s_cohort.ipynb Secret
Last active
April 1, 2016 19:50
Star
You must be signed in to star a gist
beta46_e10s_cohort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# ### Distribution of e10sCohort in Beta46 | |
# In[1]: | |
import ujson as json | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
import plotly.plotly as py | |
from plotly.graph_objs import * | |
from moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client, get_clients_history, get_records | |
get_ipython().magic(u'pylab inline') | |
# In[2]: | |
sc.defaultParallelism | |
# In[3]: | |
pings = get_pings(sc, app="Firefox", channel="beta", version="46.0", fraction=0.01) | |
# In[4]: | |
subset = get_pings_properties(pings, ["clientId", | |
"environment/settings/e10sEnabled", | |
"environment/settings/e10sCohort"]) | |
# In[6]: | |
subset = get_one_ping_per_client(subset) | |
# In[7]: | |
cached = subset.cache() | |
# How many clients are we looking at? | |
# In[8]: | |
cached.count() | |
# In[14]: | |
cohorts_rdd = cached.filter(lambda p: p["environment/settings/e10sCohort"] is not None) | |
cohorts_count = cohorts_rdd.count() | |
cohorts = cohorts_rdd.map(lambda p: ((p["environment/settings/e10sCohort"], p["environment/settings/e10sEnabled"]), 1)).countByKey() | |
cohorts | |
# In[15]: | |
{k:"{:.2%}".format(float(v) / float(cohorts_count)) for (k,v) in cohorts.iteritems()} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment