Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Human Activity Recognition using Smartphones added in Generative Models #353

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
**PROJECT TITLE - Human Activity Recognition using Smartphones**


**GOAL** - The aim of this project is to build a model that predicts the human activities such as Walking, Walking_Upstairs, Walking_Downstairs, Sitting, Standing or Laying using data recorded by multiple smartphone sensors.



**DATASET INFO** = This dataset is collected from 30 persons(referred as subjects in this dataset), performing different activities with a smartphone to their waists. The data is recorded with the help of sensors (accelerometer and Gyroscope) in that smartphone. This experiment was video recorded to label the data manually.



**WHAT HAVE I DONE**

**Exploratory Data Analysis**

- Loading the datasets
- Cleaning the data
- Check for Duplicates
- Checking for NaN/null values
- Checking for data imbalance
- Analysis of the activity feature to understand how many types of activites have been performed
- Cleaning the feature names for an easy understanding
- Saving the new dataframes with cleaned feature names in csv files¶
- Exploratory Data Analysis
- Visualization of the Stationary and Moving activities
- Maximizing the Static and Dynamic activities plots
- Visualization of the magnitude of acceleration data captured by the accelerometer sensor of the smartphone
- Visualizing the position of GravityAccelerationComponants data captured by the gyroscopic sensor of the smartphone
- Visualizations for feature distribution in space.
- Visualizations with stripplot
- Apply t-sne on the data

**ML CLASSIFIERS approach**

- Importing libraries
- Loading the cleaned datasets
- Defining a function to plot the confusion matrix
- Defining a generic function to run any model specified
- Defining a function to print the gridsearch Attributes for Hypertuning the model
- Logistic Regression with GridSearchCV
- Linear SVC with GridSearch
- Decision Trees with GridSearchCV
- Comparing all models
- Getting predictions using the Hypertuned Logistic regression model
- Getting predictions using the Hypertuned Linear SVC model


**Artificial Neural Network(ANN) approach**

- Loading datsets
- Pre-processing and data preparation to feed data into Artificial Neural Network.
- Feature Scaling
- Using Principle Component Analysis(PCA) approach for Dimensionality Reduction
= Building the ANN Model
= Saving the model



**MODELS USED**

- **Artificial Neural Network** - *Artificial neural networks (ANNs) use learning algorithms that can independently make adjustments - or learn, in a sense - as they receive new input. This makes them a very effective tool for non-linear statistical data modeling.*

- **Logistic Regression** - *Logistic Regression is a machine learning (ML) algorithm for supervised learning – classification analysis. Within classification problems, we have a labeled training dataset consisting of input variables (X) and a categorical output variable (y).*

- **Linear SVC** - *The objective of a Linear SVC (Support Vector Classifier) is to fit to the data you provide, returning a "best fit" hyperplane that divides, or categorizes, the data*

- **Decision Tree** = *Decision tree algorithm falls under the category of supervised learning. They can be used to solve both regression and classification problems. Decision tree uses the tree representation to solve the problem in which each leaf node corresponds to a class label and attributes are represented on the internal node of the tree.*

**Comparative Analysis of the Models**

- **Logistic Regression**

*Accuracy - 95.52%*


- **Linear SVC**
-
*Accuracy - 96.71%*



- **DEcision Trees**
-
*Accuracy - 86.46%*



- **Artificial Neural Network(ANN)*
-
*Accuracy - 85.00%*



**Therefore we can conclude that the Linear SVC model outperforms all the other model approaches with a accuracy of 96.71%**





**LIBRARIES NEEDED**

- pandas
- matplotlib
- numpy
- tensorflow
- itertools
- datetime
- pickle
- os
- keras
- scikit learn


**Conclusion**

In this project we have first tried to understand the training and testing data using different Exploratory Data Analysis techniques and visualizations. Then we have tried to implement some classical machine learning algorithms and deep learning frameworks to train models and observe how each model perform. After performing all these operations, we see that the Linear SVC model performs best among all the other models.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading