Human Activity Recognition using Smartphone Dataset- ML Python
Hey ML Enthusiasts, In this article, we are going to create a Human Activity Recognition Model using Machine Learning in Python. Before Proceeding further in the article, you are advised to download Dataset and human-activity-recognition (Notebook)
The Dataset contains various sensors data, related to various activities performed by different individuals.
Requirements:
- Keras
- Python == 3.6
Code Overview: Human Activity Recognition using Smartphone Dataset in Python
# Lets load Train CSV df_train = pd.read_csv('/kaggle/input/human-activity-recognition-with-smartphones/train.csv') df_train.head()
We are going to load the data frames and then do Feature Engineering.
We will separate features and Labels:
x_train = df_train.iloc[:,0:-2] x_train = np.array(x_train) x_train.shape
And now will encode the Labels into 0 and 1 format:
from sklearn.preprocessing import LabelEncoder lb = LabelEncoder() y_train = lb.fit_transform(y_train) # Lets encode this from keras.utils import to_categorical y_train = to_categorical(y_train) y_train
Using TensorFlow backend.
Leave a Reply