{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":102335,"databundleVersionId":12518947,"sourceType":"competition"}],"dockerImageVersionId":31040,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# 📋 Table of contents\n* [Demographic Data](#demo)\n* [Sensor Data](#sensor)\n* [Target](#target)\n* [Pick one sequence](#seq)","metadata":{}},{"cell_type":"code","source":"# packages\n\n# standard\nimport numpy as np\nimport pandas as pd\nimport time\nimport os\n\n# plots\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n# statistics\nfrom scipy import stats","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.113959Z","iopub.execute_input":"2025-05-30T07:37:16.114669Z","iopub.status.idle":"2025-05-30T07:37:16.120236Z","shell.execute_reply.started":"2025-05-30T07:37:16.114631Z","shell.execute_reply":"2025-05-30T07:37:16.119327Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# show files\n!ls -l '/kaggle/input/cmi-detect-behavior-with-sensor-data'","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.121969Z","iopub.execute_input":"2025-05-30T07:37:16.122289Z","iopub.status.idle":"2025-05-30T07:37:16.267857Z","shell.execute_reply.started":"2025-05-30T07:37:16.122264Z","shell.execute_reply":"2025-05-30T07:37:16.266848Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# configs\npd.set_option('display.max_columns', None) # we want to display all columns in this notebook\npd.set_option('display.max_rows', 100) # increase rows to be displayed\npd.set_option('display.max_colwidth', None) # show full cell contents\n\n# random seed\nmy_random_seed = 111\n\n# aesthetics\ndefault_color_1 = 'darkblue'\ndefault_color_2 = 'darkgreen'\ndefault_color_3 = 'darkred'\n\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.269040Z","iopub.execute_input":"2025-05-30T07:37:16.269362Z","iopub.status.idle":"2025-05-30T07:37:16.275658Z","shell.execute_reply.started":"2025-05-30T07:37:16.269319Z","shell.execute_reply":"2025-05-30T07:37:16.274786Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"<a id='demo'></a>\n# Demographic Data","metadata":{}},{"cell_type":"code","source":"# load data\nt1 = time.time()\ndf_train_demo = pd.read_csv('/kaggle/input/cmi-detect-behavior-with-sensor-data/train_demographics.csv', low_memory=False)\ndf_test_demo = pd.read_csv('/kaggle/input/cmi-detect-behavior-with-sensor-data/test_demographics.csv', low_memory=False)\nt2 = time.time()\nprint('Elapsed time [s]:', np.round(t2-t1,4))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.277961Z","iopub.execute_input":"2025-05-30T07:37:16.278263Z","iopub.status.idle":"2025-05-30T07:37:16.313364Z","shell.execute_reply.started":"2025-05-30T07:37:16.278237Z","shell.execute_reply":"2025-05-30T07:37:16.312620Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# preview\ndf_train_demo.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.314249Z","iopub.execute_input":"2025-05-30T07:37:16.314514Z","iopub.status.idle":"2025-05-30T07:37:16.343248Z","shell.execute_reply.started":"2025-05-30T07:37:16.314494Z","shell.execute_reply":"2025-05-30T07:37:16.342500Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# overview\ndf_train_demo.info(show_counts=True, verbose=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.344121Z","iopub.execute_input":"2025-05-30T07:37:16.344447Z","iopub.status.idle":"2025-05-30T07:37:16.370539Z","shell.execute_reply.started":"2025-05-30T07:37:16.344401Z","shell.execute_reply":"2025-05-30T07:37:16.369676Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# basic stats - train\ndf_train_demo.describe(include='all')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.371314Z","iopub.execute_input":"2025-05-30T07:37:16.371579Z","iopub.status.idle":"2025-05-30T07:37:16.419006Z","shell.execute_reply.started":"2025-05-30T07:37:16.371561Z","shell.execute_reply":"2025-05-30T07:37:16.418201Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# define features\n\n# numerical features\nfeatures_num_demo = ['age', 'height_cm', 'shoulder_to_wrist_cm', 'elbow_to_wrist_cm']\n\n# categorical features\nfeatures_cat_demo = ['adult_child', 'sex', 'handedness']","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.419915Z","iopub.execute_input":"2025-05-30T07:37:16.420176Z","iopub.status.idle":"2025-05-30T07:37:16.424157Z","shell.execute_reply.started":"2025-05-30T07:37:16.420156Z","shell.execute_reply":"2025-05-30T07:37:16.423397Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# plot histograms (train and test)\nn_bins = 10\nfor f in features_num_demo:\n    plt.figure(figsize=(12,3))\n    ax1 = plt.subplot(1,2,1)\n    df_train_demo[f].plot(kind='hist', bins=n_bins, color=default_color_1)\n    plt.title(f + ' - Train')\n    plt.grid()\n    ax2 = plt.subplot(1,2,2)\n    df_test_demo[f].plot(kind='hist', bins=n_bins, color=default_color_2)\n    plt.title(f + ' - Test')\n    plt.grid()\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:16.425081Z","iopub.execute_input":"2025-05-30T07:37:16.425457Z","iopub.status.idle":"2025-05-30T07:37:18.089927Z","shell.execute_reply.started":"2025-05-30T07:37:16.425412Z","shell.execute_reply":"2025-05-30T07:37:18.088797Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# boxplots (train and test)\nfor f in features_num_demo:\n    plt.figure(figsize=(14,1))\n    ax1 = plt.subplot(1,2,1)\n    df_temp = df_train_demo[f].dropna() # boxplot does not like missings...\n    plt.boxplot(df_temp, vert=False)\n    plt.title(f + ' - Train')\n    plt.grid()\n    ax2 = plt.subplot(1,2,2, sharex=ax1)\n    df_temp = df_test_demo[f].dropna()\n    plt.boxplot(df_temp, vert=False)\n    plt.title(f + ' - Test')\n    plt.grid()\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:18.093660Z","iopub.execute_input":"2025-05-30T07:37:18.093957Z","iopub.status.idle":"2025-05-30T07:37:18.886896Z","shell.execute_reply.started":"2025-05-30T07:37:18.093937Z","shell.execute_reply":"2025-05-30T07:37:18.886032Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# plot categorical feature distributions (train and test)\nfor f in features_cat_demo:\n    plt.figure(figsize=(14,3))\n    ax1 = plt.subplot(1,2,1)\n    df_train_demo[f].value_counts().sort_index().plot(kind='bar', color=default_color_1)\n    plt.title(f + ' - Train')\n    plt.grid()\n    ax2 = plt.subplot(1,2,2)\n    df_test_demo[f].value_counts().sort_index().plot(kind='bar', color=default_color_2)\n    plt.title(f + ' - Test')\n    plt.grid()\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:18.887767Z","iopub.execute_input":"2025-05-30T07:37:18.888023Z","iopub.status.idle":"2025-05-30T07:37:19.678462Z","shell.execute_reply.started":"2025-05-30T07:37:18.887994Z","shell.execute_reply":"2025-05-30T07:37:19.677431Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Correlation","metadata":{}},{"cell_type":"code","source":"# scatterplot of numerical features - training data\nsns.pairplot(data=df_train_demo[features_num_demo],\n             plot_kws = { 'alpha' : 0.5,\n                          's' : 10,\n                          'color' : default_color_1})\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:19.679365Z","iopub.execute_input":"2025-05-30T07:37:19.679654Z","iopub.status.idle":"2025-05-30T07:37:23.222408Z","shell.execute_reply.started":"2025-05-30T07:37:19.679632Z","shell.execute_reply":"2025-05-30T07:37:23.221380Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Pearson correlation\ncorr_pearson = df_train_demo[features_num_demo].corr(method='pearson')\n\n# visualize\nplt.figure(figsize=(4,3))\nsns.heatmap(corr_pearson, annot=True, cmap='RdYlGn', vmin=-1, vmax=+1,\n            fmt='.3f', linewidth=0.5, linecolor='black')\nplt.title('Pearson Correlation')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:23.223560Z","iopub.execute_input":"2025-05-30T07:37:23.223902Z","iopub.status.idle":"2025-05-30T07:37:23.482280Z","shell.execute_reply.started":"2025-05-30T07:37:23.223873Z","shell.execute_reply":"2025-05-30T07:37:23.481163Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"<a id='sensor'></a>\n# Sensor Data","metadata":{}},{"cell_type":"code","source":"# load data\nt1 = time.time()\ndf_train = pd.read_csv('/kaggle/input/cmi-detect-behavior-with-sensor-data/train.csv', low_memory=False)\ndf_test = pd.read_csv('/kaggle/input/cmi-detect-behavior-with-sensor-data/test.csv', low_memory=False)\nt2 = time.time()\nprint('Elapsed time [s]:', np.round(t2-t1,4))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:37:23.483304Z","iopub.execute_input":"2025-05-30T07:37:23.484464Z","iopub.status.idle":"2025-05-30T07:38:31.779717Z","shell.execute_reply.started":"2025-05-30T07:37:23.484396Z","shell.execute_reply":"2025-05-30T07:38:31.778635Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# dimension of training data\ndf_train.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:31.780815Z","iopub.execute_input":"2025-05-30T07:38:31.781141Z","iopub.status.idle":"2025-05-30T07:38:31.787752Z","shell.execute_reply.started":"2025-05-30T07:38:31.781110Z","shell.execute_reply":"2025-05-30T07:38:31.786921Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# dimension of test data\ndf_test.shape","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:31.789231Z","iopub.execute_input":"2025-05-30T07:38:31.789592Z","iopub.status.idle":"2025-05-30T07:38:31.810734Z","shell.execute_reply.started":"2025-05-30T07:38:31.789563Z","shell.execute_reply":"2025-05-30T07:38:31.809925Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# preview\ndf_train.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:31.811638Z","iopub.execute_input":"2025-05-30T07:38:31.811929Z","iopub.status.idle":"2025-05-30T07:38:32.061395Z","shell.execute_reply.started":"2025-05-30T07:38:31.811908Z","shell.execute_reply":"2025-05-30T07:38:32.060575Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# basic stats\ndf_train.describe(include='all')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:32.062331Z","iopub.execute_input":"2025-05-30T07:38:32.062887Z","iopub.status.idle":"2025-05-30T07:38:41.313706Z","shell.execute_reply.started":"2025-05-30T07:38:32.062864Z","shell.execute_reply":"2025-05-30T07:38:41.312701Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"#### We have 8151 different sequences for the 81 subjects.","metadata":{}},{"cell_type":"code","source":"# sequence types\ndf_train.sequence_type.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.314691Z","iopub.execute_input":"2025-05-30T07:38:41.314962Z","iopub.status.idle":"2025-05-30T07:38:41.352828Z","shell.execute_reply.started":"2025-05-30T07:38:41.314940Z","shell.execute_reply":"2025-05-30T07:38:41.351741Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# plot distribution\ndf_train.sequence_type.value_counts().plot(kind='bar', color=default_color_3)\nplt.title('Sequence Type')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.353761Z","iopub.execute_input":"2025-05-30T07:38:41.354041Z","iopub.status.idle":"2025-05-30T07:38:41.554757Z","shell.execute_reply.started":"2025-05-30T07:38:41.354014Z","shell.execute_reply":"2025-05-30T07:38:41.553844Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# define features groups\nacc = ['acc_x', 'acc_y', 'acc_z'] # acceleration\nrot = ['rot_w', 'rot_x', 'rot_y', 'rot_z'] # orientation in space\nthm = ['thm_1', 'thm_2', 'thm_3', 'thm_4', 'thm_5'] # thermopile sensors","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.555571Z","iopub.execute_input":"2025-05-30T07:38:41.555822Z","iopub.status.idle":"2025-05-30T07:38:41.560206Z","shell.execute_reply.started":"2025-05-30T07:38:41.555803Z","shell.execute_reply":"2025-05-30T07:38:41.559481Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"<a id='target'></a>\n# Target","metadata":{}},{"cell_type":"code","source":"# target\ntarget = 'gesture'\n\n# frequencies without considering sequences\ndf_train[target].value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.561107Z","iopub.execute_input":"2025-05-30T07:38:41.561455Z","iopub.status.idle":"2025-05-30T07:38:41.612895Z","shell.execute_reply.started":"2025-05-30T07:38:41.561410Z","shell.execute_reply":"2025-05-30T07:38:41.612128Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# plot target distribution without considering sequences\ndf_train[target].value_counts().plot(kind='bar', color=default_color_3)\nplt.title('Target')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.613850Z","iopub.execute_input":"2025-05-30T07:38:41.614096Z","iopub.status.idle":"2025-05-30T07:38:41.928687Z","shell.execute_reply.started":"2025-05-30T07:38:41.614079Z","shell.execute_reply":"2025-05-30T07:38:41.927695Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Grouped version","metadata":{}},{"cell_type":"code","source":"# use group by to get aggregated view\ndf_train_group = df_train.groupby('sequence_id', as_index=False).agg(\n    gesture = pd.NamedAgg(column='gesture', aggfunc='first'),\n    sequence_type = pd.NamedAgg(column='sequence_type', aggfunc='first'),\n    n_values = pd.NamedAgg(column='gesture', aggfunc='count'))\n# display result\ndf_train_group","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:41.929877Z","iopub.execute_input":"2025-05-30T07:38:41.930236Z","iopub.status.idle":"2025-05-30T07:38:42.098180Z","shell.execute_reply.started":"2025-05-30T07:38:41.930213Z","shell.execute_reply":"2025-05-30T07:38:42.097488Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# target frequencies after grouping\ndf_train_group.gesture.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:42.099082Z","iopub.execute_input":"2025-05-30T07:38:42.099332Z","iopub.status.idle":"2025-05-30T07:38:42.107471Z","shell.execute_reply.started":"2025-05-30T07:38:42.099311Z","shell.execute_reply":"2025-05-30T07:38:42.106464Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# plot frequencies after grouping\ndf_train_group.gesture.value_counts().plot(kind='bar', color=default_color_3)\nplt.title('Target after grouping by sequence id')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:42.108530Z","iopub.execute_input":"2025-05-30T07:38:42.108955Z","iopub.status.idle":"2025-05-30T07:38:42.390027Z","shell.execute_reply.started":"2025-05-30T07:38:42.108931Z","shell.execute_reply":"2025-05-30T07:38:42.389142Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# sequence type - grouped version\ndf_train_group.sequence_type.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:38:42.390948Z","iopub.execute_input":"2025-05-30T07:38:42.391325Z","iopub.status.idle":"2025-05-30T07:38:42.398950Z","shell.execute_reply.started":"2025-05-30T07:38:42.391304Z","shell.execute_reply":"2025-05-30T07:38:42.398082Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# sequence length distribution\nplt.figure(figsize=(8,1))\ndf_train_group.n_values.plot(kind='box', vert=False)\nplt.title('Length of sequence')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:40:18.247599Z","iopub.execute_input":"2025-05-30T07:40:18.247942Z","iopub.status.idle":"2025-05-30T07:40:18.375164Z","shell.execute_reply.started":"2025-05-30T07:40:18.247918Z","shell.execute_reply":"2025-05-30T07:40:18.374345Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"<a id='seq'></a>\n# Pick one sequence","metadata":{}},{"cell_type":"code","source":"# get one specific sequence for further analysis\nmy_seq = 'SEQ_015261'\ndf_seq = df_train[df_train.sequence_id==my_seq]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:40.277553Z","iopub.execute_input":"2025-05-30T07:42:40.277924Z","iopub.status.idle":"2025-05-30T07:42:40.338351Z","shell.execute_reply.started":"2025-05-30T07:42:40.277897Z","shell.execute_reply":"2025-05-30T07:42:40.336906Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# stats for this sequence\ndf_seq.describe(include='all')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:41.529230Z","iopub.execute_input":"2025-05-30T07:42:41.529578Z","iopub.status.idle":"2025-05-30T07:42:42.188380Z","shell.execute_reply.started":"2025-05-30T07:42:41.529557Z","shell.execute_reply":"2025-05-30T07:42:42.187263Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# gesture\ndf_seq.gesture.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:45.567704Z","iopub.execute_input":"2025-05-30T07:42:45.568014Z","iopub.status.idle":"2025-05-30T07:42:45.576075Z","shell.execute_reply.started":"2025-05-30T07:42:45.567992Z","shell.execute_reply":"2025-05-30T07:42:45.575068Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# phases\ndf_seq.phase.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:47.079743Z","iopub.execute_input":"2025-05-30T07:42:47.080075Z","iopub.status.idle":"2025-05-30T07:42:47.087545Z","shell.execute_reply.started":"2025-05-30T07:42:47.080051Z","shell.execute_reply":"2025-05-30T07:42:47.086765Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# behaviors\ndf_seq.behavior.value_counts()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:48.688134Z","iopub.execute_input":"2025-05-30T07:42:48.688489Z","iopub.status.idle":"2025-05-30T07:42:48.696199Z","shell.execute_reply.started":"2025-05-30T07:42:48.688462Z","shell.execute_reply":"2025-05-30T07:42:48.695319Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Visualize behavior with scatter plots","metadata":{}},{"cell_type":"code","source":"# visualize acceleration - with behavior\nsns.pairplot(df_seq[acc+['behavior']], \n             hue='behavior')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:50:09.161620Z","iopub.execute_input":"2025-05-30T07:50:09.161917Z","iopub.status.idle":"2025-05-30T07:50:12.174689Z","shell.execute_reply.started":"2025-05-30T07:50:09.161897Z","shell.execute_reply":"2025-05-30T07:50:12.173698Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize orientation in space - with behavior\nsns.pairplot(df_seq[rot+['behavior']], \n             hue='behavior')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:42:55.627005Z","iopub.execute_input":"2025-05-30T07:42:55.627380Z","iopub.status.idle":"2025-05-30T07:43:01.326798Z","shell.execute_reply.started":"2025-05-30T07:42:55.627352Z","shell.execute_reply":"2025-05-30T07:43:01.325716Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize thermopile sensor values - with behavior\nsns.pairplot(df_seq[thm+['behavior']], \n             hue='behavior')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:43:03.667258Z","iopub.execute_input":"2025-05-30T07:43:03.667606Z","iopub.status.idle":"2025-05-30T07:43:12.708261Z","shell.execute_reply.started":"2025-05-30T07:43:03.667580Z","shell.execute_reply":"2025-05-30T07:43:12.707338Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Visualize development over time","metadata":{}},{"cell_type":"code","source":"# visualize acceleration - development over time\nsns.pairplot(df_seq[acc+['sequence_counter']], \n             hue='sequence_counter')\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:43:14.537143Z","iopub.execute_input":"2025-05-30T07:43:14.537495Z","iopub.status.idle":"2025-05-30T07:43:18.834268Z","shell.execute_reply.started":"2025-05-30T07:43:14.537471Z","shell.execute_reply":"2025-05-30T07:43:18.833379Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize acceleration as time series\nplt.figure(figsize=(12,4))\nplt.plot(df_seq.sequence_counter, df_seq.acc_x, color='blue')\nplt.plot(df_seq.sequence_counter, df_seq.acc_y, color='red')\nplt.plot(df_seq.sequence_counter, df_seq.acc_z, color='green')\nplt.title('Acceleration')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:47:37.445072Z","iopub.execute_input":"2025-05-30T07:47:37.445390Z","iopub.status.idle":"2025-05-30T07:47:37.657390Z","shell.execute_reply.started":"2025-05-30T07:47:37.445366Z","shell.execute_reply":"2025-05-30T07:47:37.656496Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize orientation as time series\nplt.figure(figsize=(12,4))\nplt.plot(df_seq.sequence_counter, df_seq.rot_w, color='grey')\nplt.plot(df_seq.sequence_counter, df_seq.rot_x, color='blue')\nplt.plot(df_seq.sequence_counter, df_seq.rot_y, color='red')\nplt.plot(df_seq.sequence_counter, df_seq.rot_z, color='green')\nplt.title('Orientation')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:48:38.960762Z","iopub.execute_input":"2025-05-30T07:48:38.961743Z","iopub.status.idle":"2025-05-30T07:48:39.186183Z","shell.execute_reply.started":"2025-05-30T07:48:38.961708Z","shell.execute_reply":"2025-05-30T07:48:39.185246Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# visualize thermopile sensor values as time series\nplt.figure(figsize=(12,4))\nplt.plot(df_seq.sequence_counter, df_seq.thm_1, color='blue')\nplt.plot(df_seq.sequence_counter, df_seq.thm_2, color='red')\nplt.plot(df_seq.sequence_counter, df_seq.thm_3, color='green')\nplt.plot(df_seq.sequence_counter, df_seq.thm_3, color='magenta')\nplt.plot(df_seq.sequence_counter, df_seq.thm_3, color='cyan')\nplt.title('Thermopile Sensors')\nplt.grid()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-05-30T07:51:18.513485Z","iopub.execute_input":"2025-05-30T07:51:18.514516Z","iopub.status.idle":"2025-05-30T07:51:18.721918Z","shell.execute_reply.started":"2025-05-30T07:51:18.514476Z","shell.execute_reply":"2025-05-30T07:51:18.721004Z"}},"outputs":[],"execution_count":null}]}