Behavior Analysis with Machine Learning and R: The free eBook

Check out this new free ebook to learn how to leverage the power of machine learning to analyze behavioral patterns from sensor data and electronic records using R.

By Enrique Garcia-Ceja, Researcher at SINTEFdigital, R + behavior analysis + sensors + machine learning.

Automatic behavior monitoring technologies are becoming part of our everyday lives thanks to advances in sensors and machine learning. The automatic analysis and understanding of behavior are being applied to solve problems in several fields, including health care, sports, marketing, ecology, security, and psychology, to name a few. Behavior Analysis with Machine Learning and R aims to provide an introduction to machine learning concepts and algorithms applied to a diverse set of behavior analysis problems. It focuses on the practical aspects of solving such problems based on data collected from sensors or stored in databases.

The book covers topics within the entire data analysis pipeline—from data collection, visualization, preprocessing, and encoding to model training and evaluation. No prior knowledge in machine learning is assumed. Some of the topics include:

  • How to build supervised learning models to predict indoor locations based on Wi-Fi signals, recognize physical activities from smartphone sensors and 3D skeleton data, detect hand gestures from accelerometer signals, and much more.
  • Learn how unsupervised learning algorithms can be used to discover criminal behavioral patterns and find out how Miss Karlene used association rules mining to help this poor girl find her stolen doll:

  • Program your own ensemble learning methods and use multi-view stacking to fuse signals from heterogeneous data sources.
  • Train deep learning models with Keras and TensorFlow, including neural networks to classify muscle activity from electromyography signals and convolutional neural networks to detect smiles in images.

The book is available for free at


  • Chapter 1. Introduction
  • Chapter 2. Predicting Behavior with Classification Models
  • Chapter 3. Predicting Behavior with Ensemble Learning
  • Chapter 4. Exploring and Visualizing Behavioral Data
  • Chapter 5. Preprocessing Behavioral Data
  • Chapter 6. Discovering Behaviors with Unsupervised Learning
  • Chapter 7. Encoding Behavioral Data
  • Chapter 8. Predicting Behavior with Deep Learning
  • Chapter 9. Multi-User Validation
  • Appendix A: Setup your Environment
  • Appendix B: Datasets


Bio: Enrique Garcia Ceja is a research scientist at SINTEF, Norway. For the last 10 years, he has been conducting research on behavior monitoring and analysis with machine learning and wearable devices.