text_plain_output_1.png
import pandas as pd

import plotly.graph_objects as go

train = pd.read_csv('../input/standup-targets/train.csv')

y0 = train.score.values
fig = go.Figure()
fig.add_trace(go.Box(y=y0, name='Train', marker_color='#1e90ff'))
fig.update_layout(title_text='Score stats (individual shot)')
fig.update_yaxes()
fig.update_xaxes(showticklabels=False)

colors = ['#1e90ff'] * 7
colors[0] = '#ff6347'
dict_ = dict(train.score.value_counts())
x = list(dict_.keys())
y = list(dict_.values())
fig = go.Figure(data=[go.Bar(x=x, y=y, marker_color=colors)])
fig.update_layout(title_text='Score distribution (individual shot)')

y0 = list(train.groupby(['image_name'])[['score']].mean().values.ravel())
fig = go.Figure()
fig.add_trace(go.Box(y=y0, name='Train', marker_color='#1e90ff'))
fig.update_layout(title_text='Score stats (per series)')
fig.update_yaxes()
fig.update_xaxes(showticklabels=False)

df_to_merge_on = pd.DataFrame(train.image_name.value_counts())
train = train.merge(df_to_merge_on, right_on=train.image_name.value_counts().index, left_on='image_name').drop(['image_name_x'], axis=1)
train = train.rename(columns={'image_name_y': 'nb_bullets'})

y0 = list(train.loc[train['nb_bullets'] == 1, :].groupby(['image_name'])[['score']].mean().values.ravel())
y1 = list(train.loc[train['nb_bullets'] == 2, :].groupby(['image_name'])[['score']].mean().values.ravel())
y2 = list(train.loc[train['nb_bullets'] == 3, :].groupby(['image_name'])[['score']].mean().values.ravel())
y3 = list(train.loc[train['nb_bullets'] == 4, :].groupby(['image_name'])[['score']].mean().values.ravel())
y4 = list(train.loc[train['nb_bullets'] == 5, :].groupby(['image_name'])[['score']].mean().values.ravel())
y5 = list(train.loc[train['nb_bullets'] == 6, :].groupby(['image_name'])[['score']].mean().values.ravel())
fig = go.Figure()
fig.add_trace(go.Box(y=y0, name='1 bullet series'))
fig.add_trace(go.Box(y=y1, name='2 bullet series', marker_color='blue'))
fig.add_trace(go.Box(y=y2, name='3 bullet series', marker_color='blue'))
fig.add_trace(go.Box(y=y3, name='4 bullet series', marker_color='blue'))
fig.add_trace(go.Box(y=y4, name='5 bullet series', marker_color='blue'))
fig.add_trace(go.Box(y=y5, name='6 bullet series', marker_color='blue'))
fig.update_layout(legend_title_text='Discourse effectiveness', title_text='Mean size of sentences in discourse (logscale)')
fig.update_xaxes(showticklabels=False)
fig.show()