In [5]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
from misc_utils import load_raw_responses_with_traces,load_random_trace_sample
from session_and_tree_utils import *
from response_distributions_util import plot_metric, get_single_motivation, plot_metric_breakdowns
import pandas as pd
import json
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import scipy
In [2]:
df = load_raw_responses_with_traces()
df = get_sessions_and_trees(df)
df['single motivation'] = df['motivation'].apply(get_single_motivation)
In [ ]:
df = df.apply(get_click_session, axis=1)
df['click_forest'] = df['click_session'].apply(getMinimumSpanningForest)
df = df.apply(get_click_tree, axis=1)
In [3]:
metric = 'num_pageviews'
df[metric] = df['click_session'].apply(num_pageviews)
plot_metric_breakdowns(df, metric)
In [4]:
metric = 'session_length'
df[metric] = df['click_session'].apply(get_session_length)
plot_metric_breakdowns(df, metric)
In [5]:
metric = 'external_searches'
df[metric] = df['click_session'].apply(external_searches)
plot_metric_breakdowns(df, metric)
In [6]:
from ml_utils import get_tree_metrics
In [7]:
tree_metrics = ['size', 'num_leafs', 'mean_time_diff' , 'degree_max' , 'depth_max']
for m in tree_metrics:
df[m] = df['click_tree'].apply(lambda x: get_tree_metrics(x)[m])
plot_metric_breakdowns(df, m)
In [ ]: