Behavior Analysis with Machine Learning and R
Behavior Analysis with Machine Learning and R
A Sensors and Data Driven Approach
About the Book
This book aims to provide an introduction to machine learning and deep learning concepts and algorithms applied to a diverse set of behavior analysis problems.
The book covers topics and practical aspects 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. The book covers How To:
- Build supervised machine 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.
- Apply some of the most common techniques to explore, visualize, encode, and preprocess behavioral data.
- Use unsupervised learning algorithms to discover criminal behavioral patterns.
- Program your own ensemble learning methods and use multi-view stacking to fuse signals from heterogeneous data sources.
- Encode your data using different representations, such as feature vectors, time series, images, bags of words, graphs, and so on.
- 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.
- Evaluate the performance of your models in traditional and multi-user settings.
- Train anomaly detection models such as Isolation Forests and autoencoders to detect abnormal fish trajectories.
- And much more!
A html version is available at: https://enriquegit.github.io/behavior-free/
- Supplemental Material
- 1.1 What is Machine Learning?
- 1.2 Types of Machine Learning
- 1.3.1 Tables
- 1.3.2 Variable Types
- 1.3.3 Predictive Models
- 1.4 Data Analysis Pipeline
- 1.5 Evaluating Predictive Models
1.6 Simple Classification Example
- 1.6.1 K-fold Cross-Validation Example
- 1.7 Simple Regression Example
- 1.8 Underfitting and Overfitting
- 1.9 Bias and Variance
2. Predicting Behavior with Classification Models
2.1 k-nearest Neighbors
- 2.1.1 Indoor Location with Wi-Fi Signals
2.2 Performance Metrics
- 2.2.1 Confusion Matrix
2.3 Decision Trees
- 2.3.1 Activity Recognition with Smartphones
2.4 Naive Bayes
- 2.4.1 Activity Recognition with Naive Bayes
2.5 Dynamic Time Warping
- 2.5.1 Hand Gesture Recognition
2.6 Dummy Models
- 2.6.1 Most-frequent-class Classifier
- 2.6.2 Uniform Classifier
- 2.6.3 Frequecy-based Classifier
- 2.6.4 Other Dummy Classifiers
- 2.1 k-nearest Neighbors
3. Predicting Behavior with Ensemble Learning
- 3.1.1 Activity recognition with Bagging
- 3.2 Random Forest
- 3.3 Stacked Generalization
- 3.4 Multi-view Stacking for Home Tasks Recognition
- 3.1 Bagging
4. Exploring and Visualizing Behavioral Data
- 4.1 Talking with Field Experts
- 4.2 Summary Statistics
- 4.3 Class Distributions
- 4.4 User-Class Sparsity Matrix
- 4.5 Boxplots
4.6 Correlation Plots
- 4.6.1 Interactive Correlation Plots
- 4.7.1 Interactive Timeseries
- 4.8 Multidimensional Scaling (MDS)
- 4.9 Heatmaps
- 4.10 Automated EDA
5. Preprocessing Behavioral Data
5.1 Missing Values
- 5.1.1 Imputation
- 5.2 Smoothing
- 5.3 Normalization
5.4 Imbalanced Classes
- 5.4.1 Random Oversampling
- 5.4.2 SMOTE
- 5.5 Information Injection
- 5.6 One-hot Encoding
- 5.1 Missing Values
6. Discovering Behaviors with Unsupervised Learning
6.1 K-means Clustering
- 6.1.1 Grouping Student Responses
- 6.2 The Silhouette Index
6.3 Mining Association Rules
- 6.3.1 Finding Rules for Criminal Behavior
- 6.1 K-means Clustering
7. Encoding Behavioral Data
- 7.1 Feature Vectors
- 7.2 Timeseries
- 7.3 Transactions
- 7.4 Images
7.5 Recurrence Plots
- 7.5.1 Computing Recurence Plots
- 7.5.2 Recurrence Plots of Hand Gestures
- 7.6.1 BoW for Complex Activities
- 7.7.1 Complex Activities as Graphs
8. Predicting Behavior with Deep Learning
8.1 Introduction to Artificial Neural Networks
- 8.1.1 Sigmoid and ReLU Units
- 8.1.2 Assembling Units into Layers
- 8.1.3 Deep Neural Networks
- 8.1.4 Learning the Parameters
- 8.1.5 Parameter Learning Example in R
- 8.1.6 Stochastic Gradient Descent
8.2 Keras and TensorFlow with R
- 8.2.1 Keras Example
8.3 Classification with Neural Networks
- 8.3.1 Classification of Electromyography Signals
- 8.4.1 Early Stopping
- 8.4.2 Dropout
- 8.5 Fine-Tuning a Neural Network
8.6 Convolutional Neural Networks
- 8.6.1 Convolutions
- 8.6.2 Pooling Operations
8.7 CNNs with Keras
- 8.7.1 Example 1
- 8.7.2 Example 2
- 8.8 Smiles Detection with a CNN
- 8.1 Introduction to Artificial Neural Networks
9. Multi-User Validation
9.1 Mixed Models
- 9.1.1 Skeleton Action Recognition with Mixed Models
- 9.2 User-Independent Models
- 9.3 User-Dependent Models
9.4 User-Adaptive Models
- 9.4.1 Transfer Learning
- 9.4.2 A User-Adaptive Model for Activity Recognition
- 9.1 Mixed Models
10. Detecting Abnormal Behaviors
- 10.1 Isolation Forests
10.2 Detecting Abnormal Fish Behaviors
- 10.2.1 Explore and Visualize Trajectories
- 10.2.2 Preprocessing and Feature Extraction
- 10.2.3 Training the Model
- 10.2.4 ROC curve and AUC
- 10.3.1 Autoencoders for Anomaly Detection
- Appendix A: Setup your Environment
- Appendix B: Datasets
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
C++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
The book is almost daily updated. These incremental updates ease my interaction with the proofreaders.
A Guide to Artificial Intelligence in HealthcareDr. Bertalan Mesko
Can we stay human in the age of A.I.? To go even further, can we grow in humanity, can we shape a more humane, more equitable and sustainable healthcare? This e-book aims to prepare healthcare and medical professionals for the era of human-machine collaboration. Read our guide to understanding, anticipating and controlling artificial intelligence.
Atomic KotlinBruce Eckel and Svetlana Isakova
For both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Introducing EventStormingAlberto Brandolini
The deepest tutorial and explanation about EventStorming, straight from the inventor.
C++ Best PracticesJason Turner
Level up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Ansible for DevOpsJeff Geerling
Ansible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Everyday Rails - RSpecによるRailsテスト入門Junichi Ito (伊藤淳一), AKIMOTO Toshiharu, 魚振江, and Aaron Sumner
RSpecを使ってRailsアプリケーションに信頼性の高いテストを書く実践的なアドバイスを提供します。詳細で丁寧な説明は本書のオリジナルコンテンツです。また、説明には実際に動かせるサンプルアプリケーションも使用します。本書は2017年版にアップデートされ、RSpec 3.6やRails 5.1といった新しい環境に対応しています！さあ、自信をもってテストできるようになりましょう！
The Hundred-Page Machine Learning BookAndriy Burkov
Everything you really need to know in Machine Learning in a hundred pages.
Composing SoftwareEric Elliott
All software design is composition: the act of breaking complex problems down into smaller problems and composing those solutions. Most developers have a limited understanding of compositional techniques. It's time for that to change.
R Programming for Data ScienceRoger D. Peng
This book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before...
All the Books of The Medical Futurist
6 BooksWe put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon...
Cisco CCNA 200-301 Complet
4 BooksCe lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301.
Linux Administration Complet
4 BooksCe lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité...
Learn Git, Bash, and Terraform the Hard Way
3 BooksLearn Git, Bash and Terraform using the Hard Way method.These technologies are essential tools in the DevOps armoury. These books walk you through their features and subtleties in a simple, gradual way that reinforces learning rather than baffling you with theory.
3 BooksBuy every PowerShell book from Adam Bertram at a 20% discount!
Software Architecture and Beautiful APIs
2 BooksThere is no better way to learn how to design good APIs than to look at many existing examples, complementing the Software Architecture theory on API design.
9 Books-Bundle: Shut Up and Code!
9 Books"Shut up and code." Laughter in the audience. The hacker had just plugged in his notebook and started sharing his screen to present his super-smart Python script. "Shut up and code" The letters written in a white literal coding font on black background was the hackers' home screen background mantra. At the time, I was a first-year computer...
CCDE Practical Studies (All labs)
3 BooksCCDE lab
Modern C++ by Nicolai Josuttis