Background Human activity recognition (HAR) is increasingly important in enhancing healthcare systems by enabling accurate monitoring of individuals' movements through sensor data. This paper is motivated by the need to improve the accuracy of HAR, particularly for applications in e-health systems, where reliable activity detection can lead to better health outcomes. The study explores six prominent machine learning techniques—decision tree, random forest, linear regression, Naïve Bayes, k-nearest neighbor, and neural networks—to determine which methods can most effectively predict activities like walking, sitting, standing, laying, walking upstairs, and walking downstairs. Methods We employed these six machine learning algorithms to analyze a comprehensive dataset derived from various sensors. Each model was rigorously trained and evaluated to compare its effectiveness in recognizing human activities. The experiments aimed to identify strengths and weaknesses in each approach, with particular emphasis on advanced techniques such as random forest, convolutional neural networks (CNNs), and gated recurrent networks (GRNs). Results The experimental evaluation revealed that the random forest classifier, CNN, GRN, and neural networks delivered promising results, achieving high accuracy levels. Notably, the neural network model excelled, attaining an impressive accuracy of 98%. In contrast, the Naïve Bayes model did not meet the performance expectations set by the other algorithms. Conclusions This research effectively classifies activities such as sitting, standing, laying, walking, walking downstairs, and walking upstairs, underscoring the potential of machine learning in HAR. The findings highlight the superior performance of neural networks in enhancing activity recognition, which could lead to advanced applications in e-health systems and improve overall healthcare monitoring strategies.