File size: 4,986 Bytes
d7d1738
 
 
 
 
 
 
 
 
7e2ba88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
license: mit
task_categories:
- feature-extraction
language:
- en
tags:
- sensor
- physics
---


# Hand Detection Training Data

This folder contains sensor data collected from mobile devices for training the hand detection model.

## Overview

The dataset includes accelerometer and gyroscope readings from 2 subjects, each holding a device with both their left and right hands. This data is used to train the Random Forest classifier that achieves 94.6% accuracy in detecting which hand is holding the device.

## Directory Structure

```
hand_data/
├── accelerometer/          # Accelerometer sensor data (primary)
│   ├── s-1_left_hand.csv   # Subject 1, left hand (39,102 samples)
│   ├── s-1_right_hand.csv  # Subject 1, right hand (30,528 samples)
│   ├── s-2_left_hand.csv   # Subject 2, left hand (44,724 samples)
│   └── s-2_right_hand.csv  # Subject 2, right hand (35,408 samples)

└── gyrocop/                # Gyroscope data (supplementary)
    ├── s-1_left_hand.csv   # Subject 1, left hand
    └── s-1_right_hand.csv  # Subject 1, right hand
```

## Data Format

### Accelerometer Data

Each CSV file contains timestamped 3-axis accelerometer readings:

| Column    | Type      | Description                              |
|-----------|-----------|------------------------------------------|
| timestamp | datetime  | ISO 8601 format (e.g., 2025-12-27T09:13:07.598506) |
| x         | float     | X-axis acceleration (m/s²)               |
| y         | float     | Y-axis acceleration (m/s²)               |
| z         | float     | Z-axis acceleration (m/s²)               |

**Example:**
```csv
timestamp,x,y,z
2025-12-27T09:13:07.598506,0.849452,3.895515,8.087741
2025-12-27T09:13:08.083118,0.727418,4.000800,8.099705
```

### Gyroscope Data

Similar structure with angular velocity measurements (°/s).

## Dataset Statistics

### Total Samples
- **Subject 1 (Left)**: 39,102 samples
- **Subject 1 (Right)**: 30,528 samples
- **Subject 2 (Left)**: 44,724 samples
- **Subject 2 (Right)**: 35,408 samples
- **Total**: 149,762 samples

### Collection Method
- Device: Mobile phone with accelerometer sensor
- Sampling rate: ~50-100 Hz (varies)
- Duration: Multiple sessions per subject/hand
- Environment: Normal daily usage patterns

## Data Characteristics

### X-Axis (Left/Right Tilt)
- **Primary discriminator** for hand detection
- Left hand: Positive values (device tilts right)
- Right hand: Negative values (device tilts left)
- Statistical significance: p < 0.000001

### Y-Axis (Forward/Backward Tilt)
- Secondary feature
- Shows hand-specific patterns
- Less discriminative than X-axis

### Z-Axis (Vertical)
- Represents gravity component
- Generally around 9.8 m/s² when stationary
- Varies with device orientation

### Magnitude
- Calculated: √(x² + y² + z²)
- Overall movement intensity
- Helps distinguish activity levels

## Usage in Training

This data is used in [../which_hand_you_use.ipynb](https://github.com/rockerritesh/sensor/blob/main/hand/which_hand_you_use.ipynb) for:

1. **Exploratory Data Analysis (EDA)**
   - Distribution analysis
   - Statistical testing
   - Correlation analysis
   - Time series visualization

2. **Feature Engineering**
   - Calculate magnitude
   - Window-based statistics (mean, std, min, max)
   - Temporal features (deltas, trends)

3. **Model Training**
   - Single-point Random Forest (94.6% accuracy)
   - Windowed Random Forest (96%+ accuracy)
   - PCA for visualization

## File Sizes

- `s-1_left_hand.csv`: ~2.1 MB
- `s-1_right_hand.csv`: ~1.7 MB
- `s-2_left_hand.csv`: ~2.4 MB
- `s-2_right_hand.csv`: ~2.0 MB

**Total**: ~8.2 MB (accelerometer only)

## Data Quality

### Completeness
✅ No missing values
✅ Continuous timestamps
✅ Consistent format across all files

### Statistical Validation
✅ Normal distribution per axis
✅ Significant hand differences (p < 0.05)
✅ Consistent patterns across subjects

## Privacy & Ethics

- Data collected with informed consent
- No personally identifiable information
- Used solely for research purposes
- Anonymized subject identifiers (S1, S2)

## Collection Guidelines

If collecting additional data:

1. **Consistency**: Use same device/settings
2. **Duration**: Minimum 5-10 minutes per hand
3. **Activity**: Natural usage (browsing, typing, etc.)
4. **Labeling**: Clear hand identification
5. **Format**: Match existing CSV structure

## Notes

- This data is **excluded from git** (see `.gitignore`)
- Keep data locally or use Git LFS for large files
- Model files are generated from this data
- Data collection scripts in `shared/` folder

## Related Files

- **Training**: [../which_hand_you_use.ipynb](https://github.com/rockerritesh/sensor/blob/main/hand/which_hand_you_use.ipynb)
- **Models**: `hand_classifier_*.pkl` files
- **Collection**: `collect_data.py` in shared folder

---

**Last Updated**: December 2025
**Format Version**: 1.0
**Total Samples**: 149,762