Human activity recognition is the problem of classifying sequences of data recorded by specialized harnesses or smart phones into known well-defined Human activities, The problem will be solved using K-Nearest-Neighbor (KNN) algorithm where we will train the model on dataset of collection of human activities in order to classifying it.
This is list of required packages and modules for the project to be installed :
- Python 3.x
- Pandas
- Numpy
- Seaborn
- Matplotlib
- Scikit-learn
Install all required packages :
pip install -r requirements.txtHuman activites dataset contain about 564 columns to describe human current activity
and a target column which describe what's the current state of a human.
Dataset features and target :

Dataset head :

In this part we will see the project code divided to sections as follows:
-
Section 1 | Data Preprocessing :
In this section we aim to do some operations on the dataset before training the model on it,
processes like :- Loading dataset
- Check missing values and dataset statistics
- Visualize some dataset columns in order to have some insights for better understanding
- Apply dimensionality reduction using PCA algorithm in order to transform the data from a high-dimensional space into a low-dimensional space
- Scale the dataset
- Split the dataset into training and testing sets
-
Section 2 | Model Creation :
The dataset is ready for training, so we create a K-nearest Neighbors "KNN" model using scikit-learn and thin fit it to the data. -
Section 3 | Model Evaluation :
Finally we evaluate the model by getting accuracy, classification report and confusion matrix.
- Clone the repo
git clone https://github.com/omaarelsherif/Human-Activity-Recognition-Using-Machine-Learning.git
- Run the code from cmd
python human_activity_recognation.py
Now let's see the project output after running :
Accuracy and classification report :

These links may help you to better understanding of the project idea and techniques used :
- Human Activity Recognition research : https://bit.ly/384uASG
- Models for Human Activity Recognition : https://bit.ly/3zhW57a
- Standard Scaler : https://bit.ly/3mt2r04
- Principal Component Analysis (PCA) : https://bit.ly/3knqZVD
- K-Nearest Neighbors (KNN) : https://bit.ly/2XI2Ukq
- Model evaluation : https://bit.ly/3B12VOO
- E-mail : omaarelsherif@gmail.com
- LinkedIn : https://www.linkedin.com/in/omaarelsherif/
- Facebook : https://www.facebook.com/omaarelshereif




