Human activity recognition is gaining promising attention in the research community with the recent revolution in artificial intelligence and machine learning to infer activities from the time-series sensor data. Significant progress has been made in the application of effective machine learning algorithms for pattern recognition and prediction of human activities in smart environments, such as ambient assisted living, healthcare monitoring, surveillance-based security and fitness tracking. In this paper, we propose to apply a supervised learning algorithm called margin setting algorithm (MSA) to predict the human activities. To validate the performance of MSA, we compare it with the support vector machine (SVM) and artificial neural network (ANN) and understand the activities of daily living of two residents in a smart home. The experimental results show that our proposed algorithm outperforms other state-of-the-art machine learning algorithms.