Purpose: Estimate good times of all tasks.

Settings, imports, data


In [23]:
%matplotlib inline
from collections import OrderedDict
import json
from IPython.display import display, Markdown
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import learn
from monitoring.data import get_production_data
from monitoring.visualization import display_level_overview

sns.set()
pd.options.display.float_format = '{:.2f}'.format

In [2]:
# Load data from local cache, fetch and store if not available.
data = get_production_data('2018-03-17')


Fetching https://robomise.cz/media/exports/robomission-latest.zip ...
Stored at: /home/xeffenb1/projects/robomission/.prodcache/
Data loaded from cache (/home/xeffenb1/projects/robomission/.prodcache/robomission-2018-03-17/).

In [6]:
tasks = data['tasks']
ts = data['task_sessions']
ts = ts[ts.time_spent > 0]
len(ts)


Out[6]:
11484

In [22]:
tasks['good_time'] = 1.5 * ts.groupby('task').time_spent.median()
tasks.good_time = tasks.good_time.astype(int)
tasks = tasks.sort_values('good_time')
tasks = tasks[['name', 'good_time']]
tasks = tasks.rename(columns={'name': 'task'})
tasks


Out[22]:
task good_time
id
51 one-step-forward 12
25 three-steps-forward 22
10 shot 25
49 turning-right 30
26 turning-right-and-left 31
67 plus 33
44 turning-left 34
12 wormhole-demo 39
86 diamond-path 41
14 beware-of-asteroid 48
31 diamond-on-right 48
8 shooting 49
53 direct-flight-ahead 57
2 turning-left-and-right 58
70 big-right-turn 72
56 diamond-cross 78
71 big-left-turn 81
11 ladder 88
41 yellow-hint 96
73 stop-on-red 96
66 surrounded-diamond 106
1 diamonds-in-meteoroid-cloud 108
3 zig-zag 108
80 letter-e 112
68 stripes 114
24 narrow-passage 129
76 blocked-wormhole 129
13 n 132
37 big-slalom 133
79 last-shot 136
... ... ...
59 two-diamonds 292
22 triple-steps 295
40 plan-your-shooting 297
45 diagonal-lines 304
9 diamond-lines 307
47 arrow 310
65 letter-h 328
18 clean-your-path 339
48 edge-to-edge 348
7 meteoroids-and-wormholes 354
15 wormhole-cloud 355
83 maneuvers-on-left 357
60 red-shooting 381
78 yellow-squares 384
30 edge-wormholes 403
42 two-color-tracks 406
32 double-track 408
33 diamond-ring 421
36 cross-2 444
54 diagonal-diamonds 459
35 six-diamonds 469
43 colorful-flowers 475
4 triple-slalom 546
74 turning-in-square 574
81 belgian-flag 600
64 wave 616
77 letter-d 646
39 meteoroids-on-left 663
28 slalom-position-testing 1145
62 two-bit-instructions 2219

86 rows × 2 columns


In [25]:
params = {
    'domain': 'current',
    'params': tasks.to_dict(orient='records')
}
print(json.dumps(params, indent=2))


