<jupyter_start><jupyter_text>Social touch protocol  1.  Motivation  The purpose of this preliminary study is to extract relevant informations about social touch gestures in each video of SATE (social affective touch expression) database. for instance: +  Touch zones involved ( arm, chest, back,...). +  Type of touch (stroke, tap, grab, hold,...). +  Initiative (  subject whom starts the interaction). +  Valence/Arousal. The first step, is to skim all social touch interactions videos and annotate them based on the variables described below (touch zones,...) and the touch vocabulary defined in section 2. Then, analyze the annotations data to decide which device to use and where the sensors will be placed in human body (zones)   *Protocol of the intended experiment*    2. Body parts and annotation | Number        | Name          || ------------- |-------------| | 0             | hand         | | 1             | forearm        | | 2             | arm           | | 3             | shoulder      | | 4             | chest         | | 5             | abs           | | 6             | lower leg     | | 7             | upper back    | | 8             | lower back    |     3. Exploratory analysis on ST data<jupyter_code>import pandas as pd
from IPython.display import HTML
import numpy as np
import matplotlib.pyplot as plt
def plot_pie(data):
    sizes=np.mean(data,axis=0)
    label=['hand','forearm','arm','shoulder','chest','abs','l_leg','up_back','l_back']
    fig1, ax1 = plt.subplots()
    ax1.pie(sizes, labels=label, autopct='%1.1f%%',
        shadow=True, startangle=90)
    ax1.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
    plt.show()

df=pd.read_csv('data/Annot.csv')

HTML("""
<div align="middle">
<video width="80%" controls>
      <source src="data/5.mp4">
</video></div>""")
df.head()<jupyter_output><empty_output><jupyter_text>Variables definition   In this clip (VIDEO_NUM=5) the F participant is stroking the M participant shoulder and arm. The activated zones are:+  F0=1 (female hand)+  M2=1 (male arm), M3=1(male shoulder)  Exploratory Analysis<jupyter_code>data=df.values
print(data.shape," #videos and #attributes")
print("########### touch action ######################")
print(np.unique(data[:,23]))
print("########### Variations of touch actions ######################")
print(np.unique(data[:,24]))

plt.hist(data[:,23],bins=50)
print("Number of each action (NwE is nudge with elbow)")
print("female are likely to be touched/touch zones: ")
plot_pie(data[:,4:13])

print("Male are likely to be touched/touch zones: ")
plot_pie(data[:,13:22])<jupyter_output>Male are likely to be touched/touch zones:<jupyter_text>*The most activated zones are:*+ Hand+ Forearm + Arm+ shoulder  Tree-based feature selection<jupyter_code>from sklearn.ensemble import ExtraTreesClassifier
#keep=[4,5,6,7,13,14,15,16]
data[:,22]=(data[:,22]-np.mean(data[:,22]))/np.std(data[:,22])
X=data[:,4:22]
y=data[:,-3]
print(y)
y=pd.get_dummies(y).values
y=np.argmax(y,axis=1)
print("Xshape",X.shape)
print("yshape",y.shape)
print(y)
print(X[:10])

importance=[]
for i in range(1000):
    clf = ExtraTreesClassifier(n_estimators=10)
    clf = clf.fit(X, y)
    mean_importance=clf.feature_importances_
    importance.append(clf.feature_importances_)  
    mean_importance=np.mean(importance,axis=0)
print(mean_importance)
x = np.arange(18)
plt.bar(x, mean_importance)
plt.xticks(x, df.columns[4:22])
plt.xlabel("Body part involved Female/Male")
plt.ylabel("importance for classification")
plt.show()<jupyter_output><empty_output><jupyter_text>*For touch gestures(Action) classification, the features (zones) are:*+ F0(hand) > F1(forearm) > F4(chest) >= F3(shoulder) ------>FEMALES+ M0(hand) > M3(shoulder) >= M2(arm) > M4(chest) ------->MALES<jupyter_code>x = np.arange(18)
plt.bar(x, np.sum(X,axis=0))
plt.xticks(x, df.columns[4:22])
plt.xlabel("Body part involved Female/Male")
plt.ylabel("Activation")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16315261044176707, 'fraction_numerical': 0.02535140562248996, 'mean_word_length': 4.012578616352202, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '445990', 'license': 'CECILL-B', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1314, 'n_words': 351, 'path': 'examples/Protocole.ipynb', 'repo_name': 'Wail13/SyncPy', 'size': '3984'}