{
  "domain": "current",
  "params": [
    {
      "task": "one-step-forward",
      "good_time": 12
    },
    {
      "task": "three-steps-forward",
      "good_time": 22
    },
    {
      "task": "shot",
      "good_time": 25
    },
    {
      "task": "turning-right",
      "good_time": 30
    },
    {
      "task": "turning-right-and-left",
      "good_time": 31
    },
    {
      "task": "plus",
      "good_time": 33
    },
    {
      "task": "turning-left",
      "good_time": 34
    },
    {
      "task": "wormhole-demo",
      "good_time": 39
    },
    {
      "task": "diamond-path",
      "good_time": 41
    },
    {
      "task": "beware-of-asteroid",
      "good_time": 48
    },
    {
      "task": "diamond-on-right",
      "good_time": 48
    },
    {
      "task": "shooting",
      "good_time": 49
    },
    {
      "task": "direct-flight-ahead",
      "good_time": 57
    },
    {
      "task": "turning-left-and-right",
      "good_time": 58
    },
    {
      "task": "big-right-turn",
      "good_time": 72
    },
    {
      "task": "diamond-cross",
      "good_time": 78
    },
    {
      "task": "big-left-turn",
      "good_time": 81
    },
    {
      "task": "ladder",
      "good_time": 88
    },
    {
      "task": "yellow-hint",
      "good_time": 96
    },
    {
      "task": "stop-on-red",
      "good_time": 96
    },
    {
      "task": "surrounded-diamond",
      "good_time": 106
    },
    {
      "task": "diamonds-in-meteoroid-cloud",
      "good_time": 108
    },
    {
      "task": "zig-zag",
      "good_time": 108
    },
    {
      "task": "letter-e",
      "good_time": 112
    },
    {
      "task": "stripes",
      "good_time": 114
    },
    {
      "task": "narrow-passage",
      "good_time": 129
    },
    {
      "task": "blocked-wormhole",
      "good_time": 129
    },
    {
      "task": "n",
      "good_time": 132
    },
    {
      "task": "big-slalom",
      "good_time": 133
    },
    {
      "task": "last-shot",
      "good_time": 136
    },
    {
      "task": "double-bend",
      "good_time": 148
    },
    {
      "task": "triangle",
      "good_time": 150
    },
    {
      "task": "yellow-is-not-red",
      "good_time": 150
    },
    {
      "task": "direction-change",
      "good_time": 153
    },
    {
      "task": "steal-the-nose",
      "good_time": 157
    },
    {
      "task": "dont-forget-shot",
      "good_time": 162
    },
    {
      "task": "on-yellow-to-left",
      "good_time": 165
    },
    {
      "task": "collect-diamonds",
      "good_time": 165
    },
    {
      "task": "color-slalom",
      "good_time": 180
    },
    {
      "task": "color-navigation",
      "good_time": 183
    },
    {
      "task": "find-the-path",
      "good_time": 184
    },
    {
      "task": "diamond-in-house",
      "good_time": 185
    },
    {
      "task": "diamonds-with-signals",
      "good_time": 186
    },
    {
      "task": "follow-colors",
      "good_time": 191
    },
    {
      "task": "stairs",
      "good_time": 193
    },
    {
      "task": "zig-zag-plus",
      "good_time": 195
    },
    {
      "task": "five-diamonds",
      "good_time": 214
    },
    {
      "task": "tunnel",
      "good_time": 216
    },
    {
      "task": "four-vs",
      "good_time": 219
    },
    {
      "task": "bouncing-from-edge",
      "good_time": 229
    },
    {
      "task": "rectangle",
      "good_time": 233
    },
    {
      "task": "diamonds-on-yellow",
      "good_time": 240
    },
    {
      "task": "chessboard",
      "good_time": 258
    },
    {
      "task": "free-column",
      "good_time": 266
    },
    {
      "task": "2diamonds-2meteorids",
      "good_time": 270
    },
    {
      "task": "mirror",
      "good_time": 275
    },
    {
      "task": "two-diamonds",
      "good_time": 292
    },
    {
      "task": "triple-steps",
      "good_time": 295
    },
    {
      "task": "plan-your-shooting",
      "good_time": 297
    },
    {
      "task": "diagonal-lines",
      "good_time": 304
    },
    {
      "task": "diamond-lines",
      "good_time": 307
    },
    {
      "task": "arrow",
      "good_time": 310
    },
    {
      "task": "letter-h",
      "good_time": 328
    },
    {
      "task": "clean-your-path",
      "good_time": 339
    },
    {
      "task": "edge-to-edge",
      "good_time": 348
    },
    {
      "task": "meteoroids-and-wormholes",
      "good_time": 354
    },
    {
      "task": "wormhole-cloud",
      "good_time": 355
    },
    {
      "task": "maneuvers-on-left",
      "good_time": 357
    },
    {
      "task": "red-shooting",
      "good_time": 381
    },
    {
      "task": "yellow-squares",
      "good_time": 384
    },
    {
      "task": "edge-wormholes",
      "good_time": 403
    },
    {
      "task": "two-color-tracks",
      "good_time": 406
    },
    {
      "task": "double-track",
      "good_time": 408
    },
    {
      "task": "diamond-ring",
      "good_time": 421
    },
    {
      "task": "cross-2",
      "good_time": 444
    },
    {
      "task": "diagonal-diamonds",
      "good_time": 459
    },
    {
      "task": "six-diamonds",
      "good_time": 469
    },
    {
      "task": "colorful-flowers",
      "good_time": 475
    },
    {
      "task": "triple-slalom",
      "good_time": 546
    },
    {
      "task": "turning-in-square",
      "good_time": 574
    },
    {
      "task": "belgian-flag",
      "good_time": 600
    },
    {
      "task": "wave",
      "good_time": 616
    },
    {
      "task": "letter-d",
      "good_time": 646
    },
    {
      "task": "meteoroids-on-left",
      "good_time": 663
    },
    {
      "task": "slalom-position-testing",
      "good_time": 1145
    },
    {
      "task": "two-bit-instructions",
      "good_time": 2219
    }
  ]
}

In [ ]:


In [ ]: